diff --git a/config/http_config.go b/config/http_config.go index 34b6370a..6a1fe19c 100644 --- a/config/http_config.go +++ b/config/http_config.go @@ -393,17 +393,18 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, optFuncs ...HT DialContext: dialContext, DialTLSContext: opts.dialTLSContextFunc, } - if opts.http2Enabled || os.Getenv("PROMETHEUS_COMMON_ENABLE_HTTP2") != "" { - // HTTP/2 support is golang has many problematic cornercases where + if opts.http2Enabled && os.Getenv("PROMETHEUS_COMMON_DISABLE_HTTP2") == "" { + // HTTP/2 support is golang had many problematic cornercases where // dead connections would be kept and used in connection pools. // https://github.com/golang/go/issues/32388 // https://github.com/golang/go/issues/39337 // https://github.com/golang/go/issues/39750 - // Enable HTTP2 if the environment variable - // PROMETHEUS_COMMON_ENABLE_HTTP2 is set. - // This is a temporary workaround so that users can safely test this - // and validate that HTTP2 can be enabled Prometheus-Wide again. + // Do not enable HTTP2 if the environment variable + // PROMETHEUS_COMMON_DISABLE_HTTP2 is set to a non-empty value. + // This allows users to easily disable HTTP2 in case they run into + // issues again, but will be removed once we are confident that + // things work as expected. http2t, err := http2.ConfigureTransports(rt.(*http.Transport)) if err != nil {