|
4 | 4 |
|
5 | 5 | - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
|
6 | 6 |
|
| 7 | +## 7.69.0 |
| 8 | + |
| 9 | +- **New Performance APIs** |
| 10 | + - feat: Update span performance API names (#8971) |
| 11 | + - feat(core): Introduce startSpanManual (#8913) |
| 12 | + |
| 13 | +This release introduces a new set of top level APIs for the Performance Monitoring SDKs. These aim to simplify creating spans and reduce the boilerplate needed for performance instrumentation. The three new methods introduced are `Sentry.startSpan`, `Sentry.startInactiveSpan`, and `Sentry.startSpanManual`. These methods are available in the browser and node SDKs. |
| 14 | + |
| 15 | +`Sentry.startSpan` wraps a callback in a span. The span is automatically finished when the callback returns. This is the recommended way to create spans. |
| 16 | + |
| 17 | +```js |
| 18 | +// Start a span that tracks the duration of expensiveFunction |
| 19 | +const result = Sentry.startSpan({ name: 'important function' }, () => { |
| 20 | + return expensiveFunction(); |
| 21 | +}); |
| 22 | + |
| 23 | +// You can also mutate the span wrapping the callback to set data or status |
| 24 | +Sentry.startSpan({ name: 'important function' }, (span) => { |
| 25 | + // span is undefined if performance monitoring is turned off or if |
| 26 | + // the span was not sampled. This is done to reduce overhead. |
| 27 | + span?.setData('version', '1.0.0'); |
| 28 | + return expensiveFunction(); |
| 29 | +}); |
| 30 | +``` |
| 31 | +
|
| 32 | +If you don't want the span to finish when the callback returns, use `Sentry.startSpanManual` to control when the span is finished. This is useful for event emitters or similar. |
| 33 | +
|
| 34 | +```js |
| 35 | +// Start a span that tracks the duration of middleware |
| 36 | +function middleware(_req, res, next) { |
| 37 | + return Sentry.startSpanManual({ name: 'middleware' }, (span, finish) => { |
| 38 | + res.once('finish', () => { |
| 39 | + span?.setHttpStatus(res.status); |
| 40 | + finish(); |
| 41 | + }); |
| 42 | + return next(); |
| 43 | + }); |
| 44 | +} |
| 45 | +``` |
| 46 | +
|
| 47 | +`Sentry.startSpan` and `Sentry.startSpanManual` create a span and make it active for the duration of the callback. If you want to create a span without making it active, use `Sentry.startInactiveSpan`. This is useful for creating parallel spans that are not related to each other. |
| 48 | +
|
| 49 | +```js |
| 50 | +const span1 = Sentry.startInactiveSpan({ name: 'span1' }); |
| 51 | + |
| 52 | +someWork(); |
| 53 | + |
| 54 | +const span2 = Sentry.startInactiveSpan({ name: 'span2' }); |
| 55 | + |
| 56 | +moreWork(); |
| 57 | + |
| 58 | +const span3 = Sentry.startInactiveSpan({ name: 'span3' }); |
| 59 | + |
| 60 | +evenMoreWork(); |
| 61 | + |
| 62 | +span1?.finish(); |
| 63 | +span2?.finish(); |
| 64 | +span3?.finish(); |
| 65 | +``` |
| 66 | +
|
| 67 | +- feat(core): Export `BeforeFinishCallback` type (#8999) |
| 68 | +- feat(eslint): Enforce that ts-expect-error is used (#8987) |
| 69 | +- feat(integration): Ensure `LinkedErrors` integration runs before all event processors (#8956) |
| 70 | +- feat(node-experimental): Keep breadcrumbs on transaction (#8967) |
| 71 | +- feat(redux): Add 'attachReduxState' option (#8953) |
| 72 | +- feat(remix): Accept `org`, `project` and `url` as args to upload script (#8985) |
| 73 | +- fix(utils): uuidv4 fix for cloudflare (#8968) |
| 74 | +- fix(core): Always use event message and exception values for `ignoreErrors` (#8986) |
| 75 | +- fix(nextjs): Add new potential location for Next.js request AsyncLocalStorage (#9006) |
| 76 | +- fix(node-experimental): Ensure we only create HTTP spans when outgoing (#8966) |
| 77 | +- fix(node-experimental): Ignore OPTIONS & HEAD requests (#9001) |
| 78 | +- fix(node-experimental): Ignore outgoing Sentry requests (#8994) |
| 79 | +- fix(node-experimental): Require parent span for `pg` spans (#8993) |
| 80 | +- fix(node-experimental): Use Sentry logger as Otel logger (#8960) |
| 81 | +- fix(node-otel): Refactor OTEL span reference cleanup (#9000) |
| 82 | +- fix(react): Switch to props in `useRoutes` (#8998) |
| 83 | +- fix(remix): Add `glob` to Remix SDK dependencies. (#8963) |
| 84 | +- fix(replay): Ensure `handleRecordingEmit` aborts when event is not added (#8938) |
| 85 | +- fix(replay): Fully stop & restart session when it expires (#8834) |
| 86 | +
|
| 87 | +Work in this release contributed by @malay44. Thank you for your contribution! |
| 88 | +
|
7 | 89 | ## 7.68.0
|
8 | 90 |
|
9 | 91 | - feat(browser): Add `BroadcastChannel` and `SharedWorker` to TryCatch EventTargets (#8943)
|
|
0 commit comments