Skip to content

Commit

Permalink
Re-enable HTTP/2 (prometheus#325)
Browse files Browse the repository at this point in the history
* 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 <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie authored and LeviHarrison committed Oct 9, 2021
1 parent d9fc5f4 commit e495da2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions config/http_config.go
Expand Up @@ -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 {
Expand Down

0 comments on commit e495da2

Please sign in to comment.