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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user