feat(api): add internal alerts reporting endpoint with deduplication

Add ReportAlerts endpoint for Data Plane to report alerts to Control Plane
with fingerprint-based deduplication using a 5-minute cooldown period.

Changes:
- Add POST /internal/alerts/report endpoint with validation
- Add Fingerprint field to Alert model for deduplication
- Extend GetAPIKeyStatsSummary with optional time range filtering
  using since/until query parameters to query from log records
This commit is contained in:
zenfun
2025-12-31 14:18:09 +08:00
parent 71f7578c7b
commit bfba16bbd4
4 changed files with 208 additions and 1 deletions

View File

@@ -300,6 +300,7 @@ func main() {
{
internalGroup.POST("/stats/flush", internalHandler.FlushStats)
internalGroup.POST("/apikey-stats/flush", internalHandler.FlushAPIKeyStats)
internalGroup.POST("/alerts/report", internalHandler.ReportAlerts)
internalGroup.GET("/metrics", gin.WrapH(expvar.Handler()))
}