Skip to content

Commit fe057a9

Browse files
author
Julien Pivotto
authored
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 <[email protected]>
1 parent 8d1c9f8 commit fe057a9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

config/http_config.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -380,17 +380,18 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, optFuncs ...HT
380380
ExpectContinueTimeout: 1 * time.Second,
381381
DialContext: dialContext,
382382
}
383-
if opts.http2Enabled || os.Getenv("PROMETHEUS_COMMON_ENABLE_HTTP2") != "" {
384-
// HTTP/2 support is golang has many problematic cornercases where
383+
if opts.http2Enabled && os.Getenv("PROMETHEUS_COMMON_DISABLE_HTTP2") == "" {
384+
// HTTP/2 support is golang had many problematic cornercases where
385385
// dead connections would be kept and used in connection pools.
386386
// https://github.com/golang/go/issues/32388
387387
// https://github.com/golang/go/issues/39337
388388
// https://github.com/golang/go/issues/39750
389389

390-
// Enable HTTP2 if the environment variable
391-
// PROMETHEUS_COMMON_ENABLE_HTTP2 is set.
392-
// This is a temporary workaround so that users can safely test this
393-
// and validate that HTTP2 can be enabled Prometheus-Wide again.
390+
// Do not enable HTTP2 if the environment variable
391+
// PROMETHEUS_COMMON_DISABLE_HTTP2 is set to a non-empty value.
392+
// This allows users to easily disable HTTP2 in case they run into
393+
// issues again, but will be removed once we are confident that
394+
// things work as expected.
394395

395396
http2t, err := http2.ConfigureTransports(rt.(*http.Transport))
396397
if err != nil {

0 commit comments

Comments
 (0)