mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Limit prometheus requests in flight, set timeout to reasonable 30 seconds (#8130)
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"runtime/pprof"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/prysmaticlabs/prysm/shared"
|
||||
"github.com/prysmaticlabs/prysm/shared/logutil"
|
||||
@@ -40,7 +41,10 @@ func NewService(addr string, svcRegistry *shared.ServiceRegistry, additionalHand
|
||||
s := &Service{svcRegistry: svcRegistry}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/metrics", promhttp.Handler())
|
||||
mux.Handle("/metrics", promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
|
||||
MaxRequestsInFlight: 5,
|
||||
Timeout: 30 * time.Second,
|
||||
}))
|
||||
mux.HandleFunc("/healthz", s.healthzHandler)
|
||||
mux.HandleFunc("/goroutinez", s.goroutinezHandler)
|
||||
mux.HandleFunc("/logs", logutil.NewLogStreamServer().Handler)
|
||||
|
||||
Reference in New Issue
Block a user