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

Function BenchmarkSummaryWithLabelValues

prometheus/benchmark_test.go:174–188  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

172}
173
174func BenchmarkSummaryWithLabelValues(b *testing.B) {
175 m := NewSummaryVec(
176 SummaryOpts{
177 Name: "benchmark_summary",
178 Help: "A summary to benchmark it.",
179 Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
180 },
181 []string{"one", "two", "three"},
182 )
183 b.ReportAllocs()
184 b.ResetTimer()
185 for i := 0; i < b.N; i++ {
186 m.WithLabelValues("eins", "zwei", "drei").Observe(3.1415)
187 }
188}
189
190func BenchmarkSummaryNoLabels(b *testing.B) {
191 m := NewSummary(SummaryOpts{

Callers

nothing calls this directly

Calls 3

WithLabelValuesMethod · 0.95
NewSummaryVecFunction · 0.70
ObserveMethod · 0.65

Tested by

no test coverage detected