feat(api): add admin traffic chart statistics endpoint

Add new endpoint GET /admin/logs/stats/traffic-chart to provide
aggregated traffic metrics grouped by time and model. Features include:
- Time granularity selection (hour/minute)
- Top-N model breakdown with "other" aggregation
- Metrics for request counts and token usage

Includes generated Swagger documentation.
This commit is contained in:
zenfun
2026-01-02 21:24:56 +08:00
parent bae3d9bd5b
commit 9d082ff375
5 changed files with 555 additions and 0 deletions

View File

@@ -368,6 +368,7 @@ func main() {
adminGroup.GET("/logs", handler.ListLogs)
adminGroup.DELETE("/logs", handler.DeleteLogs)
adminGroup.GET("/logs/stats", handler.LogStats)
adminGroup.GET("/logs/stats/traffic-chart", handler.GetTrafficChart)
adminGroup.GET("/logs/webhook", handler.GetLogWebhookConfig)
adminGroup.PUT("/logs/webhook", handler.UpdateLogWebhookConfig)
adminGroup.GET("/stats", adminHandler.GetAdminStats)