Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 1.18 changelog #1410

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
ArthurSens marked this conversation as resolved.
Show resolved Hide resolved

## 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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.0
1.18.0
16 changes: 6 additions & 10 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading