Skip to content

Creating new "child" traces in process #6427

Answered by jkwatson
joachimm asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure what's going wrong here, but one thing you can simplify is to use spanBuilder.setNoParent() rather than artificially constructing a parent for the span you're building.

so...

Span span = tracer.spanBuilder("download").setSpanKind(SpanKind.SERVER).setNoParent()
                        .addLink(parentSpanContext).startSpan();

I don't know if this will change anything, but it will at least simplify your code a bit, which might make it easier to track down what's going on.

It results in:

Tracer tracer = GlobalOpenTelemetry.getTracer("batches");

for (Batch batch : batches) {
                SpanContext parentSpanContext = Span.current().getSpanContext();
 
                Span s…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@joachimm
Comment options

Comment options

You must be logged in to vote
1 reply
@joachimm
Comment options

Answer selected by joachimm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants