Skip to content

Commit

Permalink
Re-enable HTTP/2 (#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 <[email protected]>
  • Loading branch information
roidelapluie authored Sep 26, 2021
1 parent 8d1c9f8 commit fe057a9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions config/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fe057a9

Please sign in to comment.