fix notifications
This commit is contained in:
1 parent
e790c02d59
commit
a0f558b43c
10 files changed
+277
-7
No files matched your search
@@ -38,6 +38,32 @@ func FilterActionable(spikes []features.Spike, keepMuted bool, muted map[triage.
|
||||
return out
|
||||
}
|
||||
|
||||
// DropMuted removes patterns whose issue the user ignored, recomputing each
|
||||
// spike's excess and dropping spikes left with nothing to report. A nil
|
||||
// muted keeps everything.
|
||||
func DropMuted(spikes []features.Spike, muted func(issueID string) bool) []features.Spike {
|
||||
if muted == nil {
|
||||
return spikes
|
||||
}
|
||||
var out []features.Spike
|
||||
for _, sp := range spikes {
|
||||
var kept []features.PatternDelta
|
||||
sp.Excess = 0
|
||||
for _, p := range sp.Patterns {
|
||||
if id := p.Example.IssueFingerprint; id != "" && muted(id) {
|
||||
continue
|
||||
}
|
||||
kept = append(kept, p)
|
||||
sp.Excess += p.Excess
|
||||
}
|
||||
if len(kept) > 0 {
|
||||
sp.Patterns = kept
|
||||
out = append(out, sp)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Priority ranks how urgently a pattern needs a human. Client errors (4xx)
|
||||
// are the caller's problem more often than ours, so they rank below server
|
||||
// failures and count for less when deciding whether to page.
|
||||
|
||||
Reference in new issue
Block a user