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

Function TestFieldsAreCleared

tempodb/encoding/vparquet3/schema_test.go:65–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestFieldsAreCleared(t *testing.T) {
66 meta := backend.BlockMeta{
67 DedicatedColumns: test.MakeDedicatedColumns(),
68 }
69
70 traceID := []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}
71 complexTrace := ParquetTraceToTempopbTrace(&meta, fullyPopulatedTestTrace(traceID))
72 simpleTrace := &tempopb.Trace{
73 ResourceSpans: []*v1_trace.ResourceSpans{
74 {
75 Resource: &v1_resource.Resource{
76 Attributes: []*v1.KeyValue{
77 {Key: "i", Value: &v1.AnyValue{Value: &v1.AnyValue_IntValue{IntValue: 123}}},
78 },
79 },
80 ScopeSpans: []*v1_trace.ScopeSpans{
81 {
82 Scope: &v1.InstrumentationScope{},
83 Spans: []*v1_trace.Span{
84 {
85 TraceId: traceID,
86 Status: &v1_trace.Status{},
87 Attributes: []*v1.KeyValue{
88 {
89 Key: "a",
90 Value: &v1.AnyValue{
91 Value: &v1.AnyValue_StringValue{StringValue: "b"},
92 },
93 },
94 },
95 Events: []*v1_trace.Span_Event{
96 {
97 // An attribute of every type
98 Attributes: []*v1.KeyValue{
99 // String
100 {Key: "i", Value: &v1.AnyValue{Value: &v1.AnyValue_IntValue{IntValue: 123}}},
101 },
102 },
103 },
104 },
105 },
106 },
107 },
108 },
109 },
110 }
111
112 // first convert a trace that sets all fields and then convert
113 // a minimal trace to make sure nothing bleeds through
114 tr := &Trace{}
115 _, _ = traceToParquet(&meta, traceID, complexTrace, tr)
116
117 parqTr, _ := traceToParquet(&meta, traceID, simpleTrace, tr)
118 actualTrace := ParquetTraceToTempopbTrace(&meta, parqTr)
119 require.Equal(t, simpleTrace, actualTrace)
120}
121
122func TestTraceToParquet(t *testing.T) {

Callers

nothing calls this directly

Calls 5

MakeDedicatedColumnsFunction · 0.92
fullyPopulatedTestTraceFunction · 0.70
traceToParquetFunction · 0.70
EqualMethod · 0.45

Tested by

no test coverage detected