Skip to content

Commit

Permalink
[chromeperf] Update anomaly type with reporting info
Browse files Browse the repository at this point in the history
Anomaly type will have the info needed for triaging:
 - subscription name
 - bug component
 - bug labels
 - bug cc emails.

Bug: b/365007664
Change-Id: I02abaec7f9ed3b90aa9106afc8a8ef24b5f7cea2
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/897284
Reviewed-by: Eduardo Yap <eduardoyap@google.com>
Commit-Queue: Wenbin Zhang <wenbinzhang@google.com>
  • Loading branch information
Wenbin Zhang authored and SkCQ committed Sep 9, 2024
1 parent 75f59f4 commit c7cca53
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 21 deletions.
40 changes: 22 additions & 18 deletions perf/go/chromeperf/anomalyApi.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,28 @@ type AnomalyMap map[string]CommitNumberAnomalyMap

// Anomaly defines the object return from Chrome Perf API.
type Anomaly struct {
Id int `json:"id"`
TestPath string `json:"test_path"`
BugId int `json:"bug_id"`
StartRevision int `json:"start_revision"`
EndRevision int `json:"end_revision"`
IsImprovement bool `json:"is_improvement"`
Recovered bool `json:"recovered"`
State string `json:"state"`
Statistics string `json:"statistic"`
Unit string `json:"units"`
DegreeOfFreedom float64 `json:"degrees_of_freedom"`
MedianBeforeAnomaly float64 `json:"median_before_anomaly"`
MedianAfterAnomaly float64 `json:"median_after_anomaly"`
PValue float64 `json:"p_value"`
SegmentSizeAfter int `json:"segment_size_after"`
SegmentSizeBefore int `json:"segment_size_before"`
StdDevBeforeAnomaly float64 `json:"std_dev_before_anomaly"`
TStatistics float64 `json:"t_statistic"`
Id int `json:"id"`
TestPath string `json:"test_path"`
BugId int `json:"bug_id"`
StartRevision int `json:"start_revision"`
EndRevision int `json:"end_revision"`
IsImprovement bool `json:"is_improvement"`
Recovered bool `json:"recovered"`
State string `json:"state"`
Statistics string `json:"statistic"`
Unit string `json:"units"`
DegreeOfFreedom float64 `json:"degrees_of_freedom"`
MedianBeforeAnomaly float64 `json:"median_before_anomaly"`
MedianAfterAnomaly float64 `json:"median_after_anomaly"`
PValue float64 `json:"p_value"`
SegmentSizeAfter int `json:"segment_size_after"`
SegmentSizeBefore int `json:"segment_size_before"`
StdDevBeforeAnomaly float64 `json:"std_dev_before_anomaly"`
TStatistics float64 `json:"t_statistic"`
SubscriptionName string `json:"subscription_name"`
BugComponent string `json:"bug_component"`
BugLabels []string `json:"bug_labels"`
BugCcEmails []string `json:"bug_cc_emails"`
}

// AnomalyForRevision defines struct to contain anomaly data for a specific revision
Expand Down
16 changes: 13 additions & 3 deletions perf/go/chromeperf/anomalyApi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,16 @@ func TestGetAnomaly_Success(t *testing.T) {
test := "myTest"
subtest := "mysubtest"
testPath := fmt.Sprintf("%s/%s/%s/%s/%s", master, bot, benchmark, test, subtest)
subscription_name := "sub_name"
bug_component := "bug_component"
bug_labels := []string{"label1", "label2", "label3"}
anomaly := Anomaly{
StartRevision: 1111,
EndRevision: 2222,
TestPath: testPath,
StartRevision: 1111,
EndRevision: 2222,
TestPath: testPath,
SubscriptionName: subscription_name,
BugComponent: bug_component,
BugLabels: bug_labels,
}
anomalyResponse := &GetAnomaliesResponse{
Anomalies: map[string][]Anomaly{
Expand All @@ -147,6 +153,10 @@ func TestGetAnomaly_Success(t *testing.T) {
assert.Equal(t, benchmark, params["benchmark"][0])
assert.Equal(t, test, params["test"][0])
assert.Equal(t, subtest, params["subtest_1"][0])
assert.Equal(t, subscription_name, anomalyResp.SubscriptionName)
assert.Equal(t, bug_component, anomalyResp.BugComponent)
assert.Equal(t, 3, len(anomalyResp.BugLabels))
assert.Equal(t, 0, len(anomalyResp.BugCcEmails))
}

func TestGetAnomaly_InvalidChar_Success(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/anomaly-sk/anomaly-sk-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const dummyAnomaly = (bugId: number): Anomaly => ({
segment_size_before: 0,
std_dev_before_anomaly: 0,
t_statistic: 0,
subscription_name: '',
bug_component: '',
bug_labels: [],
bug_cc_emails: [],
});

// The response to a POST of [64809, 64811] to /_/cid/.
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/anomaly-sk/anomaly-sk_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ const dummyAnomaly = (): Anomaly => ({
segment_size_before: 0,
std_dev_before_anomaly: 0,
t_statistic: 0,
subscription_name: '',
bug_component: '',
bug_labels: [],
bug_cc_emails: [],
});

describe('getAnomalyDataMap', () => {
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/chart-tooltip-sk/chart-tooltip-sk-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const dummyAnomaly = (bugId: number): Anomaly => ({
segment_size_before: 0,
std_dev_before_anomaly: 0,
t_statistic: 0,
subscription_name: '',
bug_component: '',
bug_labels: [],
bug_cc_emails: [],
});

// The response to a POST of [64809, 64811] to /_/cid/.
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/chart-tooltip-sk/chart-tooltip-sk_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ describe('chart-tooltip-sk', () => {
segment_size_before: 0,
std_dev_before_anomaly: 0,
t_statistic: 0,
subscription_name: '',
bug_component: '',
bug_labels: [],
bug_cc_emails: [],
});

describe('set fields', () => {
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/explore-simple-sk/explore-simple-sk_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const dummyAnomaly: Anomaly = {
segment_size_before: 0,
std_dev_before_anomaly: 0,
t_statistic: 0,
subscription_name: '',
bug_component: '',
bug_labels: [],
bug_cc_emails: [],
};

describe('calculateRangeChange', () => {
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export interface Anomaly {
segment_size_before: number;
std_dev_before_anomaly: number;
t_statistic: number;
subscription_name: string;
bug_component: string;
bug_labels: string[] | null;
bug_cc_emails: string[] | null;
}

export interface FrameResponse {
Expand Down
4 changes: 4 additions & 0 deletions perf/modules/plot-simple-sk/plot-simple-sk-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const dummyAnomaly = (isImprovement: boolean): Anomaly => ({
segment_size_before: 0,
std_dev_before_anomaly: 0,
t_statistic: 0,
subscription_name: '',
bug_component: '',
bug_labels: [],
bug_cc_emails: [],
});

window.customElements.whenDefined('plot-simple-sk').then(() => {
Expand Down

0 comments on commit c7cca53

Please sign in to comment.