Draft: Add alert events tables + writer + query API
- Adds
alert_eventstable to store raw alert events. - Adds
alertstable to store an alert which is built by aggregating over events having same key of(TenantId, ProjectId, AggTimestamp, AlertType). - Adds materialized view
alerts_mvwhich pulls events fromalert_eventsand writes intoalertsafter aggregating over(TenantId, ProjectId, AggTimestamp, AlertType). - Aggregation window is minutely - as rate limiting windows are also per minute.
- Adds
AlertWriterfor writing alert events. It uses async insertion for simplicity instead of keeping an internal batch of events to flush. - Adds
AlertsQuerierto allow querying alerts. It takesTenantIdand list ofProjectIdas parameters. - Adds
/v3/query/alertspath on the query API that hooks onAlertsQuerier. - Adds
alertWriteron rate limiting handler to create and write alert events. (some pieces are WIP)
Related to #2813.
Edited by Arun Sori