Skip to content

Commit e058c20

Browse files
authored
Rename Go version tag from version to go_version (#122)
Most of our services will set a version tag that represents the version of their service. However, the Go stats reported by the `procstats` package will overwrite this tag with the current Go runtime version. This becomes a bigger issue when scraping these stats via Prometheus, since it will consider a sample as invalid if labels are not unique: ![image](https://user-images.githubusercontent.com/2907397/89065716-3345d580-d33a-11ea-93e7-ab4833388980.png) This PR makes a breaking change to resolve this issue, by renaming the tag that specifics the Go runtime version from `version` to `go_version`.
1 parent 02d3072 commit e058c20

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ Monitoring
181181

182182
### Processes
183183

184+
> 🚧 Go metrics reported with the `procstats` package were previously tagged with a
185+
> `version` label that reported the Go runtime version. This label was renamed to
186+
> `go_version` in v4.6.0.
187+
184188
The
185189
[github.com/segmentio/stats/procstats](https://godoc.org/github.com/segmentio/stats/procstats)
186190
package exposes an API for creating a statistics collector on local processes.

procstats/go.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ func init() {
2323

2424
// GoMetrics is a metric collector that reports metrics from the Go runtime.
2525
type GoMetrics struct {
26-
engine *stats.Engine
27-
version string `tag:"version"`
26+
engine *stats.Engine
27+
goVersion string `tag:"go_version"`
2828

2929
runtime struct {
3030
// Runtime info.
@@ -113,8 +113,8 @@ func NewGoMetrics() *GoMetrics {
113113
// metrics on eng.
114114
func NewGoMetricsWith(eng *stats.Engine) *GoMetrics {
115115
g := &GoMetrics{
116-
engine: eng,
117-
version: runtime.Version(),
116+
engine: eng,
117+
goVersion: runtime.Version(),
118118
}
119119

120120
g.memstats.total.memtype = "total"

0 commit comments

Comments
 (0)