mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-17 23:21:21 +00:00
limit the number of requests in flights for Prometheus server (#1927)
* limit the number of requests in flights for Prometheus server Closes #1804 Default to 1 because usually there's just one collector. * config: Up default for prom connections
This commit is contained in:
10
node/node.go
10
node/node.go
@ -8,6 +8,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
amino "github.com/tendermint/go-amino"
|
||||
@ -599,8 +600,13 @@ func (n *Node) startRPC() ([]net.Listener, error) {
|
||||
// collectors on addr.
|
||||
func (n *Node) startPrometheusServer(addr string) *http.Server {
|
||||
srv := &http.Server{
|
||||
Addr: addr,
|
||||
Handler: promhttp.Handler(),
|
||||
Addr: addr,
|
||||
Handler: promhttp.InstrumentMetricHandler(
|
||||
prometheus.DefaultRegisterer, promhttp.HandlerFor(
|
||||
prometheus.DefaultGatherer,
|
||||
promhttp.HandlerOpts{MaxRequestsInFlight: n.config.Instrumentation.MaxOpenConnections},
|
||||
),
|
||||
),
|
||||
}
|
||||
go func() {
|
||||
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
|
||||
|
Reference in New Issue
Block a user