Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return error if span context was not found #11207

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (s *Scheduler) enqueueRequest(frontendContext context.Context, frontendAddr
// information, since that is a long-running request.
tracer := opentracing.GlobalTracer()
parentSpanContext, err := lokigrpc.GetParentSpanForRequest(tracer, msg)
if err != nil {
if err != nil && err != opentracing.ErrSpanContextNotFound {
return err
}

Expand Down
12 changes: 2 additions & 10 deletions pkg/util/httpgrpc/carrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ func GetParentSpanForHTTPRequest(tracer opentracing.Tracer, req *weaveworks_http
}

carrier := (*HeadersCarrier)(req)
extracted, err := tracer.Extract(opentracing.HTTPHeaders, carrier)
if err == opentracing.ErrSpanContextNotFound {
err = nil
}
return extracted, err
return tracer.Extract(opentracing.HTTPHeaders, carrier)
}

func GetParentSpanForQueryRequest(tracer opentracing.Tracer, req *queryrange.QueryRequest) (opentracing.SpanContext, error) {
Expand All @@ -52,11 +48,7 @@ func GetParentSpanForQueryRequest(tracer opentracing.Tracer, req *queryrange.Que
}

carrier := opentracing.TextMapCarrier(req.Metadata)
extracted, err := tracer.Extract(opentracing.TextMap, carrier)
if err == opentracing.ErrSpanContextNotFound {
err = nil
}
return extracted, err
return tracer.Extract(opentracing.TextMap, carrier)
}

func GetParentSpanForRequest(tracer opentracing.Tracer, req Request) (opentracing.SpanContext, error) {
Expand Down
Loading