trigger

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package trigger ingests incidents (Alertmanager/VMAlert webhooks) and decides, per the configured policy, which ones start an investigation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchRequest added in v0.2.0

func MatchRequest(t config.IncidentTrigger, title, severity, environment, namespace string, labels map[string]string) bool

MatchRequest reports whether the trigger policy passes for a normalized investigation request. It reads the request fields produced by the source adapter / investigate.FromFailureEvent.

Note: the trigger package is imported by investigate (for Deduper), so trigger cannot import investigate without a cycle. Callers bridge the gap by extracting the relevant fields from investigate.Request:

trigger.MatchRequest(pol, r.Title, r.Severity, r.Environment, r.Workload.Namespace, r.Labels)

Types

type Deduper

type Deduper struct {
	// contains filtered or unexported fields
}

Deduper suppresses repeated investigations of the same still-firing alert within a time window. Safe for concurrent use. The clock is injectable for tests.

func NewDeduper

func NewDeduper(window time.Duration) *Deduper

NewDeduper returns a Deduper with the given window. A zero window disables dedup.

func (*Deduper) Seen

func (d *Deduper) Seen(key string) bool

Seen records the key and reports whether it was already seen within the window. The key must be non-empty. Expired entries are evicted on each call so the map stays bounded by the dedup window.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL