MCPcopy Create free account
hub / github.com/tendermint/tendermint / startPrometheusServer

Method startPrometheusServer

node/node.go:1037–1054  ·  view source on GitHub ↗

startPrometheusServer starts a Prometheus HTTP server, listening for metrics collectors on addr.

(addr string)

Source from the content-addressed store, hash-verified

1035// startPrometheusServer starts a Prometheus HTTP server, listening for metrics
1036// collectors on addr.
1037func (n *nodeImpl) startPrometheusServer(addr string) *http.Server {
1038 srv := &http.Server{
1039 Addr: addr,
1040 Handler: promhttp.InstrumentMetricHandler(
1041 prometheus.DefaultRegisterer, promhttp.HandlerFor(
1042 prometheus.DefaultGatherer,
1043 promhttp.HandlerOpts{MaxRequestsInFlight: n.config.Instrumentation.MaxOpenConnections},
1044 ),
1045 ),
1046 }
1047 go func() {
1048 if err := srv.ListenAndServe(); err != http.ErrServerClosed {
1049 // Error starting or closing listener:
1050 n.Logger.Error("Prometheus HTTP server ListenAndServe", "err", err)
1051 }
1052 }()
1053 return srv
1054}
1055
1056// ConsensusReactor returns the Node's ConsensusReactor.
1057func (n *nodeImpl) ConsensusReactor() *consensus.Reactor {

Callers 1

OnStartMethod · 0.95

Calls 2

ListenAndServeMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected