From fe057a909c07b8b3cc47e25d8e7b01b9f88012f4 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Sun, 26 Sep 2021 14:44:39 +0200 Subject: [PATCH] Re-enable HTTP/2 (#325) * Re-enable HTTP/2 HTTP/2 has been tested and validated by some of our users. It is time to bring it back. Signed-off-by: Julien Pivotto --- config/http_config.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/config/http_config.go b/config/http_config.go index 6c0c033d..6b3609a1 100644 --- a/config/http_config.go +++ b/config/http_config.go @@ -380,17 +380,18 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, optFuncs ...HT ExpectContinueTimeout: 1 * time.Second, DialContext: dialContext, } - 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 {