alertentry

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendSQLite     = "sqlite"
	BackendPostgreSQL = "postgresql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertEntry

type AlertEntry struct {
	ID                   string
	Timestamp            string
	AlertRuleName        string
	AlertRuleCRName      string
	AlertRuleCRNamespace string
	AlertValue           string
	NamespaceName        string
	ComponentName        string
	EnvironmentName      string
	ProjectName          string
	ComponentID          string
	EnvironmentID        string
	ProjectID            string
	IncidentEnabled      bool
	Severity             string
	Description          string
	NotificationChannels string // JSON array of channel names
	SourceType           string
	SourceQuery          string
	SourceMetric         string
	ConditionOperator    string
	ConditionThreshold   float64
	ConditionWindow      string
	ConditionInterval    string
}

AlertEntry represents one fired alert event persisted by the observer.

type AlertEntryStore

type AlertEntryStore interface {
	Initialize(ctx context.Context) error
	WriteAlertEntry(ctx context.Context, entry *AlertEntry) (id string, err error)
	QueryAlertEntries(ctx context.Context, params QueryParams) ([]AlertEntry, int, error)
	HasRecentAlert(ctx context.Context, alertRuleCRName, alertRuleCRNamespace, componentUID string, since time.Time) (bool, error)
	Close() error
}

AlertEntryStore defines lifecycle and write operations for alert entry persistence.

func New

func New(backend, dsn string, logger *slog.Logger) (AlertEntryStore, error)

New creates a concrete alert entry store for the configured backend.

type QueryParams

type QueryParams struct {
	StartTime     string
	EndTime       string
	NamespaceName string
	ProjectID     string
	ComponentID   string
	EnvironmentID string
	Limit         int
	SortOrder     string
}

QueryParams contains filters and pagination for querying alert entries.

Jump to

Keyboard shortcuts

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