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

Function TestSortTrace

pkg/model/trace/sort_test.go:13–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestSortTrace(t *testing.T) {
14 tests := []struct {
15 input *tempopb.Trace
16 expected *tempopb.Trace
17 }{
18 {
19 input: &tempopb.Trace{},
20 expected: &tempopb.Trace{},
21 },
22 {
23 input: testTraceForSorting(),
24 expected: &tempopb.Trace{
25 ResourceSpans: []*tracev1.ResourceSpans{
26 {
27 Resource: &resourcev1.Resource{
28 Attributes: []*commonv1.KeyValue{
29 {Key: "a", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VA"}}},
30 {Key: "b", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VB"}}},
31 },
32 },
33 ScopeSpans: []*tracev1.ScopeSpans{
34 {
35 Scope: &commonv1.InstrumentationScope{
36 Name: "scope2",
37 Attributes: []*commonv1.KeyValue{
38 {Key: "a", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VA"}}},
39 {Key: "b", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VB"}}},
40 },
41 },
42 Spans: []*tracev1.Span{
43 {
44 StartTimeUnixNano: 1,
45 Attributes: []*commonv1.KeyValue{
46 {Key: "a", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VA"}}},
47 {Key: "b", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VB"}}},
48 },
49 Events: []*tracev1.Span_Event{
50 {
51 TimeUnixNano: 11,
52 Name: "eventA2",
53 Attributes: []*commonv1.KeyValue{
54 {Key: "a", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VA"}}},
55 {Key: "b", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VB"}}},
56 },
57 },
58 {
59 TimeUnixNano: 21,
60 Name: "eventB2",
61 Attributes: []*commonv1.KeyValue{
62 {Key: "a", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VA"}}},
63 {Key: "b", Value: &commonv1.AnyValue{Value: &commonv1.AnyValue_StringValue{StringValue: "VB"}}},
64 },
65 },
66 },
67 Links: []*tracev1.Span_Link{
68 {
69 TraceId: []byte{0x11},
70 SpanId: []byte{0x11},

Callers

nothing calls this directly

Calls 3

testTraceForSortingFunction · 0.85
SortTraceAndAttributesFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected