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

Add "noparent" option to @WithSpan annotation #5837

Closed
lordpixel23 opened this issue Sep 17, 2023 · 1 comment
Closed

Add "noparent" option to @WithSpan annotation #5837

lordpixel23 opened this issue Sep 17, 2023 · 1 comment
Labels
Feature Request Suggest an idea for this project

Comments

@lordpixel23
Copy link

Is your feature request related to a problem? Please describe.

I have code which is annotated with @WithSpan. Sometimes I want to have a method create a new root span, i.e. to have no parent.

Describe the solution you'd like

Add an attribute to @WithSpan such as noParent=true or type=root or equivalent. This feels similar to how one can set other builder options via the annotation such as being able to set the Span Kind.

Describe alternatives you've considered
I can do this by writing the necessary manual tracing code to create a Span with the setNoParent option on the builder, with all the attendant try/finally scope management, exception capture and remember to call .end() etc. Instead of a simple annotation it ends up taking 10 lines of boilerplate code. OTOH maybe this is a sufficiently rare situation that this is an OK tradeoff.

@mateuszrzeszutek
Copy link
Member

Hey @lordpixel23 ,

There is already an open issue for this in the instrumentation project: open-telemetry/opentelemetry-java-instrumentation#1036
Please watch that one; I'll close this as a duplicate.

@mateuszrzeszutek mateuszrzeszutek closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Suggest an idea for this project
Projects
None yet
Development

No branches or pull requests

2 participants