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

Function TestQueryRangeExemplars

integration/api/query_range_test.go:56–515  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestQueryRangeExemplars(t *testing.T) {
57 util.RunIntegrationTests(t, util.TestHarnessConfig{
58 ConfigOverlay: configQueryRangeExemplars,
59 }, func(h *util.TempoHarness) {
60 h.WaitTracesWritable(t)
61
62 ticker := time.NewTicker(500 * time.Millisecond)
63 defer ticker.Stop()
64 timer := time.NewTimer(10 * time.Second)
65 defer timer.Stop()
66
67 tracesSent := 0
68
69 // send one batch every 500ms for 10 seconds
70 sendLoop:
71 for {
72 select {
73 case <-ticker.C:
74 require.NoError(t, h.WriteJaegerBatch(
75 util.MakeThriftBatchWithSpanCountAttributeAndName(
76 1, "my operation",
77 "res_val", "span_val",
78 "res_attr", "span_attr",
79 ), ""),
80 )
81 require.NoError(t, h.WriteJaegerBatch(
82 util.MakeThriftBatchWithSpanCountAttributeAndName(
83 1, "my operation",
84 "res_val2", "span_val2",
85 "res_attr", "span_attr",
86 ), ""),
87 )
88 require.NoError(t, h.WriteJaegerBatch(
89 util.MakeThriftBatchWithSpanCountAttributeAndName(
90 1, "operation with high cardinality",
91 uuid.New().String(), uuid.New().String(),
92 "res_high_cardinality", "span_high_cardinality",
93 ), ""),
94 )
95 tracesSent += 3
96 case <-timer.C:
97 break sendLoop
98 }
99 }
100
101 h.WaitTracesQueryable(t, tracesSent)
102
103 for _, exemplarsCase := range []struct {
104 name string
105 exemplars int
106 expectedExemplars int
107 }{
108 {
109 name: "default",
110 exemplars: 0,
111 expectedExemplars: 100, // if set to 0, then limits to 100
112 },
113 {

Callers

nothing calls this directly

Calls 15

SetDefaultsMethod · 0.95
RunIntegrationTestsFunction · 0.92
callQueryRangeFunction · 0.85
callInstantQueryFunction · 0.85
WaitTracesWritableMethod · 0.80
WriteJaegerBatchMethod · 0.80
WaitTracesQueryableMethod · 0.80
GetStringValueMethod · 0.80
APIClientHTTPMethod · 0.80
StopMethod · 0.65
MetricsQueryRangeMethod · 0.65

Tested by

no test coverage detected