feat(metrics): wire instrumentation through queue, handlers, middleware

This commit is contained in:
2026-05-22 13:17:09 +02:00
parent ef9c0f1313
commit 3abd1bf9af
8 changed files with 94 additions and 34 deletions
+6 -5
View File
@@ -53,15 +53,16 @@ func run() error {
disc := discovery.New(dockerCli, cfg.StacksRoot, cfg.OptInLabel)
exec := updater.NewComposeExecutor()
queue := updater.NewQueue(exec)
queue.Start(context.Background())
defer queue.Stop()
reg := prometheus.NewRegistry()
m := metrics.New(reg)
m.BuildInfo.WithLabelValues(version, commit).Set(1)
handlers := api.NewHandlers(disc, &submitterAdapter{queue: queue, timeout: cfg.UpdateTimeout}, dockerCli, version, commit, buildTime)
queue := updater.NewQueue(exec, m)
queue.Start(context.Background())
defer queue.Stop()
handlers := api.NewHandlers(disc, &submitterAdapter{queue: queue, timeout: cfg.UpdateTimeout}, dockerCli, version, commit, buildTime, m)
mux := http.NewServeMux()
mux.HandleFunc("POST /update", handlers.Update)
@@ -70,7 +71,7 @@ func run() error {
mux.Handle("GET /metrics", metrics.Handler(reg))
authed := api.Auth(cfg.APIKey)
handler := api.RequestID(api.RequestLogger(logger)(routeAuth(mux, authed)))
handler := api.RequestID(api.RequestLogger(logger, m)(routeAuth(mux, authed)))
srv := &http.Server{
Addr: ":" + cfg.Port,