Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[internal/datadog] Fix Datarace in metrics client (#31964)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Fixes the data race. ``` fatal error: concurrent map read and map write goroutine 72665 [running]: github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog.(*metricsClient).Gauge.func1({0x7b895a0?, 0xc07c930790?}, {0x940dac8, 0xc1996ce180}) github.com/open-telemetry/opentelemetry-collector-contrib/internal/[email protected]/metrics_client.go:49 +0x85 go.opentelemetry.io/otel/sdk/metric.(*meter).float64ObservableInstrument.func1.1({0x9443f08, 0xef10b00}) go.opentelemetry.io/otel/sdk/[email protected]/meter.go:286 +0x55 go.opentelemetry.io/otel/sdk/metric.(*pipeline).produce(0xc002852bd0, {0x9443f08, 0xef10b00}, 0xc108dd46c0) go.opentelemetry.io/otel/sdk/[email protected]/pipeline.go:122 +0x168 go.opentelemetry.io/otel/sdk/metric.(*ManualReader).Collect(0xc0030d2aa0, {0x9443f08, 0xef10b00}, 0xc108dd46c0) go.opentelemetry.io/otel/sdk/[email protected]/manual_reader.go:123 +0xe2 go.opentelemetry.io/otel/exporters/prometheus.(*collector).Collect(0xc0030e4aa0, 0xc10a0083c0) go.opentelemetry.io/otel/exporters/[email protected]/exporter.go:158 +0x72 github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1() github.com/prometheus/[email protected]/prometheus/registry.go:457 +0xe5 created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather in goroutine 5 ``` **Link to tracking Issue:** <Issue number if applicable> **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.> --------- Co-authored-by: Yang Song <[email protected]>
- Loading branch information