checker: add RuleName field to CheckState instead of overloading Code

Rules can now set Code freely without the server clobbering it; the
originating rule is reported separately via RuleName.
This commit is contained in:
nemunaire 2026-04-23 14:50:00 +07:00
commit c9ee6655ca
4 changed files with 57 additions and 13 deletions

View file

@ -187,11 +187,12 @@ func (s Status) String() string {
// (a hostname, a record key, a serial, …). Leave Subject empty for rules
// that produce a single, global result.
type CheckState struct {
Status Status `json:"status"`
Message string `json:"message"`
Code string `json:"code,omitempty"`
Subject string `json:"subject,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
Status Status `json:"status"`
Message string `json:"message"`
RuleName string `json:"rule,omitempty"`
Code string `json:"code,omitempty"`
Subject string `json:"subject,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
}
// CheckMetric represents a single metric produced by a check.