Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(metrics): fix race condition in metrics.Init()
IterationMetricsEnabled can be concurrently set ``` ================== WARNING: DATA RACE Write at 0x00c000124098 by goroutine 12: github.com/form3tech-oss/f1/v2/internal/metrics.Init() /Users/nikolayvladimirov/go/src/github.com/form3tech-oss/f1/internal/metrics/metrics.go:82 +0x7c github.com/form3tech-oss/f1/v2/internal/metrics_test.TestMetrics_Init_IsSafe.func1() /Users/nikolayvladimirov/go/src/github.com/form3tech-oss/f1/internal/metrics/metrics_test.go:15 +0x20 Previous write at 0x00c000124098 by goroutine 14: github.com/form3tech-oss/f1/v2/internal/metrics.Init() /Users/nikolayvladimirov/go/src/github.com/form3tech-oss/f1/internal/metrics/metrics.go:82 +0x7c github.com/form3tech-oss/f1/v2/internal/metrics_test.TestMetrics_Init_IsSafe.func1() /Users/nikolayvladimirov/go/src/github.com/form3tech-oss/f1/internal/metrics/metrics_test.go:15 +0x20 Goroutine 12 (running) created at: github.com/form3tech-oss/f1/v2/internal/metrics_test.TestMetrics_Init_IsSafe() /Users/nikolayvladimirov/go/src/github.com/form3tech-oss/f1/internal/metrics/metrics_test.go:14 +0xa4 testing.tRunner() /opt/homebrew/Cellar/go/1.23.1/libexec/src/testing/testing.go:1690 +0x184 testing.(*T).Run.gowrap1() /opt/homebrew/Cellar/go/1.23.1/libexec/src/testing/testing.go:1743 +0x40 Goroutine 14 (finished) created at: github.com/form3tech-oss/f1/v2/internal/metrics_test.TestMetrics_Init_IsSafe() /Users/nikolayvladimirov/go/src/github.com/form3tech-oss/f1/internal/metrics/metrics_test.go:14 +0xa4 testing.tRunner() /opt/homebrew/Cellar/go/1.23.1/libexec/src/testing/testing.go:1690 +0x184 testing.(*T).Run.gowrap1() /opt/homebrew/Cellar/go/1.23.1/libexec/src/testing/testing.go:1743 +0x40 ```
- Loading branch information