Skip to content

Commit

Permalink
Merge branch 'master' into sirockin-tb-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sirockin authored Sep 11, 2024
2 parents ac66ef9 + b125e2e commit 6fe4614
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 0 additions & 1 deletion internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func Init(iterationMetricsEnabled bool) {
}
m = NewInstance(defaultRegistry, iterationMetricsEnabled)
})
m.IterationMetricsEnabled = iterationMetricsEnabled
}

func Instance() *Metrics {
Expand Down
24 changes: 24 additions & 0 deletions internal/metrics/metrics_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package metrics_test

import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/form3tech-oss/f1/v2/internal/metrics"
)

func TestMetrics_Init_IsSafe(t *testing.T) {
t.Parallel()

metrics.Init(true)

// race detector assertion
for range 10 {
go func() {
metrics.Init(false)
}()
}

assert.True(t, metrics.Instance().IterationMetricsEnabled)
}

0 comments on commit 6fe4614

Please sign in to comment.