Skip to content

Commit 3967cf9

Browse files
committed
Add "Session Changes" section to Migration docs
1 parent e27e211 commit 3967cf9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

MIGRATION.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,32 @@ changes in v7. They will be removed in the next major release which is why we st
292292
corresponding string literals. Here's how to adjust [`Severity`](#severity-severitylevel-and-severitylevels) and
293293
[`SpanStatus`](#spanstatus).
294294

295+
## Session Changes
296+
297+
Note: These changes are not relevant for the majority of Sentry users but if you are building an
298+
SDK on top of the Javascript SDK, you might need to make some adaptions.
299+
The internal `Session` class was refactored and replaced with a more functional approach in
300+
[#5054](https://github.com/getsentry/sentry-javascript/pull/5054).
301+
Instead of the class, we now export a `Session` interface from `@sentry/types` and three utility functions
302+
to create and update a `Session` object from `@sentry/hub`.
303+
This short example shows what has changed and how to deal with the new functions:
304+
305+
```js
306+
// New in v7:
307+
import { makeSession, updateSession, closeSession } from '@sentry/hub';
308+
309+
const session = makeSession({ release: 'v1.0' });
310+
updateSession(session, { environment: 'prod' });
311+
closeSession(session, 'ok');
312+
313+
// Before:
314+
import { Session } from '@sentry/hub';
315+
316+
const session = new Session({ release: 'v1.0' });
317+
session.update({ environment: 'prod' });
318+
session.close('ok');
319+
```
320+
295321
## General API Changes
296322

297323
For our efforts to reduce bundle size of the SDK we had to remove and refactor parts of the package which introduced a few changes to the API:
@@ -313,8 +339,11 @@ For our efforts to reduce bundle size of the SDK we had to remove and refactor p
313339
- Rename `UserAgent` integration to `HttpContext`. (see [#5027](https://github.com/getsentry/sentry-javascript/pull/5027))
314340
- Remove `SDK_NAME` export from `@sentry/browser`, `@sentry/node`, `@sentry/tracing` and `@sentry/vue` packages.
315341
- Removed `eventStatusFromHttpCode` to save on bundle size.
342+
<<<<<<< HEAD
316343
- Replace `BrowserTracing` `maxTransactionDuration` option with `finalTimeout` option
317344
- Replace `Session` class with a session object and functions (see [#5054](https://github.com/getsentry/sentry-javascript/pull/5054)).
345+
=======
346+
>>>>>>> 5c81e32c4 (Add "Session Changes" section to Migration docs)
318347
319348
## Sentry Angular SDK Changes
320349

0 commit comments

Comments
 (0)