Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertPayload ¶
type AlertPayload struct {
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations,omitempty"`
StartsAt time.Time `json:"startsAt"`
EndsAt *time.Time `json:"endsAt,omitempty"`
GeneratorURL string `json:"generatorURL,omitempty"`
}
AlertPayload represents the data sent to Alertmanager's /api/v2/alerts endpoint.
type AlertSender ¶
type AlertSender interface {
Send(ctx context.Context, alerts []AlertPayload) error
}
AlertSender abstracts the delivery mechanism for alert notifications.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client sends alerts to an Alertmanager instance.
func NewAlertmanagerClient ¶
func NewAlertmanagerClient(opts ClientOptions) (*Client, error)
NewAlertmanagerClient constructs a new Alertmanager client with sane defaults.
func (*Client) HealthCheck ¶
HealthCheck verifies connectivity to the Alertmanager instance. It makes a GET request to the /api/v2/status endpoint to check if Alertmanager is reachable.
type ClientOptions ¶
type ClientOptions struct {
BaseURL string
Timeout time.Duration
SkipTLSVerify bool
Logger *slog.Logger
AdditionalHeaders http.Header
MaxRetries int // Maximum number of retry attempts (default: 2)
RetryDelay time.Duration // Initial retry delay (default: 500ms)
}
ClientOptions configures the Alertmanager client.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates alert evaluation and dispatches notifications when thresholds are met.
func NewManager ¶
NewManager constructs a new alert manager instance.
func (*Manager) ManualResolve ¶
ManualResolve allows a user to manually resolve an active alert and notifies Alertmanager. This should be called when a user clicks "Resolve" in the UI.
type Options ¶
type Options struct {
Config config.AlertsConfig
DB *sqlite.DB
ClickHouse *clickhouse.Manager
Logger *slog.Logger
Sender AlertSender
}
Options encapsulates the dependencies required to run the alerting manager.