You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
Remove unused meterRegistry Range method (#3230)
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user