Skip to content

Commit f4c2687

Browse files
authored
add regression report generator (#7094)
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #7112 * #7096 * #7095 * __->__ #7094 main class to detect regression 1. use baseline data to generate baseline for regression detection, currently support (max,min, latest, earliest) within the baseline data window 2. decide wether the target data list under the threshold for regression detection based on the baseline value. 3. if detected more than 2 continuous dp from current timestamp, mark as regression
1 parent 121c2b7 commit f4c2687

File tree

5 files changed

+459
-1
lines changed

5 files changed

+459
-1
lines changed

aws/lambda/benchmark_regression_summary_report/common/benchmark_time_series_api_model.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import datetime as dt
12
from dataclasses import dataclass, field
2-
from typing import Any, Dict, List
3+
from typing import Any, Dict, List, Optional
34

45
import requests
56

@@ -62,3 +63,24 @@ def from_request(
6263
except Exception as e:
6364
raise RuntimeError(f"Malformed API payload: {e}")
6465
return cls(data=BenchmarkTimeSeriesApiData(time_series=ts, time_range=tr))
66+
67+
68+
def get_latest_meta_info(
69+
time_series: List[BenchmarkTimeSeriesItem],
70+
) -> Optional[dict[str, Any]]:
71+
if not time_series:
72+
return None
73+
74+
pts = [p for s in time_series for p in s.data]
75+
latest = max(
76+
pts,
77+
key=lambda p: dt.datetime.fromisoformat(
78+
p["granularity_bucket"].replace("Z", "+00:00")
79+
),
80+
)
81+
return {
82+
"commit": latest.get("commit", ""),
83+
"branch": latest.get("branch", ""),
84+
"timestamp": latest.get("granularity_bucket", ""),
85+
"workflow_id": latest.get("workflow_id", ""),
86+
}

0 commit comments

Comments
 (0)