Merge branch 'master' into instrument-metrics

This commit is contained in:
cerberus20 2024-03-27 16:19:31 +05:30 committed by GitHub
commit 28cd9fdb09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,6 +44,7 @@ var (
Buckets: prometheus.DefBuckets,
},
[]string{"path", "server"},
)
// define a counter for API errors for various ErrorTypes
@ -55,12 +56,14 @@ var (
Help: "Total number of API errors",
},
[]string{"error_code", "path", "server"},
)
)
func MetricsHandler() (http.HandlerFunc, error) {
registry := metrics.NewKubeRegistry()
errRegisterQueryLatency := registry.Register(queryLatency)
if errRegisterQueryLatency != nil {
return nil, errRegisterQueryLatency
@ -70,7 +73,7 @@ func MetricsHandler() (http.HandlerFunc, error) {
if errRegisterAPIErrorCount != nil {
return nil, errRegisterAPIErrorCount
}
apimetrics.Register()
return func(w http.ResponseWriter, req *http.Request) {
legacyregistry.Handler().ServeHTTP(w, req)