mirror of https://github.com/poanetwork/gecko.git
24 lines
658 B
Go
24 lines
658 B
Go
|
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
|
||
|
// See the file LICENSE for licensing terms.
|
||
|
|
||
|
package metrics
|
||
|
|
||
|
import (
|
||
|
"github.com/ava-labs/gecko/snow/engine/common"
|
||
|
"github.com/prometheus/client_golang/prometheus"
|
||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||
|
)
|
||
|
|
||
|
// NewService returns a new prometheus service
|
||
|
func NewService() (*prometheus.Registry, *common.HTTPHandler) {
|
||
|
registerer := prometheus.NewRegistry()
|
||
|
handler := promhttp.InstrumentMetricHandler(
|
||
|
registerer,
|
||
|
promhttp.HandlerFor(
|
||
|
registerer,
|
||
|
promhttp.HandlerOpts{},
|
||
|
),
|
||
|
)
|
||
|
return registerer, &common.HTTPHandler{LockOptions: common.NoLock, Handler: handler}
|
||
|
}
|