From 8185d48f71d24bbaf2c66214ac9e46976c368ec0 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Mon, 7 Oct 2024 07:40:19 +0200 Subject: [PATCH 1/2] 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() { From 63dd8d6315b0cce7775942ea9aea0ce738c4bd92 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Mon, 7 Oct 2024 07:50:23 +0200 Subject: [PATCH 2/2] fix: lint --- internal/cli/server/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index afeb25f3d1..4d87d64608 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -364,8 +364,8 @@ func (s *Server) setupMetrics(config *TelemetryConfig, serviceName string) error timeouts := rpc.DefaultHTTPTimeouts promServer := &http.Server{ - Addr: config.PrometheusAddr, - Handler: prometheusMux, + Addr: config.PrometheusAddr, + Handler: prometheusMux, ReadTimeout: timeouts.ReadTimeout, ReadHeaderTimeout: timeouts.ReadHeaderTimeout, WriteTimeout: timeouts.WriteTimeout,