mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-22 07:01:29 +00:00
wip
This commit is contained in:
@@ -489,7 +489,7 @@ func (n *nodeImpl) OnStart(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if n.config.Instrumentation.Prometheus && n.config.Instrumentation.PrometheusListenAddr != "" {
|
||||
n.prometheusSrv = n.startPrometheusServer(ctx, n.config.Instrumentation.PrometheusListenAddr)
|
||||
n.prometheusSrv = n.startPrometheusServer(ctx, registry, n.config.Instrumentation.PrometheusListenAddr)
|
||||
}
|
||||
|
||||
// Start the transport.
|
||||
@@ -572,12 +572,12 @@ func (n *nodeImpl) OnStop() {
|
||||
|
||||
// startPrometheusServer starts a Prometheus HTTP server, listening for metrics
|
||||
// collectors on addr.
|
||||
func (n *nodeImpl) startPrometheusServer(ctx context.Context, addr string) *http.Server {
|
||||
func (n *nodeImpl) startPrometheusServer(ctx context.Context, registry *prometheus.Registry, addr string) *http.Server {
|
||||
srv := &http.Server{
|
||||
Addr: addr,
|
||||
Handler: promhttp.InstrumentMetricHandler(
|
||||
prometheus.DefaultRegisterer, promhttp.HandlerFor(
|
||||
prometheus.DefaultGatherer,
|
||||
registry, promhttp.HandlerFor(
|
||||
registry,
|
||||
promhttp.HandlerOpts{MaxRequestsInFlight: n.config.Instrumentation.MaxOpenConnections},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
abciclient "github.com/tendermint/tendermint/abci/client"
|
||||
@@ -503,3 +504,10 @@ func createPrivval(ctx context.Context, logger log.Logger, conf *config.Config,
|
||||
|
||||
return defaultPV, nil
|
||||
}
|
||||
|
||||
func createRegistry(conf *config.Config) *prometheus.Registry {
|
||||
if conf.Instrumentation.Prometheus {
|
||||
return prometheus.NewRegistry()
|
||||
}
|
||||
return prometheus.NewRegistry()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user