Skip to content

Add alert resource contract (metric alerts phase 1) - #133

Open
acoshift wants to merge 1 commit into
mainfrom
feat/metric-alerts
Open

Add alert resource contract (metric alerts phase 1)#133
acoshift wants to merge 1 commit into
mainfrom
feat/metric-alerts

Conversation

@acoshift

Copy link
Copy Markdown
Member

Summary

Contract for the new project-scoped alert resource — metric alert rules on platform metrics (SPEC-metric-alerts.md, Phase 1). A rule watches one metric of one deployment (cpu/memory as % of limit, requests/egress per-minute) with op + threshold + forMinutes, evaluated server-side by an apiserver cron (separate PR). Delivery reuses notification channels entirely.

  • Alert interface: create/update/get/list/delete/events (+ client, wired into Interface)
  • Types: AlertTarget, AlertCondition, AlertItem (incl. read-only evaluator state ok|firing|nodata), events history
  • Validation: metric vocabulary, op default >=, percent-threshold cap, forMinutes 1–60, renotify 0 or 10–1440
  • Permissions: alert.* + 5 actions; .get/.list public-bindable via existing classifiers (test-asserted)
  • Notification catalog: alert.create/update/delete (audited config changes) + alert.trigger/resolve (evaluator transitions, notify-only)
  • Constraints: max 20 rules/project, events limit 50/100
  • Errors: ErrAlertNotFound, ErrAlertAlreadyExists, ErrMaximumAlertRulesReached

Testing

go build ./... && go vet ./... && go test ./... green; table-driven Valid() tests, catalog membership, permission classification.

Metric alert rules on platform metrics: when a deployment metric (cpu,
memory, requests, egress) crosses a threshold for N minutes, the platform
notifies through existing notification channels via alert.trigger /
alert.resolve events. This adds the contract only; evaluation lives in
apiserver (alert-tick cron).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant