mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
feat: provide metrics endpoint (#3902)
* feat: provide metrics endpoint * config * enable otel metrics by default Co-authored-by: Florian Forster <florian@caos.ch>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
http_util "github.com/zitadel/zitadel/internal/api/http"
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/metrics"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/tracing"
|
||||
)
|
||||
|
||||
@@ -132,6 +133,7 @@ func (a *API) healthHandler() http.Handler {
|
||||
handler.HandleFunc("/healthz", handleHealth)
|
||||
handler.HandleFunc("/ready", handleReadiness(checks))
|
||||
handler.HandleFunc("/validate", handleValidate(checks))
|
||||
handler.Handle("/metrics", metricsExporter())
|
||||
|
||||
return handler
|
||||
}
|
||||
@@ -175,3 +177,11 @@ func validate(ctx context.Context, validations []ValidationFunction) []error {
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
func metricsExporter() http.Handler {
|
||||
exporter := metrics.GetExporter()
|
||||
if exporter == nil {
|
||||
return http.NotFoundHandler()
|
||||
}
|
||||
return exporter
|
||||
}
|
||||
|
Reference in New Issue
Block a user