MCPcopy
hub / github.com/prometheus/client_golang / Handler

Function Handler

prometheus/promhttp/http.go:96–100  ·  view source on GitHub ↗

Handler returns an http.Handler for the prometheus.DefaultGatherer, using default HandlerOpts, i.e. it reports the first error as an HTTP error, it has no error logging, and it applies compression if requested by the client. The returned http.Handler is already instrumented using the InstrumentMetr

()

Source from the content-addressed store, hash-verified

94// Gatherer, different instrumentation, and non-default HandlerOpts), use the
95// HandlerFor function. See there for details.
96func Handler() http.Handler {
97 return InstrumentMetricHandler(
98 prometheus.DefaultRegisterer, HandlerFor(prometheus.DefaultGatherer, HandlerOpts{}),
99 )
100}
101
102// HandlerFor returns an uninstrumented http.Handler for the provided
103// Gatherer. The behavior of the Handler is defined by the provided

Callers 5

ExampleRegisterFunction · 0.92
ExampleWithExtraMethodsFunction · 0.85
ExampleWithLabelFromCtxFunction · 0.85

Calls 2

InstrumentMetricHandlerFunction · 0.85
HandlerForFunction · 0.85

Tested by 5

ExampleRegisterFunction · 0.74
ExampleWithExtraMethodsFunction · 0.68
ExampleWithLabelFromCtxFunction · 0.68