events

package
v0.4.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorrelationKey

func CorrelationKey(event Event) string

Types

type Correlator

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

func NewCorrelator

func NewCorrelator(updateInterval time.Duration) *Correlator

func (*Correlator) Ingest

func (c *Correlator) Ingest(event Event) IngestResult

func (*Correlator) List

func (c *Correlator) List() []Incident

func (*Correlator) Restore

func (c *Correlator) Restore(incidents []Incident)

type Event

type Event struct {
	ID             string         `json:"id"`
	Source         string         `json:"source"`
	Type           string         `json:"type"`
	Severity       Severity       `json:"severity"`
	Title          string         `json:"title"`
	Message        string         `json:"message"`
	Scope          Scope          `json:"scope"`
	CorrelationKey string         `json:"correlation_key,omitempty"`
	OccurredAt     time.Time      `json:"occurred_at"`
	Attributes     map[string]any `json:"attributes,omitempty"`
	TargetIDs      []string       `json:"target_ids,omitempty"`
	Resolved       bool           `json:"resolved,omitempty"`
}

type Incident

type Incident struct {
	ID             string         `json:"id"`
	CorrelationKey string         `json:"correlation_key"`
	Status         IncidentStatus `json:"status"`
	Severity       Severity       `json:"severity"`
	Title          string         `json:"title"`
	EventCount     int            `json:"event_count"`
	FirstEventAt   time.Time      `json:"first_event_at"`
	LastEventAt    time.Time      `json:"last_event_at"`
	LastEvent      Event          `json:"last_event"`
}

type IncidentStatus

type IncidentStatus string
const (
	IncidentOpen     IncidentStatus = "open"
	IncidentResolved IncidentStatus = "resolved"
)

type IngestResult

type IngestResult struct {
	Incident     Incident           `json:"incident"`
	Notification NotificationAction `json:"notification"`
}

type NotificationAction

type NotificationAction string
const (
	NotificationNone     NotificationAction = "none"
	NotificationOpened   NotificationAction = "opened"
	NotificationUpdated  NotificationAction = "updated"
	NotificationResolved NotificationAction = "resolved"
)

type Scope

type Scope struct {
	Node       string `json:"node,omitempty"`
	Deployment string `json:"deployment,omitempty"`
	Container  string `json:"container,omitempty"`
}

type Severity

type Severity string
const (
	SeverityInfo     Severity = "info"
	SeverityWarning  Severity = "warning"
	SeverityCritical Severity = "critical"
)

type Store

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

func NewStore

func NewStore(basePath string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) ListIncidents

func (s *Store) ListIncidents() ([]Incident, error)

func (*Store) Record

func (s *Store) Record(event Event, incident Incident) error

Jump to

Keyboard shortcuts

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