Skip to content

Commit 95cf173

Browse files
committed
Merge branch 'main' into sparsehistogram
2 parents ec86ef1 + 83d56b1 commit 95cf173

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1500
-525
lines changed

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.18

.golangci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,26 @@ output:
88

99
linters:
1010
enable:
11+
- deadcode
12+
- depguard
13+
- durationcheck
14+
- errorlint
15+
- exportloopref
16+
- gofmt
1117
- gofumpt
1218
- goimports
13-
- revive
19+
- gosimple
20+
- ineffassign
1421
- misspell
22+
- nolintlint
23+
- predeclared
24+
- revive
25+
- staticcheck
26+
- structcheck
27+
- unconvert
28+
- unused
29+
- varcheck
30+
- wastedassign
1531

1632
issues:
1733
max-same-issues: 0

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
## Unreleased
22

3-
* [CHANGE] Minimum required Go version is now 1.16.
3+
## 1.13.0 / 2022-08-05
4+
5+
* [CHANGE] Minimum required Go version is now 1.17 (we also test client_golang against new 1.19 version).
6+
* [ENHANCEMENT] Added `prometheus.TransactionalGatherer` interface for `promhttp.Handler` use which allows using low allocation update techniques for custom collectors. #989
7+
* [ENHANCEMENT] Added exemplar support to `prometheus.NewConstHistogram`. See [`ExampleNewConstHistogram_WithExemplar`](prometheus/examples_test.go#L602) example on how to use it. #986
8+
* [ENHANCEMENT] `prometheus/push.Pusher` has now context aware methods that pass context to HTTP request. #1028
9+
* [ENHANCEMENT] `prometheus/push.Pusher` has now `Error` method that retrieve last error. #1075
10+
* [ENHANCEMENT] `testutil.GatherAndCompare` provides now readable diff on failed comparisons. #998
11+
* [ENHANCEMENT] Query API now supports timeouts. #1014
12+
* [ENHANCEMENT] New `MetricVec` method `DeletePartialMatch(labels Labels)` for deleting all metrics that match provided labels. #1013
13+
* [ENHANCEMENT] `api.Config` now accepts passing custom `*http.Client`. #1025
14+
* [BUGFIX] Raise exemplar labels limit from 64 to 128 bytes as specified in OpenMetrics spec. #1091
15+
* [BUGFIX] Allow adding exemplar to +Inf bucket to const histograms. #1094
16+
* [ENHANCEMENT] Most `promhttp.Instrument*` middlewares now supports adding exemplars to metrics. This allows hooking those to your tracing middleware that retrieves trace ID and put it in exemplar if present. #1055
17+
* [ENHANCEMENT] Added `testutil.ScrapeAndCompare` method. #1043
18+
* [BUGFIX] Fixed `GopherJS` build support. #897
19+
* [ENHANCEMENT] :warning: Added way to specify what `runtime/metrics` `collectors.NewGoCollector` should use. See [`ExampleGoCollector_WithAdvancedGoMetrics`](prometheus/collectors/go_collector_latest_test.go#L263). #1102
420

521
## 1.12.2 / 2022-05-13
622

7-
* [CHANGE] Added `collectors.WithGoCollections` that allows to choose what collection of Go runtime metrics user wants: Equivalent of [`MemStats` structure](https://pkg.go.dev/runtime#MemStats) configured using `GoRuntimeMemStatsCollection`, new based on dedicated [runtime/metrics](https://pkg.go.dev/runtime/metrics) metrics represented by `GoRuntimeMetricsCollection` option, or both by specifying `GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection` flag.
23+
* [CHANGE] Added `collectors.WithGoCollections` that allows to choose what collection of Go runtime metrics user wants: Equivalent of [`MemStats` structure](https://pkg.go.dev/runtime#MemStats) configured using `GoRuntimeMemStatsCollection`, new based on dedicated [runtime/metrics](https://pkg.go.dev/runtime/metrics) metrics represented by `GoRuntimeMetricsCollection` option, or both by specifying `GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection` flag. #1031
824
* [CHANGE] :warning: Change in `collectors.NewGoCollector` metrics: Reverting addition of new ~80 runtime metrics by default. You can enable this back with `GoRuntimeMetricsCollection` option or `GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection` for smooth transition.
925
* [BUGFIX] Fixed the bug that causes generated histogram metric names to end with `_total`. ⚠️ This changes 3 metric names in the new Go collector that was reverted from default in this release.
1026
* `go_gc_heap_allocs_by_size_bytes_total` -> `go_gc_heap_allocs_by_size_bytes`,

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ test: deps common-test
1818

1919
.PHONY: test-short
2020
test-short: deps common-test-short
21+
22+
.PHONY: generate-go-collector-test-files
23+
VERSIONS := 1.17 1.18 1.19
24+
generate-go-collector-test-files:
25+
for GO_VERSION in $(VERSIONS); do \
26+
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
27+
mv -f go_collector_metrics* prometheus; \
28+
done

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.12.2
1+
1.13.0

api/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (c *httpClient) URL(ep string, args map[string]string) *url.URL {
109109

110110
for arg, val := range args {
111111
arg = ":" + arg
112-
p = strings.Replace(p, arg, val, -1)
112+
p = strings.ReplaceAll(p, arg, val)
113113
}
114114

115115
u := *c.endpoint

api/prometheus/v1/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ func (h *httpAPI) Query(ctx context.Context, query string, ts time.Time, opts ..
856856
}
857857

858858
var qres queryResult
859-
return model.Value(qres.v), warnings, json.Unmarshal(body, &qres)
859+
return qres.v, warnings, json.Unmarshal(body, &qres)
860860
}
861861

862862
func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range, opts ...Option) (model.Value, Warnings, error) {
@@ -885,7 +885,7 @@ func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range, opts ..
885885

886886
var qres queryResult
887887

888-
return model.Value(qres.v), warnings, json.Unmarshal(body, &qres)
888+
return qres.v, warnings, json.Unmarshal(body, &qres)
889889
}
890890

891891
func (h *httpAPI) Series(ctx context.Context, matches []string, startTime, endTime time.Time) ([]model.LabelSet, Warnings, error) {

0 commit comments

Comments
 (0)