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