You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log.Printf("\nduration metric: took %f seconds to execute SQL query for flake rate and duration by week chart since start of handler", time.Since(start).Seconds())
223
223
224
+
// Groups the datetimes together by month, calculating flake percentage and aggregating the individual results/durations for each date
225
+
sqlQuery=fmt.Sprintf(`
226
+
SELECT
227
+
DATE_TRUNC('month', TestTime) AS StartOfDate,
228
+
AVG(Duration) AS AvgDuration,
229
+
ROUND(COALESCE(AVG(CASE WHEN Result = 'fail' THEN 1 ELSE 0 END) * 100, 0), 2) AS FlakePercentage,
230
+
STRING_AGG(CommitID || ': ' || Result || ': ' || Duration, ', ') AS CommitResultsAndDurations
231
+
FROM %s
232
+
WHERE TestName = $1
233
+
GROUP BY StartOfDate
234
+
ORDER BY StartOfDate DESC
235
+
`, viewName)
236
+
varflakeByMonth []models.DBTestRateAndDuration
237
+
err=m.db.Select(&flakeByMonth, sqlQuery, test)
238
+
iferr!=nil {
239
+
returnnil, fmt.Errorf("failed to execute SQL query for flake rate and duration by month chart: %v", err)
240
+
}
241
+
log.Printf("\nduration metric: took %f seconds to execute SQL query for flake rate and duration by month chart since start of handler", time.Since(start).Seconds())
242
+
224
243
data:=map[string]interface{}{
225
-
"flakeByDay": flakeByDay,
226
-
"flakeByWeek": flakeByWeek,
244
+
"flakeByDay": flakeByDay,
245
+
"flakeByWeek": flakeByWeek,
246
+
"flakeByMonth": flakeByMonth,
227
247
}
228
248
log.Printf("\nduration metric: took %f seconds to gather individual test chart data since start of handler\n\n", time.Since(start).Seconds())
0 commit comments