Documentation
¶
Overview ¶
Package alerts derives bounded alert inputs from validated operational snapshots without delivering notifications or storing time series.
Index ¶
Constants ¶
View Source
const ( // MaxWorkers bounds one evaluation pass. MaxWorkers = 10_000 // MaxCommands bounds one evaluation pass. MaxCommands = 1_000 )
View Source
const (
// MaxAlertBatch bounds one synchronous telemetry export call.
MaxAlertBatch = 12_000
)
Variables ¶
View Source
var ( // ErrInvalidInput reports malformed or unbounded operational input. ErrInvalidInput = errors.New("alerts: invalid input") // ErrInvalidPolicy reports an impossible alert threshold. ErrInvalidPolicy = errors.New("alerts: invalid policy") )
View Source
var ( // ErrInvalidTelemetryConfiguration reports an unusable metric provider. ErrInvalidTelemetryConfiguration = errors.New("alerts: invalid telemetry configuration") // ErrInvalidAlertBatch reports malformed, empty, canceled, or unbounded export input. ErrInvalidAlertBatch = errors.New("alerts: invalid alert batch") )
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
Kind Kind `json:"kind"`
TenantID string `json:"tenant_id"`
Resource string `json:"resource"`
Value float64 `json:"value"`
Threshold float64 `json:"threshold"`
ObservedAt time.Time `json:"observed_at"`
}
Alert is a backend-neutral threshold breach suitable for telemetry export.
type Input ¶
type Input struct {
TenantID string
ObservedAt time.Time
Queues queue.QueueStatusPage
Workers fleet.RegistrySnapshot
Failures queue.Measurement[uint64]
DeadLetters queue.Measurement[uint64]
Commands []controlplane.CommandResult
}
Input is one tenant's bounded current operational snapshot.
type Policy ¶
type Policy struct {
MaxQueueWait time.Duration
MaxFailures uint64
MaxDeadLetters uint64
StaleWorkers bool
CommandFailures bool
}
Policy enables alert categories and declares strict upper thresholds. Zero count or duration thresholds disable the corresponding category.
type TelemetryExporter ¶
type TelemetryExporter struct {
// contains filtered or unexported fields
}
TelemetryExporter emits fixed-cardinality alert counts through the caller's telemetry meter. Tenant and resource identities are intentionally absent.
func NewTelemetryExporter ¶
func NewTelemetryExporter(meter metric.Meter) (*TelemetryExporter, error)
NewTelemetryExporter creates the bounded platform alert metric bridge.
Click to show internal directories.
Click to hide internal directories.