Skip to content

Conversation

@mydea
Copy link
Member

@mydea mydea commented Aug 30, 2023

This re-implements the new performance APIs:

  • startActiveSpan
  • startSpan
  • getActiveSpan

In @sentry/node-experimental, where these delegate to OTEL under the hood.
I tried to make sure to have exactly the same APIs as we have for these functions without this. There are some caveats with this:

  • calling span.finish() may behave in unexpected ways - it is not supported to manually finish a span.
  • Calling scope.getSpan() will not work
  • Calling span.startSpan() will not work

Basically, only the top level exported methods work, nothing else.

@mydea mydea added Package: node Issues related to the Sentry Node SDK Package: otel-node labels Aug 30, 2023
@mydea mydea requested a review from AbhiPrasad August 30, 2023 11:57
@mydea mydea self-assigned this Aug 30, 2023
@mydea mydea force-pushed the fn/node-experimental-trace branch from ad8507a to 03f20f6 Compare September 1, 2023 08:17
@mydea mydea merged commit 67822fb into develop Sep 1, 2023
@mydea mydea deleted the fn/node-experimental-trace branch September 1, 2023 08:49
AbhiPrasad added a commit that referenced this pull request Sep 11, 2023
Based on #8911 and
convos in slack, it was brought up that we might need to expose a method
that works similar to `startSpan`, but that does not automatically
finish the span at the end of the callback.

This is necessary when you have event emitters (`res.once`) or similar.


```ts
Sentry.startSpanManual(ctx, (span, finish) => {
  // do something with span
  // when you're done, call finish()
  finish();
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Package: node Issues related to the Sentry Node SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants