MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / ResolveSeverity

Function ResolveSeverity

server-source-code/internal/alerts/common.go:51–57  ·  view source on GitHub ↗

ResolveSeverity looks up the default_severity for an event type from alert_config, falling back to the provided default if not found or not enabled.

(ctx context.Context, db *database.DB, eventType, fallback string)

Source from the content-addressed store, hash-verified

49// ResolveSeverity looks up the default_severity for an event type from alert_config,
50// falling back to the provided default if not found or not enabled.
51func ResolveSeverity(ctx context.Context, db *database.DB, eventType, fallback string) string {
52 cfg, err := GetConfigForType(ctx, db, eventType)
53 if err != nil || cfg == nil || !cfg.IsEnabled {
54 return fallback
55 }
56 return DefaultSeverity(cfg.DefaultSeverity, fallback)
57}

Callers 3

ProcessHostStatusMonitorFunction · 0.85
OnConnectFunction · 0.85

Calls 2

GetConfigForTypeFunction · 0.85
DefaultSeverityFunction · 0.85

Tested by

no test coverage detected