mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
Compare timestamps as is when sorting
Remove rounding of timestamps when sorting alert list, not sure why it was added, it's not needed
This commit is contained in:
@@ -67,9 +67,8 @@ func (a UnseeAlertList) Swap(i, j int) {
|
||||
a[i], a[j] = a[j], a[i]
|
||||
}
|
||||
func (a UnseeAlertList) Less(i, j int) bool {
|
||||
// compare timestamps rounded up to 2s, subsecond accuracy is lost to keep
|
||||
// ordering stable even with small time drift
|
||||
return a[i].StartsAt.Round(2 * time.Second).After(a[j].StartsAt.Round(2 * time.Second))
|
||||
// compare timestamps, if equal compare labels
|
||||
return a[i].StartsAt.After(a[j].StartsAt)
|
||||
}
|
||||
|
||||
// UnseeAlertGroup is vanilla Alertmanager group, but alerts are flattened
|
||||
|
||||
Reference in New Issue
Block a user