-
Notifications
You must be signed in to change notification settings - Fork 84
/
kpis.tsx
212 lines (198 loc) · 6.99 KB
/
kpis.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import { Grid } from "@mui/material";
import TimeSeriesPanel from "components/metrics/panels/TimeSeriesPanel";
import { useCHContext } from "components/UseClickhouseProvider";
import dayjs from "dayjs";
import { RocksetParam } from "lib/rockset";
import { useState } from "react";
import { RStoCHTimeParams } from "./metrics";
const ROW_HEIGHT = 240;
export default function Kpis() {
// Looking at data from the past six months
const [startTime, _setStartTime] = useState(dayjs().subtract(6, "month"));
const [stopTime, _setStopTime] = useState(dayjs());
const timeParams: RocksetParam[] = [
{
name: "startTime",
type: "string",
value: startTime,
},
{
name: "stopTime",
type: "string",
value: stopTime,
},
];
const clickhouseTimeParams = RStoCHTimeParams(timeParams);
const useCH = useCHContext().useCH;
return (
<Grid container spacing={2}>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"% of commits red on trunk (Weekly)"}
queryName={"master_commit_red_percent"}
queryCollection={"metrics"}
queryParams={
useCH
? {
...clickhouseTimeParams,
granularity: "week",
workflowNames: ["lint", "pull", "trunk"],
}
: timeParams
}
granularity={"week"}
timeFieldName={"granularity_bucket"}
yAxisFieldName={"metric"}
yAxisRenderer={(unit) => {
return `${unit * 100} %`;
}}
groupByFieldName={"name"}
useClickHouse={useCH}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"# of force merges (Weekly)"}
queryName={"number_of_force_pushes_historical"}
queryCollection={"pytorch_dev_infra_kpis"}
queryParams={clickhouseTimeParams}
granularity={"week"}
timeFieldName={"bucket"}
yAxisFieldName={"count"}
yAxisRenderer={(unit) => `${unit}`}
useClickHouse={true}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"Time to Red Signal - (Weekly)"}
queryName={"ttrs_percentiles"}
queryCollection={"pytorch_dev_infra_kpis"}
queryParams={[...timeParams]}
granularity={"week"}
timeFieldName={"bucket"}
yAxisFieldName={"ttrs_mins"}
yAxisRenderer={(duration) => duration}
groupByFieldName={"percentile"}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"% of force merges (Weekly, 2 week rolling avg)"}
queryName={"weekly_force_merge_stats"}
queryCollection={"commons"}
queryParams={{
...clickhouseTimeParams,
one_bucket: false,
merge_type: "",
granularity: "week",
}}
granularity={"week"}
timeFieldName={"granularity_bucket"}
yAxisFieldName={"metric"}
yAxisRenderer={(unit) => {
return `${unit} %`;
}}
groupByFieldName={"name"}
useClickHouse={true}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"Avg time-to-signal - E2E (Weekly)"}
queryName={"time_to_signal"}
queryCollection={"pytorch_dev_infra_kpis"}
queryParams={useCH ? clickhouseTimeParams : timeParams}
granularity={"week"}
timeFieldName={"week_bucket"}
yAxisFieldName={"avg_tts"}
yAxisLabel={"Hours"}
yAxisRenderer={(unit) => `${unit}`}
groupByFieldName="branch"
useClickHouse={useCH}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"# of reverts (2 week moving avg)"}
queryName={"num_reverts"}
queryCollection={"pytorch_dev_infra_kpis"}
queryParams={useCH ? clickhouseTimeParams : timeParams}
granularity={"week"}
timeFieldName={"bucket"}
yAxisFieldName={"num"}
yAxisRenderer={(unit) => `${unit}`}
groupByFieldName={"code"}
useClickHouse={useCH}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"viable/strict lag (Daily)"}
queryName={"strict_lag_historical"}
queryCollection={"pytorch_dev_infra_kpis"}
queryParams={{
...clickhouseTimeParams,
// Missing data prior to 2024-10-01 due to migration to ClickHouse
...(startTime < dayjs("2024-10-01") && {
startTime: dayjs("2024-10-01")
.utc()
.format("YYYY-MM-DDTHH:mm:ss.SSS"),
}),
repoFullName: "pytorch/pytorch",
}}
granularity={"day"}
timeFieldName={"push_time"}
yAxisFieldName={"diff_hr"}
yAxisLabel={"Hours"}
yAxisRenderer={(unit) => `${unit}`}
// the data is very variable, so set the y axis to be something that makes this chart a bit easier to read
additionalOptions={{ yAxis: { max: 10 } }}
useClickHouse={true}
/>
</Grid>
<Grid item xs={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"Weekly external PR count (4 week moving average)"}
queryName={"external_contribution_stats"}
queryParams={clickhouseTimeParams}
queryCollection={"metrics"}
granularity={"week"}
timeFieldName={"granularity_bucket"}
yAxisFieldName={"pr_count"}
yAxisRenderer={(value) => value}
additionalOptions={{ yAxis: { scale: true } }}
useClickHouse={true}
/>
</Grid>
<Grid item xs={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"Monthly external PR count"}
queryName={"monthly_contribution_stats"}
queryCollection={"pytorch_dev_infra_kpis"}
queryParams={clickhouseTimeParams}
granularity={"month"}
timeFieldName={"year_and_month"}
timeFieldDisplayFormat={"MMMM YYYY"}
yAxisFieldName={"pr_count"}
yAxisRenderer={(value) => value}
additionalOptions={{ yAxis: { scale: true } }}
useClickHouse={true}
/>
</Grid>
<Grid item xs={12} lg={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"Total number of open disabled tests (Daily)"}
queryName={"disabled_test_historical"}
queryCollection={"metrics"}
queryParams={{ ...clickhouseTimeParams, repo: "pytorch/pytorch" }}
granularity={"day"}
timeFieldName={"granularity_bucket"}
yAxisFieldName={"number_of_open_disabled_tests"}
yAxisRenderer={(duration) => duration}
useClickHouse={true}
/>
</Grid>
</Grid>
);
}