startPrometheusServer starts a Prometheus HTTP server, listening for metrics collectors on addr.
(addr string)
| 1035 | // startPrometheusServer starts a Prometheus HTTP server, listening for metrics |
| 1036 | // collectors on addr. |
| 1037 | func (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. |
| 1057 | func (n *nodeImpl) ConsensusReactor() *consensus.Reactor { |
no test coverage detected