MCPcopy
hub / github.com/grafana/tempo / BenchmarkHistogramAggregator_Combine

Function BenchmarkHistogramAggregator_Combine

pkg/traceql/engine_metrics_test.go:3110–3140  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

3108}
3109
3110func BenchmarkHistogramAggregator_Combine(b *testing.B) {
3111 // nolint:gosec // G115
3112 req := &tempopb.QueryRangeRequest{
3113 Start: uint64(time.Now().Add(-1 * time.Hour).UnixNano()),
3114 End: uint64(time.Now().UnixNano()),
3115 Step: uint64(15 * time.Second.Nanoseconds()),
3116 Exemplars: 100,
3117 }
3118 const seriesCount = 6
3119
3120 benchmarks := []struct {
3121 name string
3122 samplesCount int
3123 exemplarCount int
3124 }{
3125 {"Small", 10, 5},
3126 {"Medium", 100, 20},
3127 {"Large", 1000, 100},
3128 }
3129
3130 for _, bm := range benchmarks {
3131 b.Run(bm.name, func(b *testing.B) {
3132 series := generateTestTimeSeries(seriesCount, bm.samplesCount, bm.exemplarCount, req.Start, req.End)
3133
3134 for b.Loop() {
3135 agg := NewHistogramAggregator(req, []float64{0.5, 0.9, 0.99}, uint32(bm.exemplarCount)) // nolint: gosec // G115
3136 agg.Combine(series)
3137 }
3138 })
3139 }
3140}
3141
3142func BenchmarkHistogramAggregator_Results(b *testing.B) {
3143 // nolint:gosec // G115

Callers

nothing calls this directly

Calls 7

CombineMethod · 0.95
generateTestTimeSeriesFunction · 0.85
NewHistogramAggregatorFunction · 0.85
LoopMethod · 0.80
AddMethod · 0.65
NowMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected