Replies: 1 comment
-
Yes, that is still the way to go. We currently do not intend to change how spans can be made active. I know this sucks a bit in the browser but we want to be compatible with OTEL's API. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Edit: I just read #11582 which has a proposed solution but it still involves wrapping everything so I think my question is still valid.
I am developing an Angular app with NgRx that makes heavy use of observables. Because of the reactive architecture tracing was already a challenge in v7. To have manual control over which span is active and when it ends I used the
hub.pushScope()
method. E.g.:Everything after that would receive the correct parent span, e.g. http calls, and at the end I would finish the span and pop the scope.
Now with version 8 I can no longer do that. The migration doc says to use
startSpan
but I don't see that as a proper alternative for my use case. It would involve going back and forth between Promises and Observables:So how can I handle my transactions the same as before? There is
startSpanManual
which, as the name suggests, lets you end() your span manually, but it only stays active while inside the callback function. This is counter intuitive to me. Why does it become inactive before it ends? I assume the Sentry team wanted to prevent leaks from people forgetting to end() the spans.So how do I control the active span without being trapped in Sentry's function closure? Here is my workaround:
The inner promise from the callback only resolves once I call
span.end()
, making my span remain active for as long as I want. I know this can't be the intended way, that's why I'm here to discuss it.startSpan
orstartSpanManual
?Beta Was this translation helpful? Give feedback.
All reactions