Documentation
¶
Overview ¶
Package investigate merges the signals that explain a spike (deploys, config changes, restarts, resource saturation) into one ordered timeline.
Index ¶
- Constants
- type Event
- func FromChanges(cs []changes.Change) []Event
- func Merge(lists ...[]Event) []Event
- func RestartEvents(samples []telemetry.Sample, gap time.Duration) []Event
- func SaturationEvents(cpu, memUsage, memLimit []telemetry.Sample, th Thresholds) []Event
- func Window(events []Event, from, to time.Time) []Event
- type Thresholds
Constants ¶
const ( KindRestart = "restart" KindSaturation = "saturation" )
Kinds added on top of changes.Kind.
const ( SeverityInfo = "info" SeverityWarning = "warning" SeverityCritical = "critical" )
Severity of a timeline event.
const ( EnvSaturationCPU = "APP_SATURATION_CPU_PERCENT" EnvSaturationMemory = "APP_SATURATION_MEMORY_PERCENT" EnvSaturationMinGap = "APP_SATURATION_MIN_SAMPLES" )
Saturation env vars and defaults.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
At time.Time `json:"at"`
Kind string `json:"kind"`
Severity string `json:"severity"`
Title string `json:"title"`
Detail string `json:"detail,omitempty"`
Ref string `json:"ref,omitempty"`
LikelyCause bool `json:"likely_cause,omitempty"`
}
Event is one entry of the What changed timeline.
func FromChanges ¶
FromChanges converts aggregator output into timeline events.
func Merge ¶
Merge combines event lists into one timeline, oldest first. Ties order by kind rank (causes before symptoms) then title, so output is deterministic.
func RestartEvents ¶
RestartEvents turns restart samples into events. Restarts closer together than gap collapse into one event whose title carries the count.
func SaturationEvents ¶
func SaturationEvents(cpu, memUsage, memLimit []telemetry.Sample, th Thresholds) []Event
SaturationEvents finds sustained CPU and memory pressure. cpu is a percent series; memUsage and memLimit are bytes series sampled at the same times (a missing or zero limit skips memory).
type Thresholds ¶
Thresholds are the saturation limits in percent.
func ThresholdsFromEnv ¶
func ThresholdsFromEnv() Thresholds
ThresholdsFromEnv reads the saturation limits from the environment.