check / check (push) Waiting to run
Replaces #559, which conflicted. Model: opus-5-5
22 lines
656 B
Go
22 lines
656 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
// HandleMetrics returns the Prometheus scrape handler for the
|
|
// registry built by metrics.NewRegistry, which the HTTP, delivery, Go
|
|
// runtime and process collectors register on. It is what
|
|
// promhttp.Handler builds for the global default registry, including
|
|
// the promhttp_metric_handler_* series that count scrapes, pointed at
|
|
// that registry instead.
|
|
func (s *Handlers) HandleMetrics() http.HandlerFunc {
|
|
reg := s.params.Registry
|
|
|
|
return promhttp.InstrumentMetricHandler(
|
|
reg, promhttp.HandlerFor(reg, promhttp.HandlerOpts{}),
|
|
).ServeHTTP
|
|
}
|