(ctx context.Context, req *tempopb.PushSpansRequest)
| 183 | } |
| 184 | |
| 185 | func (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 | |
| 209 | func (g *Generator) getOrCreateInstance(instanceID string) (*instance, error) { |
| 210 | // Fast path: check with read lock first |
nothing calls this directly
no test coverage detected