Skip to content

Commit 6d9f140

Browse files
committed
docs: Add upgrade guide
1 parent 2c88eb9 commit 6d9f140

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Unreleased
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
6+
- [react] feat: Export `createReduxEnhancer` to log redux actions as breadcrumbs, and attach state as an extra. (#2717)
7+
- [tracing] feat: `Add @sentry/tracing` (#2719)
68

79
## 5.19.2
810

@@ -17,8 +19,6 @@
1719
- [tracing] fix: APM CDN bundle expose startTransaction (#2726)
1820
- [browser] fix: Correctly remove all event listeners (#2725)
1921
- [tracing] fix: Add manual `DOMStringList` typing (#2718)
20-
- [react] feat: Export `createReduxEnhancer` to log redux actions as breadcrumbs, and attach state as an extra. (#2717)
21-
- [tracing] feat: `Add @sentry/tracing` (#2719)
2222

2323
## 5.19.0
2424

packages/apm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919

2020
## General
2121

22+
Note: This package is deprecated in favour of `@sentry/tracing` and will be removed in a future major release. We are still
23+
publishing `@sentry/apm` packages for backwards compatibility.
24+
2225
This package contains extensions to the `@sentry/hub` to enable APM related functionality. It also provides integrations for Browser and Node that provide a good experience out of the box.

packages/tracing/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,55 @@
2020
## General
2121

2222
This package contains extensions to the `@sentry/hub` to enable Sentry AM related functionality. It also provides integrations for Browser and Node that provide a good experience out of the box.
23+
24+
## Migrating from @sentry/apm to @sentry/tracing
25+
26+
The `@sentry/tracing` package is the replacement to the `@sentry/apm` package. No functionality has changed between
27+
the packages, but there are some steps required for upgrade.
28+
29+
First, you must update your imports from the `Tracing` integration to the `BrowserTracing` integration.
30+
31+
```ts
32+
import * as Sentry from "@sentry/browser";
33+
import { Integrations } from "@sentry/tracing";
34+
35+
Sentry.init({
36+
integrations: [
37+
new Integrations.BrowserTracing({}),
38+
]
39+
})
40+
```
41+
42+
Next, if you were using the `beforeNavigate` option, the API has changed to this type:
43+
44+
```ts
45+
/**
46+
* beforeNavigate is called before a pageload/navigation transaction is created and allows for users
47+
* to set a custom transaction context.
48+
*
49+
* If undefined is returned, a pageload/navigation transaction will not be created.
50+
*/
51+
beforeNavigate(context: TransactionContext): TransactionContext | undefined;
52+
```
53+
54+
We removed the location argument, in favour of being able to see what the transaction context is on creation. You will
55+
have to access `window.location` yourself if you want to replicate that. In addition, if you return undefined in
56+
`beforeNavigate`, the transaction will not be created.
57+
58+
```ts
59+
import * as Sentry from "@sentry/browser";
60+
import { Integrations } from "@sentry/tracing";
61+
62+
Sentry.init({
63+
integrations: [
64+
new Integrations.BrowserTracing({
65+
beforeNavigate: (ctx) => {
66+
return {
67+
...ctx,
68+
name: getTransactionName(ctx.name, window.location)
69+
}
70+
}
71+
}),
72+
]
73+
})
74+
```

packages/tracing/src/browser/browsertracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface BrowserTracingOptions extends RequestInstrumentationOptions {
4747

4848
/**
4949
* beforeNavigate is called before a pageload/navigation transaction is created and allows for users
50-
* to set a custom navigation transaction name. Defaults behaviour is to return `window.location.pathname`.
50+
* to set custom transaction context. Defaults behaviour is to return `window.location.pathname`.
5151
*
5252
* If undefined is returned, a pageload/navigation transaction will not be created.
5353
*/

0 commit comments

Comments
 (0)