Skip to content

feat(node-experimental): Implement new performance APIs #8911

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

Merged
merged 1 commit into from
Sep 1, 2023

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.

2 participants