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

Updte documentation for Telemetry WithSpan #29635

Closed
yasmin-aumeeruddy opened this issue Sep 12, 2024 · 1 comment
Closed

Updte documentation for Telemetry WithSpan #29635

yasmin-aumeeruddy opened this issue Sep 12, 2024 · 1 comment

Comments

@yasmin-aumeeruddy
Copy link
Member

This doc ought to have some sort of note to explain that internal methods cannot be annoted with @WithSpan

For example, a child span would not be created by doing this but users may expect it to do so:

@GET
@Path("/{id}")
@WithSpan("Parent")
public void parentSan(@PathParam("id") @SpanAttribute("Id") Long id) {
    // Call the child span method
    childSpan(url);
}

@WithSpan("Child Find By Id")
public void childSpan(URL url) {
    // Print the current span ID within the child span
    Span.current().setAttribute("Child Span ID", Span.current().getSpanContext().getSpanId());
    System.out.println("Child Span ID after parent scope: " + Span.current().getSpanContext().getSpanId());
    System.out.println("Child Trace ID after parent scope: " + Span.current().toString());
}
@yasmin-aumeeruddy
Copy link
Member Author

Docs issue: OpenLiberty/docs#7568

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant