diagnosis

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleIDMissingAlertEmbedding  diagnosismodel.RuleID = "missing_alert_embedding"
	RuleIDMissingTicketEmbedding diagnosismodel.RuleID = "missing_ticket_embedding"
)
View Source
const RuleIDBindingMismatch diagnosismodel.RuleID = "binding_mismatch"
View Source
const RuleIDLegacyAlertStatus diagnosismodel.RuleID = "legacy_alert_status"
View Source
const RuleIDLegacyKnowledge diagnosismodel.RuleID = "legacy_knowledge"
View Source
const RuleIDLegacyTicketStatus diagnosismodel.RuleID = "legacy_ticket_status"
View Source
const RuleIDMissingAlertMetadata diagnosismodel.RuleID = "missing_alert_metadata"
View Source
const RuleIDOrphanedTagID diagnosismodel.RuleID = "orphaned_tag_id"

Variables

This section is empty.

Functions

This section is empty.

Types

type BindingMismatchRule

type BindingMismatchRule struct{}

BindingMismatchRule detects bidirectional reference inconsistencies between alerts and tickets. Specifically:

  • Alert.TicketID points to a ticket that does not exist
  • Alert.TicketID points to a ticket that does not list the alert in its AlertIDs

func NewBindingMismatchRule

func NewBindingMismatchRule() *BindingMismatchRule

func (*BindingMismatchRule) Check

func (*BindingMismatchRule) Fix

func (*BindingMismatchRule) ID

type LegacyAlertStatusRule

type LegacyAlertStatusRule struct{}

LegacyAlertStatusRule detects alerts whose Status is "" or "unbound" (pre-v0.10.0 data).

func NewLegacyAlertStatusRule

func NewLegacyAlertStatusRule() *LegacyAlertStatusRule

func (*LegacyAlertStatusRule) Check

func (*LegacyAlertStatusRule) Fix

func (*LegacyAlertStatusRule) ID

type LegacyKnowledgeRule added in v0.14.0

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

LegacyKnowledgeRule detects old-format knowledge entries that need migration to the new format.

func NewLegacyKnowledgeRule added in v0.14.0

func NewLegacyKnowledgeRule(knowledgeSvc *svcknowledge.Service) *LegacyKnowledgeRule

NewLegacyKnowledgeRule creates a new LegacyKnowledgeRule.

func (*LegacyKnowledgeRule) Check added in v0.14.0

func (*LegacyKnowledgeRule) Fix added in v0.14.0

func (*LegacyKnowledgeRule) ID added in v0.14.0

type LegacyTicketStatusRule

type LegacyTicketStatusRule struct{}

LegacyTicketStatusRule detects tickets whose Status is "pending" (pre-deprecation data). NormalizeLegacyStatus() handles this at read-time, but the DB record remains dirty.

func NewLegacyTicketStatusRule

func NewLegacyTicketStatusRule() *LegacyTicketStatusRule

func (*LegacyTicketStatusRule) Check

func (*LegacyTicketStatusRule) Fix

func (*LegacyTicketStatusRule) ID

type MissingAlertEmbeddingRule

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

MissingAlertEmbeddingRule detects alerts with empty embeddings.

func NewMissingAlertEmbeddingRule

func NewMissingAlertEmbeddingRule(llmClient gollem.LLMClient) *MissingAlertEmbeddingRule

func (*MissingAlertEmbeddingRule) Check

func (*MissingAlertEmbeddingRule) Fix

func (*MissingAlertEmbeddingRule) ID

type MissingAlertMetadataRule

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

MissingAlertMetadataRule detects alerts that still have default title or description set by the ingest pipeline when LLM generation failed.

func NewMissingAlertMetadataRule

func NewMissingAlertMetadataRule(llmClient gollem.LLMClient) *MissingAlertMetadataRule

func (*MissingAlertMetadataRule) Check

func (*MissingAlertMetadataRule) Fix

func (*MissingAlertMetadataRule) ID

type MissingTicketEmbeddingRule

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

MissingTicketEmbeddingRule detects tickets with empty embeddings.

func NewMissingTicketEmbeddingRule

func NewMissingTicketEmbeddingRule(llmClient gollem.LLMClient) *MissingTicketEmbeddingRule

func (*MissingTicketEmbeddingRule) Check

func (*MissingTicketEmbeddingRule) Fix

func (*MissingTicketEmbeddingRule) ID

type OrphanedTagIDRule

type OrphanedTagIDRule struct{}

OrphanedTagIDRule detects alerts and tickets that reference tag IDs that no longer exist in the DB.

func NewOrphanedTagIDRule

func NewOrphanedTagIDRule() *OrphanedTagIDRule

func (*OrphanedTagIDRule) Check

func (*OrphanedTagIDRule) Fix

func (*OrphanedTagIDRule) ID

type Rule

type Rule interface {
	// ID returns the unique identifier for this rule.
	ID() diagnosismodel.RuleID
	// Check detects issues in the repository and returns them.
	Check(ctx context.Context, repo interfaces.Repository) ([]diagnosismodel.Issue, error)
	// Fix repairs a single issue detected by this rule.
	Fix(ctx context.Context, repo interfaces.Repository, issue diagnosismodel.Issue) error
}

Rule represents a single diagnosis rule. The RuleID returned by ID() is stored as Issue.RuleID, establishing a 1:1 mapping.

Jump to

Keyboard shortcuts

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