mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 22:25:03 +00:00
vendor: revendor metrics-server, custom-metrics-apiserver
This commit is contained in:
parent
752ce84723
commit
523aa52367
1010 changed files with 91458 additions and 29107 deletions
14
vendor/k8s.io/component-base/metrics/http.go
generated
vendored
14
vendor/k8s.io/component-base/metrics/http.go
generated
vendored
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
|
@ -61,3 +62,16 @@ func (ho *HandlerOpts) toPromhttpHandlerOpts() promhttp.HandlerOpts {
|
|||
func HandlerFor(reg Gatherer, opts HandlerOpts) http.Handler {
|
||||
return promhttp.HandlerFor(reg, opts.toPromhttpHandlerOpts())
|
||||
}
|
||||
|
||||
// HandlerWithReset return an http.Handler with Reset
|
||||
func HandlerWithReset(reg KubeRegistry, opts HandlerOpts) http.Handler {
|
||||
defaultHandler := promhttp.HandlerFor(reg, opts.toPromhttpHandlerOpts())
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodDelete {
|
||||
reg.Reset()
|
||||
io.WriteString(w, "metrics reset\n")
|
||||
return
|
||||
}
|
||||
defaultHandler.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue