From 8185d48f71d24bbaf2c66214ac9e46976c368ec0 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Mon, 7 Oct 2024 07:40:19 +0200 Subject: [PATCH] internal/cli: add: prometheus sever timeouts --- internal/cli/server/server.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index 138b2b1042..afeb25f3d1 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -39,6 +39,7 @@ import ( "github.com/ethereum/go-ethereum/metrics/influxdb" "github.com/ethereum/go-ethereum/metrics/prometheus" "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/rpc" // Force-load the tracer engines to trigger registration _ "github.com/ethereum/go-ethereum/eth/tracers/js" @@ -360,9 +361,15 @@ func (s *Server) setupMetrics(config *TelemetryConfig, serviceName string) error prometheusMux.Handle("/debug/metrics/prometheus", prometheus.Handler(metrics.DefaultRegistry)) + timeouts := rpc.DefaultHTTPTimeouts + promServer := &http.Server{ Addr: config.PrometheusAddr, Handler: prometheusMux, + ReadTimeout: timeouts.ReadTimeout, + ReadHeaderTimeout: timeouts.ReadHeaderTimeout, + WriteTimeout: timeouts.WriteTimeout, + IdleTimeout: timeouts.IdleTimeout, } go func() {