Documentation
¶
Overview ¶
Package diagnose is a deterministic, pure-Go pattern matcher over diagnostic signals the platform already collects: deploy attempt status/error, reconcile condition reason strings, crashloop alert state, and recent log lines. It is a read-and-suggest layer on top of the platform API, per this project's AI design rule: it never calls an external model, never writes to any resource, and never influences the reconciler. Every explanation this package returns is backed by a literal signal it read; when nothing matches, Diagnose returns the fallback response rather than a guess.
Index ¶
Constants ¶
const ( ConfidenceHigh = "high" ConfidenceMedium = "medium" ConfidenceNone = "none" )
Confidence levels Result.Confidence can hold.
Variables ¶
var OOMLogPatterns = []string{"oomkilled", "out of memory", "exit code 137", "code: 137", "exit status 137"}
OOMLogPatterns are the lowercase substrings that identify a log line as an OOM-kill signal, shared with internal/rightsizing so that package's resource-recommendation engine treats "this app was OOM-killed" as the same tracked signal this package already diagnoses, not a second, possibly-drifting definition of the same thing.
Functions ¶
This section is empty.
Types ¶
type AttemptInput ¶
AttemptInput is the deploy attempt signal, nil if the caller found no attempt to diagnose (e.g. an app that has never been deployed).
type ConditionInput ¶
type ConditionInput struct {
Type, Status, Reason, Message string
}
ConditionInput is one reconcile condition, the same shape GET /api/v1/apps/{name}/deploys already returns.
type CrashloopInput ¶
type CrashloopInput struct {
Firing bool
RestartCount int
RestartCountThreshold int
RestartWindow string
}
CrashloopInput is a crashloop alert rule's current evaluation state, nil if no crashloop rule is configured for this app.
type Input ¶
type Input struct {
ServiceName string
Attempt *AttemptInput
Conditions []ConditionInput
Crashloop *CrashloopInput
RecentLogLines []string
}
Input bundles every signal Diagnose considers. Every field is optional except ServiceName: a caller with fewer signals available (no telemetry configured, no crashloop rule set up) still gets a best-effort result, it just has less evidence to draw on.