fix notifications
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Failing after 2m16s

This commit is contained in:
mats committed 2026-09-22 08:35:40 +02:00
1 parent e790c02d59
commit a0f558b43c
10 files changed
+277 -7

No files matched your search

+15 -1
View File
@@ -30,7 +30,9 @@ type Config struct {
BaseURL string // UI link appended to messages, e.g. https://otel.k6n.net
TelegramToken, TelegramChatID, TelegramThreadID string
WebhookURL, WebhookSecret string
// Muted, when set, reports issues a person ignored; their spikes never alert.
Muted func(issueID string) bool
WebhookURL, WebhookSecret string
}
func ConfigFromEnv() Config {
@@ -181,6 +183,15 @@ func (r *Runner) Tick(ctx context.Context, now time.Time) {
spikes := DetectAlerts(events, end, features.SpikeConfig{
Window: r.cfg.Window, BaselineWindows: r.cfg.BaselineWindows, Multiple: r.cfg.Multiple, MinExcess: r.cfg.MinExcess, DataSince: since,
})
// Ignored issues are muted before the cooldown suppressor, so they never
// consume a cooldown slot or page anyone.
if r.cfg.Muted != nil {
before := len(spikes)
spikes = DropMuted(spikes, r.cfg.Muted)
if len(spikes) != before {
log.Printf("alerts: muted spike(s) for ignored issues (%d -> %d)", before, len(spikes))
}
}
spikes = r.sup.Filter(spikes)
r.mu.Lock()
@@ -220,6 +231,9 @@ func DetectAlerts(events []features.Event, at time.Time, cfg features.SpikeConfi
func (r *Runner) deliver(ctx context.Context, a Alert) {
a.Enrich(r.resolver)
if pr, ok := r.resolver.(PodResolver); ok {
a.EnrichPods(ctx, pr)
}
r.mu.Lock()
r.recent = append(r.recent, a)
if len(r.recent) > maxRecent {