port over apiserver metric handler to use the instrumentation library
Change-Id: Ifabb726120c1c4f90ff3e4d71fdbba468fe74e8a Kubernetes-commit: 6b994af680b292ac5a9be7198df8ca18c27241df
This commit is contained in:
parent
b85e64fe4d
commit
9eea426ca7
|
@ -17,9 +17,6 @@ limitations under the License.
|
|||
package routes
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
apimetrics "k8s.io/apiserver/pkg/endpoints/metrics"
|
||||
"k8s.io/apiserver/pkg/server/mux"
|
||||
etcd3metrics "k8s.io/apiserver/pkg/storage/etcd3/metrics"
|
||||
|
@ -43,18 +40,7 @@ type MetricsWithReset struct{}
|
|||
// Install adds the MetricsWithReset handler
|
||||
func (m MetricsWithReset) Install(c *mux.PathRecorderMux) {
|
||||
register()
|
||||
defaultMetricsHandler := legacyregistry.Handler().ServeHTTP
|
||||
c.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) {
|
||||
if req.Method == "DELETE" {
|
||||
apimetrics.Reset()
|
||||
etcd3metrics.Reset()
|
||||
flowcontrolmetrics.Reset()
|
||||
|
||||
io.WriteString(w, "metrics reset\n")
|
||||
return
|
||||
}
|
||||
defaultMetricsHandler(w, req)
|
||||
})
|
||||
c.Handle("/metrics", legacyregistry.HandlerWithReset())
|
||||
}
|
||||
|
||||
// register apiserver and etcd metrics
|
||||
|
|
Loading…
Reference in New Issue