Skip to content

Commit 45b2c4e

Browse files
Update MIGRATION.md
Split code blocks for better readability
1 parent ccde98b commit 45b2c4e

File tree

1 file changed

+57
-45
lines changed

1 file changed

+57
-45
lines changed

MIGRATION.md

Lines changed: 57 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ We've removed the following packages:
6262
For Browser SDKs you can import `BrowserTracing` from the SDK directly:
6363

6464
```js
65-
// Before (v7)
65+
// v7
6666
import * as Sentry from '@sentry/browser';
6767
import { BrowserTracing } from '@sentry/tracing';
6868

@@ -71,8 +71,9 @@ Sentry.init({
7171
tracesSampleRate: 1.0,
7272
integrations: [new BrowserTracing()],
7373
});
74-
75-
// After (v8)
74+
```
75+
```js
76+
// v8
7677
import * as Sentry from '@sentry/browser';
7778

7879
Sentry.init({
@@ -86,16 +87,17 @@ If you were importing `@sentry/tracing` for the side effect, you can now use `Se
8687
tracing extensions to the SDK. `addTracingExtensions` replaces the `addExtensionMethods` method from `@sentry/tracing`.
8788

8889
```js
89-
// Before (v7)
90+
// v7
9091
import * as Sentry from '@sentry/browser';
9192
import '@sentry/tracing';
9293

9394
Sentry.init({
9495
dsn: '__DSN__',
9596
tracesSampleRate: 1.0,
9697
});
97-
98-
// After (v8)
98+
```
99+
```js
100+
// v8
99101
import * as Sentry from '@sentry/browser';
100102

101103
Sentry.addTracingExtensions();
@@ -109,16 +111,17 @@ Sentry.init({
109111
For Node SDKs you no longer need the side effect import, you can remove all references to `@sentry/tracing`.
110112

111113
```js
112-
// Before (v7)
114+
// v7
113115
const Sentry = require('@sentry/node');
114116
require('@sentry/tracing');
115117

116118
Sentry.init({
117119
dsn: '__DSN__',
118120
tracesSampleRate: 1.0,
119121
});
120-
121-
// After (v8)
122+
```
123+
```js
124+
// v8
122125
const Sentry = require('@sentry/node');
123126

