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

Method SendTraces

modules/distributor/forwarder.go:81–96  ·  view source on GitHub ↗

SendTraces queues up traces to be sent to the metrics-generators

(ctx context.Context, tenantID string, keys []uint32, traces []*rebatchedTrace)

Source from the content-addressed store, hash-verified

79
80// SendTraces queues up traces to be sent to the metrics-generators
81func (f *generatorForwarder) SendTraces(ctx context.Context, tenantID string, keys []uint32, traces []*rebatchedTrace) {
82 select {
83 case <-f.shutdown:
84 return
85 default:
86 }
87
88 q := f.getOrCreateQueue(tenantID)
89 err := q.Push(ctx, &request{tenantID: tenantID, keys: keys, traces: traces, noGenerateMetrics: generator.ExtractNoGenerateMetrics(ctx)})
90 if err != nil {
91 _ = level.Error(f.logger).Log("msg", "failed to push traces to queue", "tenant", tenantID, "err", err)
92 metricForwarderPushesFailures.WithLabelValues(tenantID).Inc()
93 }
94
95 metricForwarderPushes.WithLabelValues(tenantID).Inc()
96}
97
98// getQueueConfig returns queueSize and workerCount for the given tenant
99func (f *generatorForwarder) getQueueConfig(tenantID string) (queueSize, workerCount int) {

Callers 3

TestForwarderFunction · 0.80
TestForwarder_shutdownFunction · 0.80
pushTracesToGeneratorMethod · 0.80

Calls 6

getOrCreateQueueMethod · 0.95
ExtractNoGenerateMetricsFunction · 0.92
LogMethod · 0.65
ErrorMethod · 0.65
IncMethod · 0.65
PushMethod · 0.45

Tested by 2

TestForwarderFunction · 0.64
TestForwarder_shutdownFunction · 0.64