deathowl / go-metrics-prometheus

Prometheus support for go-metrics
Apache License 2.0
90 stars 32 forks source link

Race detection #11

Closed tumani1 closed 4 years ago

tumani1 commented 4 years ago

Replication: Start application with —race flag, Try to get metrics several times. Frequently we catch race condition.

Trace log: Previous write at 0x00c00019c7f0 by goroutine 97: github.com/prometheus/client_golang/prometheus.NewDesc() /Users/i.tumanov/go/pkg/mod/github.com/prometheus/client_golang@v0.9.2/prometheus/desc.go:81 +0x8d github.com/deathowl/go-metrics-prometheus.(PrometheusConfig).histogramFromNameAndMetric() /Users/i.tumanov/go/pkg/mod/github.com/deathowl/go-metrics-prometheus@v0.0.0-20190530215645-35bace25558f/prometheusmetrics.go:118 +0xbda github.com/deathowl/go-metrics-prometheus.(PrometheusConfig).UpdatePrometheusMetricsOnce.func1() /Users/i.tumanov/go/pkg/mod/github.com/deathowl/go-metrics-prometheus@v0.0.0-20190530215645-35bace25558f/prometheusmetrics.go:163 +0x72a github.com/rcrowley/go-metrics.(StandardRegistry).Each() /Users/i.tumanov/go/pkg/mod/github.com/rcrowley/go-metrics@v0.0.0-20181016184325-3113b8401b8a/registry.go:68 +0x1cc github.com/deathowl/go-metrics-prometheus.(PrometheusConfig).UpdatePrometheusMetricsOnce() /Users/i.tumanov/go/pkg/mod/github.com/deathowl/go-metrics-prometheus@v0.0.0-20190530215645-35bace25558f/prometheusmetrics.go:148 +0xfb github.com/deathowl/go-metrics-prometheus.(*PrometheusConfig).UpdatePrometheusMetrics() /Users/i.tumanov/go/pkg/mod/github.com/deathowl/go-metrics-prometheus@v0.0.0-20190530215645-35bace25558f/prometheusmetrics.go:143 +0xe8

deathowl commented 4 years ago

Merged, thanks :)