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

Method ConsumeTraces

modules/distributor/receiver/shim.go:345–374  ·  view source on GitHub ↗

ConsumeTraces implements consumer.Traces

(ctx context.Context, td ptrace.Traces)

Source from the content-addressed store, hash-verified

343
344// ConsumeTraces implements consumer.Traces
345func (r *receiversShim) ConsumeTraces(ctx context.Context, td ptrace.Traces) error {
346 ctx, span := tracer.Start(ctx, "distributor.ConsumeTraces")
347 defer span.End()
348
349 tenant, tenantErr := user.ExtractOrgID(ctx)
350 if tenantErr == nil {
351 span.SetAttributes(attribute.String("orgID", tenant))
352 }
353
354 var err error
355
356 start := time.Now()
357 _, err = r.pusher.PushTraces(ctx, td)
358 metricPushDuration.Observe(time.Since(start).Seconds())
359 if err != nil {
360 if tenantErr == nil {
361 r.logger.Log("msg", "pusher failed to consume trace data", "tenant", tenant, "err", err)
362 } else {
363 r.logger.Log("msg", "pusher failed to consume trace data", "err", err)
364 }
365 span.SetStatus(otelcodes.Error, err.Error())
366 retryInfoEnabled, e := r.pusher.RetryInfoEnabled(ctx)
367 if e != nil {
368 return e
369 }
370 err = wrapErrorIfRetryable(err, r.retryDelay, retryInfoEnabled)
371 }
372
373 return err
374}
375
376// GetExtensions implements component.Host
377func (r *receiversShim) GetExtensions() map[component.ID]component.Component {

Callers 1

TestShim_integrationFunction · 0.45

Calls 9

wrapErrorIfRetryableFunction · 0.85
StartMethod · 0.65
NowMethod · 0.65
PushTracesMethod · 0.65
ObserveMethod · 0.65
LogMethod · 0.65
ErrorMethod · 0.65
RetryInfoEnabledMethod · 0.65
StringMethod · 0.45

Tested by 1

TestShim_integrationFunction · 0.36