Skip to content

Commit

Permalink
gocollector: Reverted client_golang v1.12 addition of runtime/metrics…
Browse files Browse the repository at this point in the history
… metrics by default. (#1033)

Fixes #967

Signed-off-by: Bartlomiej Plotka <[email protected]>
  • Loading branch information
bwplotka authored and kakkoyun committed May 13, 2022
1 parent d498b3c commit 7eb9d11
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

* [CHANGE] Minimum required Go version is now 1.16.
* [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.
* [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.

## 1.12.1 / 2022-01-29

* [BUGFIX] Make the Go 1.17 collector concurrency-safe #969
Expand Down
4 changes: 2 additions & 2 deletions prometheus/collectors/go_collector_latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const (
// WithGoCollections(GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection) means both GoRuntimeMemStatsCollection
// metrics and GoRuntimeMetricsCollection will be exposed.
//
// Use WithGoCollections(GoRuntimeMemStatsCollection) to have Go collector working in
// the compatibility mode with client_golang pre v1.12 (move to runtime/metrics).
// The current default is GoRuntimeMemStatsCollection, so the compatibility mode with
// client_golang pre v1.12 (move to runtime/metrics).
func WithGoCollections(flags uint32) goOption {
return func(o *goOptions) {
o.EnabledCollections = flags
Expand Down
2 changes: 1 addition & 1 deletion prometheus/go_collector_latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (c GoCollectorOptions) isEnabled(flag uint32) bool {
return c.EnabledCollections&flag != 0
}

const defaultGoCollections = goRuntimeMemStatsCollection | goRuntimeMetricsCollection
const defaultGoCollections = goRuntimeMemStatsCollection

// NewGoCollector is the obsolete version of collectors.NewGoCollector.
// See there for documentation.
Expand Down
2 changes: 1 addition & 1 deletion prometheus/go_collector_latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestGoCollector(t *testing.T) {
var sink interface{}

func TestBatchHistogram(t *testing.T) {
goMetrics := collectGoMetrics(t, defaultGoCollections)
goMetrics := collectGoMetrics(t, goRuntimeMetricsCollection)

var mhist Metric
for _, m := range goMetrics {
Expand Down

0 comments on commit 7eb9d11

Please sign in to comment.