MCPcopy
hub / github.com/prometheus/client_golang / BenchmarkGoCollector

Function BenchmarkGoCollector

prometheus/go_collector_test.go:158–173  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

156}
157
158func BenchmarkGoCollector(b *testing.B) {
159 c := NewGoCollector().(*goCollector)
160
161 b.ResetTimer()
162 for i := 0; i < b.N; i++ {
163 ch := make(chan Metric, 8)
164 go func() {
165 // Drain all metrics received until the
166 // channel is closed.
167 for range ch {
168 }
169 }()
170 c.Collect(ch)
171 close(ch)
172 }
173}

Callers

nothing calls this directly

Calls 2

NewGoCollectorFunction · 0.70
CollectMethod · 0.65

Tested by

no test coverage detected