Draft: Add alert events tables + writer + query API
- Adds
alert_events
table to store raw alert events. - Adds
alerts
table to store an alert which is built by aggregating over events having same key of(TenantId, ProjectId, AggTimestamp, AlertType)
. - Adds materialized view
alerts_mv
which pulls events fromalert_events
and writes intoalerts
after aggregating over(TenantId, ProjectId, AggTimestamp, AlertType)
. - Aggregation window is minutely - as rate limiting windows are also per minute.
- Adds
AlertWriter
for writing alert events. It uses async insertion for simplicity instead of keeping an internal batch of events to flush. - Adds
AlertsQuerier
to allow querying alerts. It takesTenantId
and list ofProjectId
as parameters. - Adds
/v3/query/alerts
path on the query API that hooks onAlertsQuerier
. - Adds
alertWriter
on rate limiting handler to create and write alert events. (some pieces are WIP)
Related to #2813.
Edited by Arun Sori