-
Notifications
You must be signed in to change notification settings - Fork 306
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 the ability to safely get the root span from the tracer #725
Comments
This is unfortunately not something we can support since it would break for asynchronous workflows. I will close this for now, but please feel free to re-open if you have a use case where using span hooks doesn't work. |
I want to addTags to localRootSpan (similar to https://docs.datadoghq.com/tracing/setup_overview/custom_instrumentation/java/#set-tags--errors-on-a-root-span-from-a-child-span in java) I don't have access to express |
@mintuhouse Unfortunately there is no official way right now. You can grab the root on the span context of any span within a trace with |
Hi folks, just chiming in about our use case. We are using Next.js and adding an |
I'm trying to do the same as the OP, add tags to the root span. But I'm unfamiliar with span hooks, so it's possible that would work for my use case. Can someone direct me to docs on span hooks, or an example of how that would work? EDIT: I found it. |
It would be very helpful to be able to get the root span of a request safely from the tracer object via a public function/getter. Currently to do this I need to use a private property (code provided by @rochdev):
I propose something like the following:
This would make it much easier to add tags and information to the root of a request without having to communicate via the req object and/or plugin hooks.
The text was updated successfully, but these errors were encountered: