Skip to content

Tracer manual context propagation Javadoc example does not compile #8568

Description

@thswlsqls

Describe the bug

The "manual context propagation" example in the Tracer class Javadoc does not compile when copied as-is.

Steps to reproduce

Copy the void doWork(Span parent) example from the Tracer Javadoc into a source file.

What did you expect to see?

A compilable example, like the sibling SpanBuilder Javadoc which uses .setParent(Context.current().with(parent)).

What did you see instead?

Two compile errors in Tracer (api/all/src/main/java/io/opentelemetry/api/trace/Tracer.java, around line 47):

  • The call chain is missing the leading . before setParent(parent).
  • setParent(parent) passes a Span, but SpanBuilder.setParent only accepts a Context; there is no Span overload.

What version and what artifacts are you using?

Artifacts: opentelemetry-api
Version: main @ 4d974ba
How did you reference these artifacts? N/A

Environment

Compiler: Temurin 21
OS: N/A

Additional context

The sibling SpanBuilder example (same package) already uses the correct idiom; aligning Tracer with it fixes both errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions