forked from TrueCloudLab/neoneo-go
0085831ec5
Since we have some perf issues from time to time it is good to have pprof debugger. Disabled by default.
20 lines
468 B
Go
20 lines
468 B
Go
package metrics
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
// PrometheusService https://prometheus.io/docs/guides/go-application.
|
|
type PrometheusService Service
|
|
|
|
// NewPrometheusService creates new service for gathering prometheus metrics.
|
|
func NewPrometheusService(cfg Config) *Service {
|
|
return &Service{
|
|
&http.Server{
|
|
Addr: cfg.Address + ":" + cfg.Port,
|
|
Handler: promhttp.Handler(),
|
|
}, cfg, "Prometheus",
|
|
}
|
|
}
|