Documentation
¶
Overview ¶
Package notification owns persisted notification destinations.
Index ¶
- Variables
- type Channel
- type DeliverySettings
- type Publisher
- type Silence
- type SilenceClient
- func (client *SilenceClient) CancelAgentSilence(ctx context.Context, agentUID, id string) error
- func (client *SilenceClient) CancelMonitorSilence(ctx context.Context, monitorID, id string) error
- func (client *SilenceClient) CreateAgentSilence(ctx context.Context, agentUID string, startsAt, endsAt time.Time, ...) (string, error)
- func (client *SilenceClient) CreateMonitorSilence(ctx context.Context, monitorID string, startsAt, endsAt time.Time, ...) (string, error)
- func (client *SilenceClient) ListAgentSilences(ctx context.Context, agentUID string) ([]Silence, error)
- func (client *SilenceClient) ListMonitorSilences(ctx context.Context, monitorID string) ([]Silence, error)
- func (client *SilenceClient) ListSilences(ctx context.Context) ([]Silence, error)
- type Store
- func (store *Store) AlertmanagerConfig(ctx context.Context) (content []byte, returnErr error)
- func (store *Store) Create(ctx context.Context, value Channel) (Channel, error)
- func (store *Store) Delete(ctx context.Context, id string) error
- func (store *Store) Get(ctx context.Context, id string) (Channel, error)
- func (store *Store) List(ctx context.Context) (values []Channel, returnErr error)
- func (store *Store) Update(ctx context.Context, value Channel) (Channel, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInUse = errors.New("notification channel is assigned to an alert rule")
ErrInUse means a rule still references this destination.
var ErrInvalidChannel = errors.New("invalid notification channel")
ErrInvalidChannel means the name, channel type or configuration is unsupported.
var ErrNotFound = errors.New("notification channel not found")
ErrNotFound means the requested notification channel does not exist.
var ErrSilenceNotFound = errors.New("notification silence not found")
ErrSilenceNotFound means the silence is absent from this owner's native collection.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
ID string
Name string
Type string
Config json.RawMessage
Delivery *DeliverySettings
}
Channel describes a named destination with type-specific configuration. Saving a channel does not enable delivery.
type DeliverySettings ¶
type DeliverySettings struct {
GroupBy string `json:"group_by"`
GroupWaitSeconds int `json:"group_wait_seconds"`
GroupIntervalSeconds int `json:"group_interval_seconds"`
RepeatIntervalSeconds int `json:"repeat_interval_seconds"`
}
DeliverySettings controls native notification grouping and timing for one channel. Durations are whole seconds; Alertmanager owns the corresponding timers.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher reconciles stored channels with the owned Alertmanager configuration. The application owns its lifetime and calls Sync serially.
func NewPublisher ¶
NewPublisher binds publication to one managed engine's HTTP origin.
type Silence ¶
type Silence struct {
ID string `json:"id"`
MonitorID string `json:"monitor_id,omitempty"`
AgentInstanceUID string `json:"agent_instance_uid,omitempty"`
StartsAt time.Time `json:"starts_at"`
EndsAt time.Time `json:"ends_at"`
CreatedBy string `json:"created_by"`
Comment string `json:"comment"`
State string `json:"state"`
}
Silence is an Agent- or Monitor-scoped view of a native Alertmanager silence. State and timestamps are read from the engine, not evaluated by Arveld.
type SilenceClient ¶
type SilenceClient struct {
// contains filtered or unexported fields
}
SilenceClient sends notification suspensions to the owned Alertmanager. Alertmanager owns their identity, storage and expiration.
func NewSilenceClient ¶
func NewSilenceClient(baseURL string) (*SilenceClient, error)
NewSilenceClient binds silence operations to one managed engine's HTTP origin.
func (*SilenceClient) CancelAgentSilence ¶
func (client *SilenceClient) CancelAgentSilence(ctx context.Context, agentUID, id string) error
CancelAgentSilence expires a silence only after verifying its whole-Agent scope. Alertmanager treats repeated expiration as success while the entry is retained.
func (*SilenceClient) CancelMonitorSilence ¶
func (client *SilenceClient) CancelMonitorSilence(ctx context.Context, monitorID, id string) error
CancelMonitorSilence expires a silence only after verifying its Monitor scope. Alertmanager treats repeated expiration as success while the entry is retained.
func (*SilenceClient) CreateAgentSilence ¶
func (client *SilenceClient) CreateAgentSilence(ctx context.Context, agentUID string, startsAt, endsAt time.Time, comment string) (string, error)
CreateAgentSilence silences an Agent and its Monitors for a validated time window. agentUID must use the canonical UUID representation carried by native alerts.
func (*SilenceClient) CreateMonitorSilence ¶
func (client *SilenceClient) CreateMonitorSilence(ctx context.Context, monitorID string, startsAt, endsAt time.Time, comment string) (string, error)
CreateMonitorSilence creates an exact Monitor silence for a validated time window. A failed request is not retried: the engine may already have accepted the write.
func (*SilenceClient) ListAgentSilences ¶
func (client *SilenceClient) ListAgentSilences(ctx context.Context, agentUID string) ([]Silence, error)
ListAgentSilences reads exact, whole-Agent silences, including expired entries retained by Alertmanager. Monitor-owned silences are not included.
func (*SilenceClient) ListMonitorSilences ¶
func (client *SilenceClient) ListMonitorSilences(ctx context.Context, monitorID string) ([]Silence, error)
ListMonitorSilences reads exact, whole-Monitor silences in native order. An empty monitorID reads silences across all Monitors, including deleted ones. Expired entries remain visible only while retained by Alertmanager.
func (*SilenceClient) ListSilences ¶
func (client *SilenceClient) ListSilences(ctx context.Context) ([]Silence, error)
ListSilences reads whole-Agent and whole-Monitor silences in native order, including retained entries whose owners no longer exist.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists notification destinations in the controller database.
func (*Store) AlertmanagerConfig ¶
AlertmanagerConfig renders destinations and exact rule-to-channel routes. Alerts without an explicit assignment use the empty default receiver.