File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
web/src/components/Incidents Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,16 @@ export function processAlerts(
166166 }
167167 const matchingRule = alertingRules . find ( ( rule ) => rule . name === alert . metric . alertname ) ;
168168
169- const alertsStartFiring = sortedValues [ 0 ] [ 0 ] * 1000 ;
169+ // Create a new timestamp 5 minutes (300 seconds) earlier than the first timestamp
170+ const originalAlertsStartFiring = sortedValues [ 0 ] [ 0 ] * 1000 ;
171+ const newFirstTimestamp = sortedValues [ 0 ] [ 0 ] - 5 * 60 ;
172+
173+ // Create a copy of the first value from the array of timestamps and update its timestamp
174+ const newFirstValue : [ number , string ] = [ newFirstTimestamp , sortedValues [ 0 ] [ 1 ] ] ;
175+ // Unshift the new value to the beginning of the sortedValues array
176+ sortedValues . unshift ( newFirstValue ) ;
177+
178+ const alertsStartFiring = originalAlertsStartFiring - 5 * 60 * 1000 ;
170179 const alertsEndFiring = sortedValues [ sortedValues . length - 1 ] [ 0 ] * 1000 ;
171180 const resolved = Date . now ( ) - alertsEndFiring > 10 * 60 * 1000 ;
172181
You can’t perform that action at this time.
0 commit comments