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

Function SendTracesFor

pkg/ingest/testkafka/client.go:70–90  ·  view source on GitHub ↗

nolint: revive,unparam

(t *testing.T, ctx context.Context, client *kgo.Client, dur, interval time.Duration, encode encodingFn)

Source from the content-addressed store, hash-verified

68
69// nolint: revive,unparam
70func SendTracesFor(t *testing.T, ctx context.Context, client *kgo.Client, dur, interval time.Duration, encode encodingFn) []*kgo.Record {
71 ticker := time.NewTicker(interval)
72 defer ticker.Stop()
73
74 timer := time.NewTimer(dur)
75 defer timer.Stop()
76
77 producedRecords := make([]*kgo.Record, 0)
78
79 for {
80 select {
81 case <-ctx.Done(): // Exit the function if the context is done
82 return producedRecords
83 case <-timer.C: // Exit the function when the timer is done
84 return producedRecords
85 case <-ticker.C:
86 records := SendReq(ctx, t, client, encode, util.FakeTenantID)
87 producedRecords = append(producedRecords, records...)
88 }
89 }
90}
91
92func generateTraceID(t testing.TB) []byte {
93 traceID := make([]byte, 16)

Calls 3

SendReqFunction · 0.85
StopMethod · 0.65
DoneMethod · 0.65