alert

package
v0.13.21 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package alert provides ring buffer storage and delivery routing for process alerts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertEntry

type AlertEntry struct {
	PatternID   string    `json:"pattern_id"`
	Severity    string    `json:"severity"`
	Category    string    `json:"category"`
	Description string    `json:"description"`
	Line        string    `json:"line"`
	ScriptID    string    `json:"script_id"`
	ProjectPath string    `json:"project_path,omitempty"`
	Timestamp   time.Time `json:"timestamp"`
}

AlertEntry represents a single alert stored in the daemon.

type AlertStoreFilter

type AlertStoreFilter struct {
	Since       time.Time
	ProcessID   string
	Severity    string
	ProjectPath string
	Limit       int
}

AlertStoreFilter is the daemon-side filter for querying alerts.

type ProcessAlertStore

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

ProcessAlertStore is a ring buffer store for alert entries. head points to the oldest entry; new entries are written at (head+len) % maxSize.

func NewProcessAlertStore

func NewProcessAlertStore(maxSize int) *ProcessAlertStore

NewProcessAlertStore creates a new alert store with the given capacity.

func (*ProcessAlertStore) Add

func (s *ProcessAlertStore) Add(entry *AlertEntry)

Add inserts an alert entry into the ring buffer.

func (*ProcessAlertStore) Clear

func (s *ProcessAlertStore) Clear()

Clear resets the buffer.

func (*ProcessAlertStore) ClearForProcess

func (s *ProcessAlertStore) ClearForProcess(processID string) int

ClearForProcess removes all alert entries for the given process ID. Returns the number of entries removed.

func (*ProcessAlertStore) Len

func (s *ProcessAlertStore) Len() int

Len returns the current number of entries.

func (*ProcessAlertStore) Query

func (s *ProcessAlertStore) Query(filter AlertStoreFilter) []*AlertEntry

Query returns entries matching the filter, oldest-to-newest.

Jump to

Keyboard shortcuts

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