-
Notifications
You must be signed in to change notification settings - Fork 780
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
Root Activity creation is not supported (in presence of active parent) #984
Comments
cc: @rajkumar-rangaraj |
@rajkumar-rangaraj Can you confirm if this is addressed? |
Yes @cijothomas, this part is fixed in tracer shim. PR #994 |
I've created a sample implementation for that workaround: |
+1 on this request. Just a simple helper or an override to indicate “forceNew” will help. We are trying to stitch async workflows using trace links in our services |
Tagging with need-runtime-change as this likely needs support from DS. |
+1 on this request as I am having to do a similar workaround here in this sample: |
Describe your environment. Describe any aspect of your environment relevant to the problem:
Steps to reproduce.
OTel API spec requires a method that create a root span
Implementations MUST provide an option to create a Span as a root span
There is no option to force .NET Activity to be root in the presence of
Activity.Current
It seems to be an edge-case scenario: we fork current execution and link
Activity.Current
rather than creating a child of it.Below is a workaround for this issue.
What is the expected behavior?
There should be a way to force root Activity creation without hacks.
There should be a way to restore original context after forced root is gone.
What is the actual behavior?
There is no API to force root creation - you have to provide the fake new context to force it. After new root is gone, Current needs to be manually restored to
parent
I'm creating this issue to discuss whether OTel or .NET should support this scenario.
On the .NET side, it should be fine to ship it in the future release (the change would be controversial and not critical enough).
This scenario is a real-world case from one of the MS internal teams.
Can we support this on OTel side in the meantime?
one option is to support it through Span API: implement
Tracer
extension methodStartRootSpan
and make sure Current is captured/restored. This will force instrumentation to use Span API on top of Activity.another options to support it thought
ActivitySource
extension method, but then there is no straightforward way to restoreCurrent
after newRoot ends and only possible if Activity would capture active context (but not parent) before is starts and restore it on dispose.The text was updated successfully, but these errors were encountered: