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

Function TestLimitsPartialSuccess

integration/limits/limits_test.go:235–280  ·  integration/limits/limits_test.go::TestLimitsPartialSuccess
(t *testing.T)

Source from the content-addressed store, hash-verified

233}
234
235func TestLimitsPartialSuccess(t *testing.T) {
236 util.RunIntegrationTests(t, util.TestHarnessConfig{
237 ConfigOverlay: configIngestPartialSucess,
238 }, func(h *util.TempoHarness) {
239 h.WaitTracesWritable(t)
240 // make request
241 traceIDs := make([][]byte, 6)
242 for index := range traceIDs {
243 traceID := make([]byte, 16)
244 _, err := crand.Read(traceID)
245 require.NoError(t, err)
246 traceIDs[index] = traceID
247 }
248
249 // 3 traces with trace_too_large and 3 with no error
250 spanCountsByTrace := []int{1, 4, 1, 5, 6, 1}
251 trace := test.MakeReqWithMultipleTraceWithSpanCount(spanCountsByTrace, traceIDs)
252
253 // send traces to tempo
254 // partial success = no error
255 require.NoError(t, h.WriteTempoProtoTraces(trace, ""))
256
257 // wait for live store to ingest traces
258 h.WaitTracesQueryable(t, 3) // only 3 traces are small enough to be ingested
259
260 // query for the traces that didn't trigger an error
261 apiClient := h.APIClientHTTP("")
262 for i, count := range spanCountsByTrace {
263 if count == 1 {
264 result, err := apiClient.QueryTrace(tempoUtil.TraceIDToHexString(traceIDs[i]))
265 require.NoError(t, err)
266 assert.Equal(t, 1, len(result.ResourceSpans))
267 }
268 }
269
270 // test metrics
271 // 3 traces with trace_too_large each with 4+5+6 spans
272 liveStore := h.Services[util.ServiceLiveStoreZoneA]
273 err := liveStore.WaitSumMetricsWithOptions(e2e.Equals(15),
274 []string{"tempo_discarded_spans_total"},
275 e2e.WithLabelMatchers(labels.MustNewMatcher(labels.MatchEqual, "reason", "trace_too_large")),
276 e2e.WaitMissingMetrics,
277 )
278 require.NoError(t, err)
279 })
280}
281
282func TestQueryRateLimits(t *testing.T) {
283 util.RunIntegrationTests(t, util.TestHarnessConfig{

Callers

nothing calls this directly

Calls 9

WaitTracesWritableMethod · 0.80
WriteTempoProtoTracesMethod · 0.80
WaitTracesQueryableMethod · 0.80
APIClientHTTPMethod · 0.80
EqualsMethod · 0.80
ReadMethod · 0.65
QueryTraceMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected