add prometheus instrumentation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
17
server/handler/metrics.go
Normal file
17
server/handler/metrics.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"vctp/internal/metrics"
|
||||
)
|
||||
|
||||
// Metrics exposes Prometheus metrics.
|
||||
// @Summary Prometheus metrics
|
||||
// @Description Exposes Prometheus metrics for vctp.
|
||||
// @Tags metrics
|
||||
// @Produce plain
|
||||
// @Success 200 "Prometheus metrics"
|
||||
// @Router /metrics [get]
|
||||
func (h *Handler) Metrics(w http.ResponseWriter, r *http.Request) {
|
||||
metrics.Handler().ServeHTTP(w, r)
|
||||
}
|
||||
@@ -65,6 +65,7 @@ func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver st
|
||||
mux.HandleFunc("/api/snapshots/aggregate", h.SnapshotAggregateForce)
|
||||
mux.HandleFunc("/api/snapshots/migrate", h.SnapshotMigrate)
|
||||
mux.HandleFunc("/api/snapshots/regenerate-hourly-reports", h.SnapshotRegenerateHourlyReports)
|
||||
mux.HandleFunc("/metrics", h.Metrics)
|
||||
|
||||
mux.HandleFunc("/snapshots/hourly", h.SnapshotHourlyList)
|
||||
mux.HandleFunc("/snapshots/daily", h.SnapshotDailyList)
|
||||
|
||||
Reference in New Issue
Block a user