Skip to content

Commit

Permalink
Remove unused meterRegistry Range method (#3230)
Browse files Browse the repository at this point in the history
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
  • Loading branch information
MrAlias and hanyuancheung committed Sep 26, 2022
1 parent b369e59 commit 529049b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
15 changes: 0 additions & 15 deletions sdk/metric/meter.go
Expand Up @@ -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
Expand Down
18 changes: 0 additions & 18 deletions sdk/metric/meter_test.go
Expand Up @@ -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.
Expand Down

0 comments on commit 529049b

Please sign in to comment.