mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Merge branch 'master' into instrument-metrics
This commit is contained in:
commit
28cd9fdb09
1 changed files with 4 additions and 1 deletions
|
|
@ -44,6 +44,7 @@ var (
|
||||||
Buckets: prometheus.DefBuckets,
|
Buckets: prometheus.DefBuckets,
|
||||||
},
|
},
|
||||||
[]string{"path", "server"},
|
[]string{"path", "server"},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// define a counter for API errors for various ErrorTypes
|
// define a counter for API errors for various ErrorTypes
|
||||||
|
|
@ -55,12 +56,14 @@ var (
|
||||||
Help: "Total number of API errors",
|
Help: "Total number of API errors",
|
||||||
},
|
},
|
||||||
[]string{"error_code", "path", "server"},
|
[]string{"error_code", "path", "server"},
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func MetricsHandler() (http.HandlerFunc, error) {
|
func MetricsHandler() (http.HandlerFunc, error) {
|
||||||
registry := metrics.NewKubeRegistry()
|
registry := metrics.NewKubeRegistry()
|
||||||
|
|
||||||
|
|
||||||
errRegisterQueryLatency := registry.Register(queryLatency)
|
errRegisterQueryLatency := registry.Register(queryLatency)
|
||||||
if errRegisterQueryLatency != nil {
|
if errRegisterQueryLatency != nil {
|
||||||
return nil, errRegisterQueryLatency
|
return nil, errRegisterQueryLatency
|
||||||
|
|
@ -70,7 +73,7 @@ func MetricsHandler() (http.HandlerFunc, error) {
|
||||||
if errRegisterAPIErrorCount != nil {
|
if errRegisterAPIErrorCount != nil {
|
||||||
return nil, errRegisterAPIErrorCount
|
return nil, errRegisterAPIErrorCount
|
||||||
}
|
}
|
||||||
|
|
||||||
apimetrics.Register()
|
apimetrics.Register()
|
||||||
return func(w http.ResponseWriter, req *http.Request) {
|
return func(w http.ResponseWriter, req *http.Request) {
|
||||||
legacyregistry.Handler().ServeHTTP(w, req)
|
legacyregistry.Handler().ServeHTTP(w, req)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue