-
Notifications
You must be signed in to change notification settings - Fork 446
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
How to remove active span and stop implicit child spans for a code path? #1911
Comments
Setting invalid didn't seem to work, |
Please clarify what are you trying to achieve - Make a Span active, and then make it inactive. Why do you want to make it active at first place in that case. You can create multiple spans child of root as below without making them active. auto span1 = tracer->StartSpan("span 1");
auto span2 = tracer->StartSpan("span 2");
...
..
span2->End();
..
span1->End(); |
Our application needs a way to 'suspend' or 'pause' spans, and then create completely unrelated spans... hence, the other issues I raised related to storing spans/scopes in maps. To support that we need a way to set ActiveSpan to 'null' or 'invalid' or something like that and start afresh... and from the map, resume a span by setting it as Active again. |
@VivekSubr - The implicit context management (using Context API) is not designed to handle these various mentioned stages of Spans - start, pause, resume , and stop. You can't remove the Span from context before it's logical completion, and replace any other span. Or cleanup the context in between. I would advice you not to use the implicit context management for your scenario, and instead directly pass the parent of span as an argument while it's creation. |
okay, then it's up to application then. |
Just wanted to comment this is really annoying not being able to do this. I have a client where it will lazily create a connection to the server. I want to create a separate, isolated span for the lifetime of the connection, and not have it be related to the trace of the individual request being made that happens to initiate the connection creation. This happens several levels deep in my application that includes sqlite extensions. So there's basically 0 way to pass the lifetime manually |
The java implementation seems to have a way to do this: open-telemetry/opentelemetry-java#1717
I'm looking for some way to clear the ActiveSpan, without having it destroyed, such that any new start spans won't be the child of it.
The text was updated successfully, but these errors were encountered: