include db for gitea build
This commit is contained in:
1 parent
8de4a2e010
commit
645f923175
33 files changed
+1490
-150
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package alerts
|
||||
|
||||
import (
|
||||
"git.tornberg.me/go-otel/internal/features"
|
||||
"git.tornberg.me/go-otel/internal/triage"
|
||||
)
|
||||
|
||||
// TriageOf classifies a pattern's example event with the deterministic rules.
|
||||
func TriageOf(e features.Event) triage.Result {
|
||||
return triage.Classify(triage.Input{Service: e.Service, Kind: e.Kind, Status: e.StatusCode, Route: e.Route, Title: e.SpanName, Message: e.Message,
|
||||
IsTimeout: e.IsTimeout, IsCancellation: e.IsCancellation, IsRetry: e.IsRetry})
|
||||
}
|
||||
|
||||
// FilterActionable keeps only patterns whose category should page a human
|
||||
// (unless keepMuted), recomputing each spike's excess so a probe storm cannot
|
||||
// alert by itself. muted, when non-nil, counts what was dropped per category.
|
||||
func FilterActionable(spikes []features.Spike, keepMuted bool, muted map[triage.Category]int) []features.Spike {
|
||||
var out []features.Spike
|
||||
for _, sp := range spikes {
|
||||
var kept []features.PatternDelta
|
||||
sp.Excess = 0
|
||||
for _, p := range sp.Patterns {
|
||||
c := TriageOf(p.Example).Category
|
||||
if !keepMuted && !c.Actionable() {
|
||||
if muted != nil {
|
||||
muted[c]++
|
||||
}
|
||||
continue
|
||||
}
|
||||
kept = append(kept, p)
|
||||
sp.Excess += p.Excess
|
||||
}
|
||||
if len(kept) > 0 {
|
||||
sp.Patterns = kept
|
||||
out = append(out, sp)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in new issue
Block a user