Example #1
0
func (m MetricsWithReset) Install(mux *apiserver.PathRecorderMux, c *restful.Container) {
	defaultMetricsHandler := prometheus.Handler().ServeHTTP
	mux.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) {
		if req.Method == "DELETE" {
			apiservermetrics.Reset()
			etcdmetrics.Reset()
			io.WriteString(w, "metrics reset\n")
			return
		}
		defaultMetricsHandler(w, req)
	})
}
Example #2
0
func (m DefaultMetrics) Install(mux *apiserver.PathRecorderMux, c *restful.Container) {
	mux.HandleFunc("/metrics", prometheus.Handler().ServeHTTP)
}
Example #3
0
func (r UIRedirect) Install(mux *apiserver.PathRecorderMux, c *restful.Container) {
	mux.HandleFunc("/ui/", func(w http.ResponseWriter, r *http.Request) {
		http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
	})
}