124127
Sentry.init({
@@ -134,10 +137,11 @@ package (`@sentry/integrations`) to `@sentry/browser` and `@sentry/node`. in add
134137
classes.
135138

136139
```js
137-
// Before (v7)
140+
// v7
138141
import { RewriteFrames } from '@sentry/integrations';
139-
140-
// After (v8)
142+
```
143+
```js
144+
// v8
141145
import { rewriteFramesIntegration } from '@sentry/browser';
142146
```
143147

@@ -303,10 +307,11 @@ The `getIntegration()` and `getIntegrationById()` have been removed entirely, se
303307
[below](./MIGRATION.md#deprecate-getintegration-and-getintegrationbyid).
304308

305309
```js
306-
// Before (v7)
310+
// v7
307311
const replay = Sentry.getIntegration(Replay);
308-
309-
// After (v8)
312+
```
313+
```js
314+
// v8
310315
const replay = getClient().getIntegrationByName('Replay');
311316
```
312317

@@ -326,13 +331,14 @@ details.
326331
For example for the Browser SDKs:
327332

328333
```ts
329-
// Before (v7)
334+
// v7
330335
Sentry.init({
331336
dsn: '__DSN__',
332337
integrations: [new Sentry.BrowserTracing({ tracingOrigins: ['localhost', 'example.com'] })],
333338
});
334-
335-
// After (v8)
339+
```
340+
```ts
341+
// v8
336342
Sentry.init({
337343
dsn: '__DSN__',
338344
integrations: [Sentry.browserTracingIntegration()],
@@ -345,23 +351,22 @@ Sentry.init({
345351
The SDKs now support metrics features without any additional configuration.
346352

347353
```ts
348-
// Before (v7)
349-
// Server (Node/Deno/Bun)
354+
// v7 - Server (Node/Deno/Bun)
350355
Sentry.init({
351356
dsn: '__DSN__',
352357
_experiments: {
353358
metricsAggregator: true,
354359
},
355360
});
356361

357-
// Before (v7)
358-
// Browser
362+
// v7 - Browser
359363
Sentry.init({
360364
dsn: '__DSN__',
361365
integrations: [Sentry.metricsAggregatorIntegration()],
362366
});
363-
364-
// After (v8)
367+
```
368+
```ts
369+
// v8
365370
Sentry.init({
366371
dsn: '__DSN__',
367372
});
@@ -373,14 +378,15 @@ In v7 we deprecated the `Severity` enum in favor of using the `SeverityLevel` ty
373378
this has been removed in v8. You should now use the `SeverityLevel` type directly.
374379

375380
```js
376-
// Before (v7)
381+
// v7
377382
import { Severity, SeverityLevel } from '@sentry/types';
378383

379384
const levelA = Severity.error;
380385

381386
const levelB: SeverityLevel = "error"
382-
383-
// After (v8)
387+
```
388+
```js
389+
// v8
384390
import { SeverityLevel } from '@sentry/types';
385391

386392
const levelA = "error" as SeverityLevel;
@@ -394,12 +400,13 @@ The top level `Sentry.configureScope` function has been removed. Instead, you sh
394400
to access and mutate the current scope.
395401

396402
```js
397-
// Before (v7)
403+
// v7
398404
Sentry.configureScope(scope => {
399405
scope.setTag('key', 'value');
400406
});
401-
402-
// After (v8)
407+
```
408+
```js
409+
// v8
403410
Sentry.getCurrentScope().setTag('key', 'value');
404411
```
405412

@@ -413,10 +420,11 @@ Internally, this class is now called `SentrySpan`, and it is no longer meant to
413420
In v8, we are removing the `spanStatusfromHttpCode` function in favor of `getSpanStatusFromHttpCode`.
414421

415422
```js
416-
// Before (v7)
423+
// v7
417424
const spanStatus = spanStatusfromHttpCode(200);
418-
419-
// After (v8)
425+
```
426+
```js
427+
// v8
420428
const spanStatus = getSpanStatusFromHttpCode(200);
421429
```
422430

@@ -425,13 +433,14 @@ const spanStatus = getSpanStatusFromHttpCode(200);
425433
In v8, we are removing the `addGlobalEventProcessor` function in favor of `addEventProcessor`.
426434

427435
```js
428-
// Before (v7)
436+
// v7
429437
addGlobalEventProcessor(event => {
430438
delete event.extra;
431439
return event;
432440
});
433-
434-
// After (v8)
441+
```
442+
```js
443+
// v8
435444
addEventProcessor(event => {
436445
delete event.extra;
437446
return event;
@@ -448,12 +457,13 @@ The `send` method on the `Transport` interface now always requires a `TransportM
448457
the promise. This means that the `void` return type is no longer allowed.
449458

450459
```ts
451-
// Before (v7)
460+
// v7
452461
interface Transport {
453462
send(event: Event): Promise<void | TransportMakeRequestResponse>;
454463
}
455-
456-
// After (v8)
464+
```
465+
```ts
466+
// v8
457467
interface Transport {
458468
send(event: Event): Promise<TransportMakeRequestResponse>;
459469
}
@@ -530,7 +540,7 @@ With version 8 of the Sentry Next.js SDK, the SDK will no longer support passing
530540
property to `withSentryConfig`. Please use the third argument of `withSentryConfig` to configure the SDK instead:
531541

532542
```ts
533-
// OLD
543+
// v7
534544
const nextConfig = {
535545
// Your Next.js options...
536546

@@ -542,8 +552,9 @@ const nextConfig = {
542552
module.exports = withSentryConfig(nextConfig, {
543553
// Your Sentry Webpack Plugin Options...
544554
});
545-
546-
// NEW
555+
```
556+
```ts
557+
// v8
547558
const nextConfig = {
548559
// Your Next.js options...
549560
};
@@ -597,7 +608,7 @@ a subset of [2.x options](https://www.npmjs.com/package/@sentry/vite-plugin/v/2.
597608
optional just like before but here's an example of using the new options.
598609

599610
```js
600-
// Before (v7):
611+
// v7
601612
sentrySvelteKit({
602613
sourceMapsUploadOptions: {
603614
org: process.env.SENTRY_ORG,
@@ -609,8 +620,9 @@ sentrySvelteKit({
609620
ignore: ['**/build/client/**/*']
610621
},
611622
}),
612-
613-
// After (v8):
623+
```
624+
```js
625+
// v8
614626
sentrySvelteKit({
615627
sourceMapsUploadOptions: {
616628
org: process.env.SENTRY_ORG,

0 commit comments

Comments
 (0)