diff --git a/go.mod b/go.mod index b370bea100..29417f2fc1 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( github.com/prometheus/alertmanager v0.20.0 github.com/prometheus/client_golang v1.6.0 github.com/prometheus/client_model v0.2.0 - github.com/prometheus/common v0.9.1 + github.com/prometheus/common v0.10.0 github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd diff --git a/go.sum b/go.sum index 7f11608039..613ccd7cfc 100644 --- a/go.sum +++ b/go.sum @@ -670,6 +670,8 @@ github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLy github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= diff --git a/vendor/github.com/prometheus/common/config/http_config.go b/vendor/github.com/prometheus/common/config/http_config.go index 5c373d7a69..9b1fad93fa 100644 --- a/vendor/github.com/prometheus/common/config/http_config.go +++ b/vendor/github.com/prometheus/common/config/http_config.go @@ -29,6 +29,7 @@ import ( "time" "github.com/mwitkow/go-conntrack" + "golang.org/x/net/http2" "gopkg.in/yaml.v2" ) @@ -153,6 +154,11 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, disableKeepAli conntrack.DialWithName(name), ), } + // TODO: use ForceAttemptHTTP2 when we move to Go 1.13+. + err := http2.ConfigureTransport(rt.(*http.Transport)) + if err != nil { + return nil, err + } // If a bearer token is provided, create a round tripper that will set the // Authorization header correctly on each request. diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go index 7b0064fdb2..490a0240c1 100644 --- a/vendor/github.com/prometheus/common/model/time.go +++ b/vendor/github.com/prometheus/common/model/time.go @@ -186,6 +186,10 @@ var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") // ParseDuration parses a string into a time.Duration, assuming that a year // always has 365d, a week always has 7d, and a day always has 24h. func ParseDuration(durationStr string) (Duration, error) { + // Allow 0 without a unit. + if durationStr == "0" { + return 0, nil + } matches := durationRE.FindStringSubmatch(durationStr) if len(matches) != 3 { return 0, fmt.Errorf("not a valid duration string: %q", durationStr) diff --git a/vendor/github.com/prometheus/common/promlog/log.go b/vendor/github.com/prometheus/common/promlog/log.go index 45fcbc4085..5062e2805e 100644 --- a/vendor/github.com/prometheus/common/promlog/log.go +++ b/vendor/github.com/prometheus/common/promlog/log.go @@ -94,13 +94,15 @@ type Config struct { // with a timestamp. The output always goes to stderr. func New(config *Config) log.Logger { var l log.Logger - if config.Format.s == "logfmt" { - l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) - } else { + if config.Format != nil && config.Format.s == "json" { l = log.NewJSONLogger(log.NewSyncWriter(os.Stderr)) + } else { + l = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) } - l = level.NewFilter(l, config.Level.o) + if config.Level != nil { + l = level.NewFilter(l, config.Level.o) + } l = log.With(l, "ts", timestampFormat, "caller", log.DefaultCaller) return l } diff --git a/vendor/modules.txt b/vendor/modules.txt index 58c970f91c..829d091137 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -286,7 +286,7 @@ github.com/prometheus/client_golang/prometheus/testutil github.com/prometheus/client_golang/prometheus/testutil/promlint # github.com/prometheus/client_model v0.2.0 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.9.1 +# github.com/prometheus/common v0.10.0 github.com/prometheus/common/config github.com/prometheus/common/expfmt github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg