@@ -62,7 +62,7 @@ We've removed the following packages:
62
62
For Browser SDKs you can import ` BrowserTracing ` from the SDK directly:
63
63
64
64
``` js
65
- // Before (v7)
65
+ // v7
66
66
import * as Sentry from ' @sentry/browser' ;
67
67
import { BrowserTracing } from ' @sentry/tracing' ;
68
68
@@ -71,8 +71,9 @@ Sentry.init({
71
71
tracesSampleRate: 1.0 ,
72
72
integrations: [new BrowserTracing ()],
73
73
});
74
-
75
- // After (v8)
74
+ ```
75
+ ``` js
76
+ // v8
76
77
import * as Sentry from ' @sentry/browser' ;
77
78
78
79
Sentry .init ({
@@ -86,16 +87,17 @@ If you were importing `@sentry/tracing` for the side effect, you can now use `Se
86
87
tracing extensions to the SDK. ` addTracingExtensions ` replaces the ` addExtensionMethods ` method from ` @sentry/tracing ` .
87
88
88
89
``` js
89
- // Before (v7)
90
+ // v7
90
91
import * as Sentry from ' @sentry/browser' ;
91
92
import ' @sentry/tracing' ;
92
93
93
94
Sentry .init ({
94
95
dsn: ' __DSN__' ,
95
96
tracesSampleRate: 1.0 ,
96
97
});
97
-
98
- // After (v8)
98
+ ```
99
+ ``` js
100
+ // v8
99
101
import * as Sentry from ' @sentry/browser' ;
100
102
101
103
Sentry .addTracingExtensions ();
@@ -109,16 +111,17 @@ Sentry.init({
109
111
For Node SDKs you no longer need the side effect import, you can remove all references to ` @sentry/tracing ` .
110
112
111
113
``` js
112
- // Before (v7)
114
+ // v7
113
115
const Sentry = require (' @sentry/node' );
114
116
require (' @sentry/tracing' );
115
117
116
118
Sentry .init ({
117
119
dsn: ' __DSN__' ,
118
120
tracesSampleRate: 1.0 ,
119
121
});
120
-
121
- // After (v8)
122
+ ```
123
+ ``` js
124
+ // v8
122
125
const Sentry = require (' @sentry/node' );
123
126
124
127
Sentry .init ({
@@ -134,10 +137,11 @@ package (`@sentry/integrations`) to `@sentry/browser` and `@sentry/node`. in add
134
137
classes.
135
138
136
139
``` js
137
- // Before (v7)
140
+ // v7
138
141
import { RewriteFrames } from ' @sentry/integrations' ;
139
-
140
- // After (v8)
142
+ ```
143
+ ``` js
144
+ // v8
141
145
import { rewriteFramesIntegration } from ' @sentry/browser' ;
142
146
```
143
147
@@ -303,10 +307,11 @@ The `getIntegration()` and `getIntegrationById()` have been removed entirely, se
303
307
[ below] ( ./MIGRATION.md#deprecate-getintegration-and-getintegrationbyid ) .
304
308
305
309
``` js
306
- // Before (v7)
310
+ // v7
307
311
const replay = Sentry .getIntegration (Replay);
308
-
309
- // After (v8)
312
+ ```
313
+ ``` js
314
+ // v8
310
315
const replay = getClient ().getIntegrationByName (' Replay' );
311
316
```
312
317
@@ -326,13 +331,14 @@ details.
326
331
For example for the Browser SDKs:
327
332
328
333
``` ts
329
- // Before (v7)
334
+ // v7
330
335
Sentry .init ({
331
336
dsn: ' __DSN__' ,
332
337
integrations: [new Sentry .BrowserTracing ({ tracingOrigins: [' localhost' , ' example.com' ] })],
333
338
});
334
-
335
- // After (v8)
339
+ ```
340
+ ``` ts
341
+ // v8
336
342
Sentry .init ({
337
343
dsn: ' __DSN__' ,
338
344
integrations: [Sentry .browserTracingIntegration ()],
@@ -345,23 +351,22 @@ Sentry.init({
345
351
The SDKs now support metrics features without any additional configuration.
346
352
347
353
``` ts
348
- // Before (v7)
349
- // Server (Node/Deno/Bun)
354
+ // v7 - Server (Node/Deno/Bun)
350
355
Sentry .init ({
351
356
dsn: ' __DSN__' ,
352
357
_experiments: {
353
358
metricsAggregator: true ,
354
359
},
355
360
});
356
361
357
- // Before (v7)
358
- // Browser
362
+ // v7 - Browser
359
363
Sentry .init ({
360
364
dsn: ' __DSN__' ,
361
365
integrations: [Sentry .metricsAggregatorIntegration ()],
362
366
});
363
-
364
- // After (v8)
367
+ ```
368
+ ``` ts
369
+ // v8
365
370
Sentry .init ({
366
371
dsn: ' __DSN__' ,
367
372
});
@@ -373,14 +378,15 @@ In v7 we deprecated the `Severity` enum in favor of using the `SeverityLevel` ty
373
378
this has been removed in v8. You should now use the ` SeverityLevel ` type directly.
374
379
375
380
``` js
376
- // Before (v7)
381
+ // v7
377
382
import { Severity , SeverityLevel } from ' @sentry/types' ;
378
383
379
384
const levelA = Severity .error ;
380
385
381
386
const levelB: SeverityLevel = " error"
382
-
383
- // After (v8)
387
+ ```
388
+ ``` js
389
+ // v8
384
390
import { SeverityLevel } from ' @sentry/types' ;
385
391
386
392
const levelA = " error" as SeverityLevel;
@@ -394,12 +400,13 @@ The top level `Sentry.configureScope` function has been removed. Instead, you sh
394
400
to access and mutate the current scope.
395
401
396
402
``` js
397
- // Before (v7)
403
+ // v7
398
404
Sentry .configureScope (scope => {
399
405
scope .setTag (' key' , ' value' );
400
406
});
401
-
402
- // After (v8)
407
+ ```
408
+ ``` js
409
+ // v8
403
410
Sentry .getCurrentScope ().setTag (' key' , ' value' );
404
411
```
405
412
@@ -413,10 +420,11 @@ Internally, this class is now called `SentrySpan`, and it is no longer meant to
413
420
In v8, we are removing the ` spanStatusfromHttpCode ` function in favor of ` getSpanStatusFromHttpCode ` .
414
421
415
422
``` js
416
- // Before (v7)
423
+ // v7
417
424
const spanStatus = spanStatusfromHttpCode (200 );
418
-
419
- // After (v8)
425
+ ```
426
+ ``` js
427
+ // v8
420
428
const spanStatus = getSpanStatusFromHttpCode (200 );
421
429
```
422
430
@@ -425,13 +433,14 @@ const spanStatus = getSpanStatusFromHttpCode(200);
425
433
In v8, we are removing the ` addGlobalEventProcessor ` function in favor of ` addEventProcessor ` .
426
434
427
435
``` js
428
- // Before (v7)
436
+ // v7
429
437
addGlobalEventProcessor (event => {
430
438
delete event .extra ;
431
439
return event ;
432
440
});
433
-
434
- // After (v8)
441
+ ```
442
+ ``` js
443
+ // v8
435
444
addEventProcessor (event => {
436
445
delete event .extra ;
437
446
return event ;
@@ -448,12 +457,13 @@ The `send` method on the `Transport` interface now always requires a `TransportM
448
457
the promise. This means that the ` void ` return type is no longer allowed.
449
458
450
459
``` ts
451
- // Before (v7)
460
+ // v7
452
461
interface Transport {
453
462
send(event : Event ): Promise <void | TransportMakeRequestResponse >;
454
463
}
455
-
456
- // After (v8)
464
+ ```
465
+ ``` ts
466
+ // v8
457
467
interface Transport {
458
468
send(event : Event ): Promise <TransportMakeRequestResponse >;
459
469
}
@@ -530,7 +540,7 @@ With version 8 of the Sentry Next.js SDK, the SDK will no longer support passing
530
540
property to ` withSentryConfig ` . Please use the third argument of ` withSentryConfig ` to configure the SDK instead:
531
541
532
542
``` ts
533
- // OLD
543
+ // v7
534
544
const nextConfig = {
535
545
// Your Next.js options...
536
546
@@ -542,8 +552,9 @@ const nextConfig = {
542
552
module .exports = withSentryConfig (nextConfig , {
543
553
// Your Sentry Webpack Plugin Options...
544
554
});
545
-
546
- // NEW
555
+ ```
556
+ ``` ts
557
+ // v8
547
558
const nextConfig = {
548
559
// Your Next.js options...
549
560
};
@@ -597,7 +608,7 @@ a subset of [2.x options](https://www.npmjs.com/package/@sentry/vite-plugin/v/2.
597
608
optional just like before but here's an example of using the new options.
598
609
599
610
``` js
600
- // Before (v7):
611
+ // v7
601
612
sentrySvelteKit ({
602
613
sourceMapsUploadOptions: {
603
614
org: process .env .SENTRY_ORG ,
@@ -609,8 +620,9 @@ sentrySvelteKit({
609
620
ignore: [' **/build/client/**/*' ]
610
621
},
611
622
}),
612
-
613
- // After (v8):
623
+ ```
624
+ ``` js
625
+ // v8
614
626
sentrySvelteKit ({
615
627
sourceMapsUploadOptions: {
616
628
org: process .env .SENTRY_ORG ,
0 commit comments