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

Method PushSpans

modules/generator/generator.go:185–207  ·  view source on GitHub ↗
(ctx context.Context, req *tempopb.PushSpansRequest)

Source from the content-addressed store, hash-verified

183}
184
185func (g *Generator) PushSpans(ctx context.Context, req *tempopb.PushSpansRequest) (*tempopb.PushResponse, error) {
186 if g.readOnly.Load() {
187 return nil, ErrReadOnly
188 }
189
190 ctx, span := tracer.Start(ctx, "generator.PushSpans")
191 defer span.End()
192
193 instanceID, err := validation.ExtractValidTenantID(ctx)
194 if err != nil {
195 return nil, err
196 }
197 span.SetAttributes(attribute.String("instanceID", instanceID))
198
199 instance, err := g.getOrCreateInstance(instanceID)
200 if err != nil {
201 return nil, err
202 }
203
204 instance.pushSpans(ctx, req)
205
206 return &tempopb.PushResponse{}, nil
207}
208
209func (g *Generator) getOrCreateInstance(instanceID string) (*instance, error) {
210 // Fast path: check with read lock first

Callers

nothing calls this directly

Calls 5

getOrCreateInstanceMethod · 0.95
ExtractValidTenantIDFunction · 0.92
pushSpansMethod · 0.80
StartMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected