internal/telemetry/metrics: document concurrently using (#891)

Document that metricRegistry is not safe for concurrently use. While at
it, remove t.Parallel() in tests which use metricRegistry, which causes
data race, caught by:

	go test -race ./internal/telemetry/metrics
This commit is contained in:
Cuong Manh Le 2020-06-15 23:08:03 +07:00 committed by GitHub
parent e0bdd906f9
commit 34d06e521d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View file

@ -18,6 +18,8 @@ var (
// metricRegistry holds the non-view metrics and handles safe
// initialization and updates. Behavior without using newMetricRegistry()
// is undefined.
//
// It is not safe to use metricRegistry concurrently.
type metricRegistry struct {
registry *metric.Registry
buildInfo *metric.Int64Gauge