Functions
func AnalyzeResult(result model.JobResult, log string, readErr error) model.JobResult
AnalyzeResult saves the default rule-based analysis on a failed result.
A successful result, or one that already carries an analysis such as a
result carried from an earlier run, is returned unchanged. A non-nil readErr
means the job output could not be read, so the analysis is unavailable.
func Diagnose(errorText, log string, rules []Rule) []model.RuleDiagnosis
Diagnose returns one diagnosis per matching rule, citing the rule's latest
matching line. Diagnoses are ordered from the latest evidence to the
earliest, because the error that ended a job is normally reported last and
earlier matches may be warnings the job recovered from. The scheduler error
is recorded after the job output, so it ranks as the latest evidence.
func DiagnoseDefault(job Job) []model.RuleDiagnosis
func DiagnoseExitCode(exitCode int, rules []Rule) []model.RuleDiagnosis
DiagnoseExitCode returns the diagnosis of a job whose error and log nothing
recognized but whose exit code has a conventional meaning: 127 for a missing
command, and 128+N for a job that passed on a child's death by signal N.
func LastOutputLine(log string) string
LastOutputLine returns the last nonblank line of log, without ANSI escapes,
surrounding whitespace, or text a carriage return overwrote. It skips the
lines TailLog and the stream headers add, which are not output.
func MatchesAny(value string, patterns []*regexp.Regexp) bool
func MatchesResultSelectors(selectors []string, result model.JobResult, log string) bool
MatchesResultSelectors reports whether a failed result, diagnosed with the
current rules from its error and log, matches any selector. Saved diagnoses
are ignored, and a success never matches.
func MatchesRuleSelectors(selectors []string, job Job) bool
MatchesRuleSelectors recomputes diagnosis using the current default rules
and reports whether any diagnosis matches a requested selector.
func Outdated(result model.JobResult) bool
Outdated reports whether a saved matched or no-match analysis was produced
by rules other than the current ones. An unavailable analysis never ran the
rules, and an unanalyzed result has nothing to refresh.
func ResolveRuleSelectors(values []string) error
ResolveRuleSelectors validates diagnosis filter values. A slug ID is
preferred; otherwise the display name is matched case-insensitively as a
substring.
func RuleID(rule Rule) string
RuleID returns a stable selector ID derived from the public rule name;
see model.FailureCauseID.
func RulesVersion() string
RulesVersion identifies the default rules and matcher. It is derived from
the rule definitions, so any rule change produces a new version.
func TailLog(value string, limit int) string