From 4da5c25ea43b0c2d48305aba48a2d0c804a7f8b3 Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Wed, 21 Apr 2021 12:19:16 +0200 Subject: [PATCH] Upgrade prometheus/common to v0.21.0 Signed-off-by: Marco Pracucci --- discovery/digitalocean/digitalocean.go | 2 +- discovery/eureka/eureka.go | 2 +- discovery/hetzner/hcloud.go | 2 +- discovery/hetzner/robot.go | 2 +- discovery/kubernetes/kubernetes.go | 2 +- discovery/marathon/marathon.go | 2 +- discovery/moby/docker.go | 2 +- discovery/moby/dockerswarm.go | 2 +- discovery/scaleway/baremetal.go | 2 +- discovery/scaleway/instance.go | 2 +- go.mod | 2 +- go.sum | 8 ++++++-- notifier/notifier.go | 2 +- notifier/notifier_test.go | 2 +- scrape/scrape.go | 4 ++-- scrape/target_test.go | 16 ++++++++-------- storage/remote/client.go | 4 ++-- 17 files changed, 31 insertions(+), 27 deletions(-) diff --git a/discovery/digitalocean/digitalocean.go b/discovery/digitalocean/digitalocean.go index b3fc8dea5..67d8f50dc 100644 --- a/discovery/digitalocean/digitalocean.go +++ b/discovery/digitalocean/digitalocean.go @@ -108,7 +108,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { port: conf.Port, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "digitalocean_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "digitalocean_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/eureka/eureka.go b/discovery/eureka/eureka.go index bfa6d70a7..95b4160ff 100644 --- a/discovery/eureka/eureka.go +++ b/discovery/eureka/eureka.go @@ -118,7 +118,7 @@ type Discovery struct { // New creates a new Eureka discovery for the given role. func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "eureka_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "eureka_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/hetzner/hcloud.go b/discovery/hetzner/hcloud.go index 20cfd1e58..3c0e8ba96 100644 --- a/discovery/hetzner/hcloud.go +++ b/discovery/hetzner/hcloud.go @@ -63,7 +63,7 @@ func newHcloudDiscovery(conf *SDConfig, logger log.Logger) (*hcloudDiscovery, er port: conf.Port, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/hetzner/robot.go b/discovery/hetzner/robot.go index f3041d2c6..b68361345 100644 --- a/discovery/hetzner/robot.go +++ b/discovery/hetzner/robot.go @@ -59,7 +59,7 @@ func newRobotDiscovery(conf *SDConfig, logger log.Logger) (*robotDiscovery, erro endpoint: conf.robotEndpoint, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/kubernetes/kubernetes.go b/discovery/kubernetes/kubernetes.go index d7595b502..602c9c0c9 100644 --- a/discovery/kubernetes/kubernetes.go +++ b/discovery/kubernetes/kubernetes.go @@ -265,7 +265,7 @@ func New(l log.Logger, conf *SDConfig) (*Discovery, error) { } level.Info(l).Log("msg", "Using pod service account via in-cluster config") } else { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "kubernetes_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "kubernetes_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/marathon/marathon.go b/discovery/marathon/marathon.go index 016906910..2ecb5c611 100644 --- a/discovery/marathon/marathon.go +++ b/discovery/marathon/marathon.go @@ -131,7 +131,7 @@ type Discovery struct { // NewDiscovery returns a new Marathon Discovery. func NewDiscovery(conf SDConfig, logger log.Logger) (*Discovery, error) { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "marathon_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "marathon_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/moby/docker.go b/discovery/moby/docker.go index c4da25d12..d82191e79 100644 --- a/discovery/moby/docker.go +++ b/discovery/moby/docker.go @@ -138,7 +138,7 @@ func NewDockerDiscovery(conf *DockerSDConfig, logger log.Logger) (*DockerDiscove // unix, which are not supported by the HTTP client. Passing HTTP client // options to the Docker client makes those non-HTTP requests fail. if hostURL.Scheme == "http" || hostURL.Scheme == "https" { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "docker_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "docker_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/moby/dockerswarm.go b/discovery/moby/dockerswarm.go index 2381d763e..edf3c2388 100644 --- a/discovery/moby/dockerswarm.go +++ b/discovery/moby/dockerswarm.go @@ -146,7 +146,7 @@ func NewDiscovery(conf *DockerSwarmSDConfig, logger log.Logger) (*Discovery, err // unix, which are not supported by the HTTP client. Passing HTTP client // options to the Docker client makes those non-HTTP requests fail. if hostURL.Scheme == "http" || hostURL.Scheme == "https" { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "dockerswarm_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "dockerswarm_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/scaleway/baremetal.go b/discovery/scaleway/baremetal.go index 6dcf3b7fa..066c0b604 100644 --- a/discovery/scaleway/baremetal.go +++ b/discovery/scaleway/baremetal.go @@ -70,7 +70,7 @@ func newBaremetalDiscovery(conf *SDConfig) (*baremetalDiscovery, error) { tagsFilter: conf.TagsFilter, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/discovery/scaleway/instance.go b/discovery/scaleway/instance.go index 2666fc65c..8b2603165 100644 --- a/discovery/scaleway/instance.go +++ b/discovery/scaleway/instance.go @@ -81,7 +81,7 @@ func newInstanceDiscovery(conf *SDConfig) (*instanceDiscovery, error) { tagsFilter: conf.TagsFilter, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd", false, false) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd", config.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 82d64d9db..b9fa5bdbb 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/prometheus/alertmanager v0.21.0 github.com/prometheus/client_golang v1.10.0 github.com/prometheus/client_model v0.2.0 - github.com/prometheus/common v0.20.0 + github.com/prometheus/common v0.21.0 github.com/prometheus/exporter-toolkit v0.5.1 github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44 github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 diff --git a/go.sum b/go.sum index 9f063e482..51e72402d 100644 --- a/go.sum +++ b/go.sum @@ -722,8 +722,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.20.0 h1:pfeDeUdQcIxOMutNjCejsEFp7qeP+/iltHSSmLpE+hU= -github.com/prometheus/common v0.20.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.21.0 h1:SMvI2JVldvfUvRVlP64jkIJEC6WiGHJcN2e5tB+ztF8= +github.com/prometheus/common v0.21.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/exporter-toolkit v0.5.1 h1:9eqgis5er9xN613ZSADjypCJaDGj9ZlcWBvsIHa8/3c= github.com/prometheus/exporter-toolkit v0.5.1/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1037,6 +1037,7 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1132,6 +1133,7 @@ golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200828161849-5deb26317202/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1166,6 +1168,7 @@ google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/ google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.31.0/go.mod h1:CL+9IBCa2WWU6gRuBWaKqGWLFFwbEUXkfeMkHLQWYWo= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= @@ -1212,6 +1215,7 @@ google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1m google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200831141814-d751682dd103/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= diff --git a/notifier/notifier.go b/notifier/notifier.go index 585661350..9c79807a6 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -634,7 +634,7 @@ type alertmanagerSet struct { } func newAlertmanagerSet(cfg *config.AlertmanagerConfig, logger log.Logger, metrics *alertMetrics) (*alertmanagerSet, error) { - client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, "alertmanager", false, false) + client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, "alertmanager", config_util.WithHTTP2Disabled()) if err != nil { return nil, err } diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index ea0b7b151..0e66f826c 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -146,7 +146,7 @@ func TestHandlerSendAll(t *testing.T) { Username: "prometheus", Password: "testing_password", }, - }, "auth_alertmanager", false, false) + }, "auth_alertmanager", config_util.WithHTTP2Disabled()) h.alertmanagers = make(map[string]*alertmanagerSet) diff --git a/scrape/scrape.go b/scrape/scrape.go index 7967c309f..f7888f3ee 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -238,7 +238,7 @@ func newScrapePool(cfg *config.ScrapeConfig, app storage.Appendable, jitterSeed logger = log.NewNopLogger() } - client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName, false, false) + client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName, config_util.WithHTTP2Disabled()) if err != nil { targetScrapePoolsFailed.Inc() return nil, errors.Wrap(err, "error creating HTTP client") @@ -343,7 +343,7 @@ func (sp *scrapePool) reload(cfg *config.ScrapeConfig) error { targetScrapePoolReloads.Inc() start := time.Now() - client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName, false, false) + client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName, config_util.WithHTTP2Disabled()) if err != nil { targetScrapePoolReloadsFailed.Inc() return errors.Wrap(err, "error creating HTTP client") diff --git a/scrape/target_test.go b/scrape/target_test.go index 5421e16f5..cc6a02291 100644 --- a/scrape/target_test.go +++ b/scrape/target_test.go @@ -147,7 +147,7 @@ func TestNewHTTPBearerToken(t *testing.T) { cfg := config_util.HTTPClientConfig{ BearerToken: "1234", } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -174,7 +174,7 @@ func TestNewHTTPBearerTokenFile(t *testing.T) { cfg := config_util.HTTPClientConfig{ BearerTokenFile: "testdata/bearertoken.txt", } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -203,7 +203,7 @@ func TestNewHTTPBasicAuth(t *testing.T) { Password: "password123", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -231,7 +231,7 @@ func TestNewHTTPCACert(t *testing.T) { CAFile: caCertPath, }, } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -264,7 +264,7 @@ func TestNewHTTPClientCert(t *testing.T) { KeyFile: "testdata/client.key", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -293,7 +293,7 @@ func TestNewHTTPWithServerName(t *testing.T) { ServerName: "prometheus.rocks", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -322,7 +322,7 @@ func TestNewHTTPWithBadServerName(t *testing.T) { ServerName: "badname", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", false, false) + c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err != nil { t.Fatal(err) } @@ -360,7 +360,7 @@ func TestNewClientWithBadTLSConfig(t *testing.T) { KeyFile: "testdata/nonexistent_client.key", }, } - _, err := config_util.NewClientFromConfig(cfg, "test", false, false) + _, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) if err == nil { t.Fatalf("Expected error, got nil.") } diff --git a/storage/remote/client.go b/storage/remote/client.go index 14bb8f7d7..36ea1c903 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -110,7 +110,7 @@ type ReadClient interface { // NewReadClient creates a new client for remote read. func NewReadClient(name string, conf *ClientConfig) (ReadClient, error) { - httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_read_client", false, false) + httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_read_client", config_util.WithHTTP2Disabled()) if err != nil { return nil, err } @@ -136,7 +136,7 @@ func NewReadClient(name string, conf *ClientConfig) (ReadClient, error) { // NewWriteClient creates a new client for remote write. func NewWriteClient(name string, conf *ClientConfig) (WriteClient, error) { - httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_write_client", false, false) + httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_write_client", config_util.WithHTTP2Disabled()) if err != nil { return nil, err }