Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // ID is a unique identifier for the alert. ID types.Hash256 `json:"id"` // Severity is the severity of the alert. Severity Severity `json:"severity"` // Message is a human-readable message describing the alert. Message string `json:"message"` // Data is a map of arbitrary data that can be used to provide // additional context to the alert. Data map[string]any `json:"data,omitempty"` Timestamp time.Time `json:"timestamp"` }
An Alert is a dismissible message that is displayed to the user.
type Alerter ¶
type Alerter interface { RegisterAlert(_ context.Context, a Alert) error DismissAlerts(_ context.Context, ids ...types.Hash256) error }
func WithOrigin ¶
WithOrigin wraps an Alerter in an originAlerter which always attaches the origin field to alerts.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager manages the host's alerts.
func (*Manager) DismissAlerts ¶
DismissAlerts implements the Alerter interface.
func (*Manager) RegisterAlert ¶
RegisterAlert implements the Alerter interface.
func (*Manager) RegisterWebhookBroadcaster ¶
func (m *Manager) RegisterWebhookBroadcaster(b webhooks.Broadcaster)
type Severity ¶
type Severity uint8
Severity indicates the severity of an alert.
const ( // SeverityInfo indicates that the alert is informational. SeverityInfo Severity = iota + 1 // SeverityWarning indicates that the alert is a warning. SeverityWarning // SeverityError indicates that the alert is an error. SeverityError // SeverityCritical indicates that the alert is critical. SeverityCritical )
func (Severity) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
Click to show internal directories.
Click to hide internal directories.