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

Function groupTraceQLRunner

tempodb/tempodb_search_test.go:343–538  ·  view source on GitHub ↗
(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSearchMetadata, _, _ []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock)

Source from the content-addressed store, hash-verified

341}
342
343func groupTraceQLRunner(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSearchMetadata, _, _ []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock) {
344 ctx := context.Background()
345 e := traceql.NewEngine()
346
347 type test struct {
348 req *tempopb.SearchRequest
349 expected []*tempopb.TraceSearchMetadata
350 }
351
352 searchesThatMatch := []*test{
353 {
354 req: &tempopb.SearchRequest{Query: "{} | by(span.foo) | count() = 2"},
355 expected: []*tempopb.TraceSearchMetadata{
356 {
357 SpanSets: []*tempopb.SpanSet{
358 // Spanset for value
359 {
360 Spans: []*tempopb.Span{
361 {
362 SpanID: "0000000000010203",
363 StartTimeUnixNano: 1000000000000,
364 DurationNanos: 1000000000,
365 Name: "",
366 Attributes: []*v1_common.KeyValue{
367 {Key: "foo", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_StringValue{StringValue: "Bar"}}},
368 },
369 },
370 {
371 SpanID: "0000000000040506",
372 StartTimeUnixNano: 1000000000000,
373 DurationNanos: 2000000000,
374 Name: "",
375 Attributes: []*v1_common.KeyValue{
376 {Key: "foo", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_StringValue{StringValue: "Bar"}}},
377 },
378 },
379 },
380 Matched: 2,
381 Attributes: []*v1_common.KeyValue{
382 {Key: "by(span.foo)", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_StringValue{StringValue: "Bar"}}},
383 {Key: "count()", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_IntValue{IntValue: 2}}},
384 },
385 },
386 // Spanset for nil
387 {
388 Spans: []*tempopb.Span{
389 {
390 SpanID: "0000000000070809",
391 StartTimeUnixNano: 1000000000000,
392 DurationNanos: 1000000000,
393 Name: "",
394 Attributes: nil,
395 },
396 {
397 SpanID: "0000000000000000",
398 StartTimeUnixNano: 1000000000000,
399 DurationNanos: 1000000000,
400 Name: "",

Callers

nothing calls this directly

Calls 7

ExecuteSearchMethod · 0.95
NewEngineFunction · 0.92
NewSpansetFetcherWrapperFunction · 0.92
DefaultSearchOptionsFunction · 0.92
actualForExpectedMetaFunction · 0.85
FetchMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected