From 529049bd03318aeadea3b3ebc433e668cf6f0d3b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 26 Sep 2022 07:33:57 -0700 Subject: [PATCH] Remove unused meterRegistry Range method (#3230) Co-authored-by: Chester Cheung --- sdk/metric/meter.go | 15 --------------- sdk/metric/meter_test.go | 18 ------------------ 2 files changed, 33 deletions(-) diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index c38777b69d5..ff8222cbc7c 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -76,21 +76,6 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { return m } -// Range calls f sequentially for each meter present in the meterRegistry. If -// f returns false, the iteration is stopped. -// -// Range is safe to call concurrently. -func (r *meterRegistry) Range(f func(*meter) bool) { - r.Lock() - defer r.Unlock() - - for _, m := range r.meters { - if !f(m) { - return - } - } -} - // meter handles the creation and coordination of all metric instruments. A // meter represents a single instrumentation scope; all metric telemetry // produced by an instrumentation scope will use metric instruments from a diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 004eb12f8a5..7d6923fdd58 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -51,24 +51,6 @@ func TestMeterRegistry(t *testing.T) { t.Run("GetDifferentMeter", func(t *testing.T) { assert.NotSamef(t, m0, m1, "returned same meters: %v", is1) }) - - t.Run("RangeComplete", func(t *testing.T) { - var got []*meter - r.Range(func(m *meter) bool { - got = append(got, m) - return true - }) - assert.ElementsMatch(t, []*meter{m0, m1}, got) - }) - - t.Run("RangeStopIteration", func(t *testing.T) { - var i int - r.Range(func(m *meter) bool { - i++ - return false - }) - assert.Equal(t, 1, i, "iteration not stopped after first flase return") - }) } // A meter should be able to make instruments concurrently.