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

Function TestCountSpans

tempodb/encoding/vparquet3/compactor_test.go:150–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

148}
149
150func TestCountSpans(t *testing.T) {
151 // It causes high mem usage when batchSize and spansEach are too big (> 500)
152 batchSize := 300 + rand.Intn(25)
153 spansEach := 250 + rand.Intn(25)
154
155 rootSpan := "foo"
156 rootService := "bar"
157
158 sch := parquet.SchemaOf(new(Trace))
159 traceID := make([]byte, 16)
160 _, err := crand.Read(traceID)
161 require.NoError(t, err)
162
163 // make Trace and convert to parquet.Row
164 tr := test.MakeTraceWithSpanCount(batchSize, spansEach, traceID)
165 trp, connected := traceToParquet(&backend.BlockMeta{}, traceID, tr, nil)
166 require.False(t, connected)
167 trp.RootServiceName = rootService
168 trp.RootSpanName = rootSpan
169 row := sch.Deconstruct(nil, trp)
170
171 // count spans for generated rows.
172 tID, rootSpanName, rootServiceName, spans := countSpans(sch, row)
173 require.Equal(t, tID, tempoUtil.TraceIDToHexString(traceID))
174 require.Equal(t, spans, batchSize*spansEach)
175 require.Equal(t, rootSpan, rootSpanName)
176 require.Equal(t, rootService, rootServiceName)
177}
178
179func TestCompact(t *testing.T) {
180 rawR, rawW, _, err := local.New(&local.Config{

Callers

nothing calls this directly

Calls 5

MakeTraceWithSpanCountFunction · 0.92
traceToParquetFunction · 0.70
countSpansFunction · 0.70
ReadMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected