mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:37:40 +00:00
feat: add http_server_return_code_counter metric to gateway (#8173)
# Which Problems Are Solved The metric `http_server_return_code_counter` doesn't record calls to the gRPC gateway. # How the Problems Are Solved The DefaultMetricsHandler that is used for the gPRC gateway doesn't record `http_server_return_code_counter`. Instead of the DefaultMetricsHandler, a custom metrics handler which includes `http_server_return_code_counter` is created for the gRPC gateway # Additional Changes The DefaultMetricsHandler function is removed, as it is no longer used. # Additional Context Reported by a customer --------- Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
parent
d9a9c013a6
commit
7573e0ea8f
@ -20,8 +20,10 @@ import (
|
||||
|
||||
client_middleware "github.com/zitadel/zitadel/internal/api/grpc/client/middleware"
|
||||
"github.com/zitadel/zitadel/internal/api/grpc/server/middleware"
|
||||
http_utils "github.com/zitadel/zitadel/internal/api/http"
|
||||
http_mw "github.com/zitadel/zitadel/internal/api/http/middleware"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/metrics"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -206,7 +208,10 @@ func addInterceptors(
|
||||
// For some non-obvious reason, the exhaustedCookieInterceptor sends the SetCookie header
|
||||
// only if it follows the http_mw.DefaultTelemetryHandler
|
||||
handler = exhaustedCookieInterceptor(handler, accessInterceptor)
|
||||
handler = http_mw.DefaultMetricsHandler(handler)
|
||||
handler = http_mw.MetricsHandler([]metrics.MetricType{
|
||||
metrics.MetricTypeTotalCount,
|
||||
metrics.MetricTypeStatusCode,
|
||||
}, http_utils.Probes...)(handler)
|
||||
return handler
|
||||
}
|
||||
|
||||
|
@ -3,15 +3,9 @@ package middleware
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
http_utils "github.com/zitadel/zitadel/internal/api/http"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/metrics"
|
||||
)
|
||||
|
||||
func DefaultMetricsHandler(handler http.Handler) http.Handler {
|
||||
metricTypes := []metrics.MetricType{metrics.MetricTypeTotalCount}
|
||||
return MetricsHandler(metricTypes, http_utils.Probes...)(handler)
|
||||
}
|
||||
|
||||
func MetricsHandler(metricTypes []metrics.MetricType, ignoredMethods ...string) func(http.Handler) http.Handler {
|
||||
return func(handler http.Handler) http.Handler {
|
||||
return metrics.NewMetricsHandler(handler, metricTypes, ignoredMethods...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user