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

Function SendReqWithOpts

pkg/ingest/testkafka/client.go:49–63  ·  view source on GitHub ↗

nolint: revive

(ctx context.Context, t testing.TB, client *kgo.Client, encode encodingFn, opts ReqOpts)

Source from the content-addressed store, hash-verified

47
48// nolint: revive
49func SendReqWithOpts(ctx context.Context, t testing.TB, client *kgo.Client, encode encodingFn, opts ReqOpts) []*kgo.Record {
50 traceID := generateTraceID(t)
51 opts.applyDefaults()
52
53 startTime := uint64(opts.Time.UnixNano())
54 endTime := uint64(opts.Time.Add(time.Second).UnixNano())
55 req := test.MakePushBytesRequest(t, 10, traceID, startTime, endTime)
56 records, err := encode(opts.Partition, opts.TenantID, req, 1_000_000)
57 require.NoError(t, err)
58
59 res := client.ProduceSync(ctx, records...)
60 require.NoError(t, res.FirstErr())
61
62 return records
63}
64
65func SendReq(ctx context.Context, t testing.TB, client *kgo.Client, encode encodingFn, tenantID string) []*kgo.Record {
66 return SendReqWithOpts(ctx, t, client, encode, ReqOpts{Partition: 0, Time: time.Now(), TenantID: tenantID})

Callers 3

SendReqFunction · 0.85

Calls 5

MakePushBytesRequestFunction · 0.92
applyDefaultsMethod · 0.80
ProduceSyncMethod · 0.80
generateTraceIDFunction · 0.70
AddMethod · 0.65