feat(metrics): integrate Prometheus metrics into router and main

- /metrics endpoint via promhttp.Handler
- actionHandler: request counter, bytes counter, latency histogram, errors
- Gauge updater: queues/messages count per tenant every 15s
- All metrics labeled by tenant and/or operation
This commit is contained in:
Naeel
2026-04-12 12:04:54 +03:00
parent 3d59b5500c
commit a4c910a099
2 changed files with 24 additions and 1 deletions
+4
View File
@@ -16,6 +16,7 @@ import (
"shared-sqs/app/billing"
"shared-sqs/app/conf"
"shared-sqs/app/gosqs"
"shared-sqs/app/metrics"
"shared-sqs/app/models"
"shared-sqs/app/persistence"
"shared-sqs/app/router"
@@ -136,6 +137,9 @@ func main() {
quit := make(chan bool)
go gosqs.PeriodicTasks(1*time.Second, quit)
// Metrics: gauge updater — пересчёт очередей/сообщений per tenant каждые 15 секунд
metrics.StartGaugeUpdater(15*time.Second, quit)
// HTTP сервер с таймаутами
srv := &http.Server{
Addr: "0.0.0.0:" + port,