From 1a2d0724807dd0485e80650dacbb697e4e7224d4 Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Thu, 21 Dec 2023 15:31:51 -0300 Subject: [PATCH 1/2] Add 1.18 changelog Signed-off-by: Arthur Silva Sens --- CHANGELOG.md | 8 ++++++++ VERSION | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba968d4..74b9aba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Unreleased +## 1.18.0 / 2023-12-22 + +* [FEATURE] promlint: Allow creation of custom metric validations. #1311 +* [FEATURE] Go programs using client_golang can be built in wasip1 OS. #1350 +* [BUGFIX] histograms: Add timer to reset ASAP after bucket limiting has happened. #1367 +* [BUGFIX] testutil: Fix comparison of metrics with empty Help strings. #1378 +* [ENHANCEMENT] Improved performance of `MetricVec.WithLabelValues(...)`. #1360 + ## 1.17.0 / 2023-09-27 * [CHANGE] Minimum required go version is now 1.19 (we also test client_golang against new 1.21 version). #1325 diff --git a/VERSION b/VERSION index 092afa1..84cc529 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.0 +1.18.0 From 53be91d12107cb69053a8792d0a3a2a6124d59cf Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Fri, 22 Dec 2023 11:16:00 +0000 Subject: [PATCH 2/2] Revert "change api http.client to interface" (cherry picked from commit 2280fb19f68d39eaef7f67354de9fb2581cd9886) Signed-off-by: Arthur Silva Sens --- api/client.go | 16 ++++++---------- api/client_test.go | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/api/client.go b/api/client.go index 6577058..72a0130 100644 --- a/api/client.go +++ b/api/client.go @@ -36,18 +36,14 @@ var DefaultRoundTripper http.RoundTripper = &http.Transport{ TLSHandshakeTimeout: 10 * time.Second, } -type HttpClient interface { - Do(req *http.Request) (*http.Response, error) -} - // Config defines configuration parameters for a new client. type Config struct { // The address of the Prometheus to connect to. Address string // Client is used by the Client to drive HTTP requests. If not provided, - // a new http.Client based on the provided RoundTripper (or DefaultRoundTripper) will be used. - Client HttpClient + // a new one based on the provided RoundTripper (or DefaultRoundTripper) will be used. + Client *http.Client // RoundTripper is used by the Client to drive HTTP requests. If not // provided, DefaultRoundTripper will be used. @@ -61,13 +57,13 @@ func (cfg *Config) roundTripper() http.RoundTripper { return cfg.RoundTripper } -func (cfg *Config) client() HttpClient { +func (cfg *Config) client() http.Client { if cfg.Client == nil { - return &http.Client{ + return http.Client{ Transport: cfg.roundTripper(), } } - return cfg.Client + return *cfg.Client } func (cfg *Config) validate() error { @@ -105,7 +101,7 @@ func NewClient(cfg Config) (Client, error) { type httpClient struct { endpoint *url.URL - client HttpClient + client http.Client } func (c *httpClient) URL(ep string, args map[string]string) *url.URL { diff --git a/api/client_test.go b/api/client_test.go index ceb7047..8743878 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -105,7 +105,7 @@ func TestClientURL(t *testing.T) { hclient := &httpClient{ endpoint: ep, - client: &http.Client{Transport: DefaultRoundTripper}, + client: http.Client{Transport: DefaultRoundTripper}, } u := hclient.URL(test.endpoint, test.args)