mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add realtime stats endpoints for masters
Introduce StatsService integration to admin and master handlers, exposing realtime metrics (requests, tokens, QPS, rate limit status) via new endpoints: - GET /admin/masters/:id/realtime - GET /v1/realtime Also embed realtime stats in the existing GET /admin/masters/:id response and change GlobalQPS default to 0 with validation to reject negative values.
This commit is contained in:
@@ -33,8 +33,9 @@ func newTestAdminHandler(t *testing.T) (*AdminHandler, *gorm.DB, *miniredis.Mini
|
||||
mr := miniredis.RunT(t)
|
||||
rdb := redis.NewClient(&redis.Options{Addr: mr.Addr()})
|
||||
sync := service.NewSyncService(rdb)
|
||||
stats := service.NewStatsService(rdb)
|
||||
masterService := service.NewMasterService(db)
|
||||
return NewAdminHandler(db, db, masterService, sync, nil), db, mr
|
||||
return NewAdminHandler(db, db, masterService, sync, stats, nil), db, mr
|
||||
}
|
||||
|
||||
func TestAdmin_BatchMasters_Status(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user