Skip to content

Commit

Permalink
added evidence display
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylphrex committed Sep 25, 2023
1 parent 1ea6fc9 commit 525b72b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
44 changes: 31 additions & 13 deletions internal/occurrence/occurrence.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ const (
FrameDropType Type = 2008
FrameRegressionExpType Type = 2010

EvidenceNameDuration EvidenceName = "Duration"
EvidenceNameFunction EvidenceName = "Suspect function"
EvidenceNamePackage EvidenceName = "Package"
EvidenceNameDuration EvidenceName = "Duration"
EvidenceNameFunction EvidenceName = "Suspect function"
EvidenceNamePackage EvidenceName = "Package"
EvidenceFullyQualifiedName EvidenceName = "Fully qualified name"
EvidenceBreakpoint EvidenceName = "Breakpoint"
EvidenceRegression EvidenceName = "Regression"

ContextTrace Context = "trace"

Expand Down Expand Up @@ -202,14 +205,15 @@ func FromRegressedFunction(p profile.Profile, regressed RegressedFunction, f fra
pf = platform.Java
}

fullyQualifiedName := f.FullyQualifiedName(pf)
now := time.Now().UTC()
fingerprint := fmt.Sprintf("%x", regressed.Fingerprint)
beforeP95 := time.Duration(regressed.AggregateRange1).Round(10 * time.Microsecond)
afterP95 := time.Duration(regressed.AggregateRange2).Round(10 * time.Microsecond)
subtitle := fmt.Sprintf("P95 frame duration increased from %s to %s.", beforeP95, afterP95)
regressionText := fmt.Sprintf("P95 frame duration increased from %s to %s.", beforeP95, afterP95)

return &Occurrence{
Culprit: f.FullyQualifiedName(pf),
Culprit: fullyQualifiedName,
DetectionTime: now,
Event: Event{
ID: eventID(),
Expand Down Expand Up @@ -243,14 +247,28 @@ func FromRegressedFunction(p profile.Profile, regressed RegressedFunction, f fra
"unweighted_p_value": regressed.UnweightedPValue,
"unweighted_t_value": regressed.UnweightedTValue,
},
EvidenceDisplay: []Evidence{},
Fingerprint: []string{fingerprint},
ID: eventID(),
IssueTitle: "Frame Duration Regression",
Level: "info",
ProjectID: regressed.ProjectID,
Subtitle: subtitle,
Type: FrameRegressionExpType,
EvidenceDisplay: []Evidence{
{
Important: true,
Name: EvidenceRegression,
Value: regressionText,
},
{
Name: EvidenceBreakpoint,
Value: strconv.FormatUint(regressed.Breakpoint, 10),
},
{
Name: EvidenceFullyQualifiedName,
Value: fullyQualifiedName,
},
},
Fingerprint: []string{fingerprint},
ID: eventID(),
IssueTitle: "Frame Duration Regression",
Level: "info",
ProjectID: regressed.ProjectID,
Subtitle: regressionText,
Type: FrameRegressionExpType,
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/occurrence/regressed_frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type RegressedFunction struct {
AbsolutePercentageChange float64 `json:"absolute_percentage_change"`
AggregateRange1 float64 `json:"aggregate_range_1"`
AggregateRange2 float64 `json:"aggregate_range_2"`
Breakpoint int64 `json:"breakpoint"`
Breakpoint uint64 `json:"breakpoint"`
TrendDifference float64 `json:"trend_difference"`
TrendPercentage float64 `json:"trend_percentage"`
UnweightedPValue float64 `json:"unweighted_p_value"`
Expand Down

0 comments on commit 525b72b

Please sign in to comment.