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

Function newTestCombiner

modules/frontend/combiner/common_test.go:259–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257}
258
259func newTestCombiner() *genericCombiner[*tempopb.ServiceStats] {
260 count := 0
261
262 gc := &genericCombiner[*tempopb.ServiceStats]{
263 new: func() *tempopb.ServiceStats { return &tempopb.ServiceStats{} },
264 current: nil,
265 combine: func(_, _ *tempopb.ServiceStats, _ PipelineResponse) error {
266 count++
267 return nil
268 },
269 finalize: func(_ *tempopb.ServiceStats) (*tempopb.ServiceStats, error) {
270 return &tempopb.ServiceStats{
271 SpanCount: uint32(count),
272 ErrorCount: uint32(count),
273 }, nil
274 },
275 quit: func(_ *tempopb.ServiceStats) bool {
276 return false
277 },
278 diff: func(_ *tempopb.ServiceStats) (*tempopb.ServiceStats, error) {
279 return &tempopb.ServiceStats{
280 SpanCount: uint32(count),
281 ErrorCount: uint32(count),
282 }, nil
283 },
284 }
285 initHTTPCombiner(gc, api.MarshallingFormatJSON)
286 return gc
287}
288
289// Helper functions for creating test responses with different marshaling formats
290func toHTTPResponseWithFormat(t *testing.T, pb proto.Message, statusCode int, responseData any, format api.MarshallingFormat) PipelineResponse {

Callers 4

TestInitHttpCombinerFunction · 0.85
TestGenericCombinerFunction · 0.85

Calls 1

initHTTPCombinerFunction · 0.85

Tested by

no test coverage detected