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

Function TestNaiveQueryRangeCombine

integration/api/combine_test.go:178–320  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

176}
177
178func TestNaiveQueryRangeCombine(t *testing.T) {
179 tests := []struct {
180 name string
181 rNew *tempopb.QueryRangeResponse
182 rInto *tempopb.QueryRangeResponse
183 expected *tempopb.QueryRangeResponse
184 }{
185 {
186 name: "combine series with different labels",
187 rNew: &tempopb.QueryRangeResponse{
188 Series: []*tempopb.TimeSeries{
189 {
190 Labels: []v1.KeyValue{
191 {Key: "foo", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "bar"}}},
192 },
193 Samples: []tempopb.Sample{{TimestampMs: 1000, Value: 1.0}},
194 },
195 },
196 Metrics: &tempopb.SearchMetrics{
197 InspectedBytes: 100,
198 CompletedJobs: 1,
199 InspectedTraces: 10,
200 InspectedSpans: 50,
201 },
202 },
203 rInto: &tempopb.QueryRangeResponse{
204 Series: []*tempopb.TimeSeries{
205 {
206 Labels: []v1.KeyValue{
207 {Key: "baz", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "qux"}}},
208 },
209 Samples: []tempopb.Sample{{TimestampMs: 2000, Value: 2.0}},
210 },
211 },
212 Metrics: &tempopb.SearchMetrics{
213 InspectedBytes: 50,
214 CompletedJobs: 1,
215 InspectedTraces: 5,
216 InspectedSpans: 25,
217 },
218 },
219 expected: &tempopb.QueryRangeResponse{
220 Series: []*tempopb.TimeSeries{
221 {
222 Labels: []v1.KeyValue{
223 {Key: "baz", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "qux"}}},
224 },
225 Samples: []tempopb.Sample{{TimestampMs: 2000, Value: 2.0}},
226 },
227 {
228 Labels: []v1.KeyValue{
229 {Key: "foo", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "bar"}}},
230 },
231 Samples: []tempopb.Sample{{TimestampMs: 1000, Value: 1.0}},
232 },
233 },
234 Metrics: &tempopb.SearchMetrics{
235 InspectedBytes: 150,

Callers

nothing calls this directly

Calls 5

naiveQueryRangeCombineFunction · 0.85
keyFromLabelsFunction · 0.85
LenMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected