mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
17 lines
569 B
Go
17 lines
569 B
Go
|
// Package metrics contains HTTP handler for application metrics (prometheus format) generation.
|
||
|
package metrics
|
||
|
|
||
|
import (
|
||
|
"github.com/prometheus/client_golang/prometheus"
|
||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||
|
"github.com/valyala/fasthttp"
|
||
|
"github.com/valyala/fasthttp/fasthttpadaptor"
|
||
|
)
|
||
|
|
||
|
// NewHandler creates metrics handler.
|
||
|
func NewHandler(registry prometheus.Gatherer) fasthttp.RequestHandler {
|
||
|
return fasthttpadaptor.NewFastHTTPHandler(
|
||
|
promhttp.HandlerFor(registry, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}),
|
||
|
)
|
||
|
}
|