Skip to content

Commit 1b46a11

Browse files
mydealizokmLms24
authored
feat: Rework Browser JS integration docs (#7648)
--------- Co-authored-by: Liza Mock <[email protected]> Co-authored-by: Lukas Stracke <[email protected]>
1 parent 25e79ce commit 1b46a11

File tree

69 files changed

+1015
-529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1015
-529
lines changed

src/docs/product/accounts/quotas/manage-event-stream-guide.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ To learn more and see code samples, check out:
244244

245245
#### GlobalHandlers
246246

247-
This integration attaches global handlers to capture uncaught exceptions (`onerror`) and unhandled rejections (`onunhandledrejection`). Both handlers are enabled by default, but can be disabled through configuration. Learn more in [GlobalHandlers Integration](/platforms/javascript/configuration/integrations/default/#globalhandlers).
247+
This integration attaches global handlers to capture uncaught exceptions (`onerror`) and unhandled rejections (`onunhandledrejection`). Both handlers are enabled by default, but can be disabled through configuration. Learn more in [GlobalHandlers Integration](/platforms/javascript/configuration/integrations/globalhandlers/).
248248

249-
Check out additional configuration options with the [tryCatch](/platforms/javascript/configuration/integrations/default/#trycatch) and [ReportingObserver](/platforms/javascript/configuration/integrations/plugin/#reportingobserver) integrations.
249+
Check out additional configuration options with the [tryCatch](/platforms/javascript/configuration/integrations/trycatch/) and [ReportingObserver](/platforms/javascript/configuration/integrations/reportingobserver/) integrations.
250250

251251
### Other SDKs
252252

src/includes/platforms/configuration/integrations/custom.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
Add a custom integration to your JavaScript using the following format:
1+
Add a custom integration to your JavaScript using the following format
22

33
```javascript
4-
// All integrations that come with an SDK can be found on Sentry.Integrations object
5-
// Custom integration must conform to the Integration interface: https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/integration.ts
4+
class MyAwesomeIntegrations {
5+
static id = "MyAwesomeIntegration";
6+
name = "MyAwesomeIntegration";
7+
8+
setupOnce() {
9+
// Do something when the integration is initialized
10+
}
11+
}
612

713
Sentry.init({
814
// ...
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
_Import name: `Sentry.Integrations.RequestData`_
2+
3+
This integration adds data from incoming requests to transaction and error events that occur during request handling done by the backend.
4+
5+
<Alert level="warning">
6+
Please note that this integration is only available on the server.
7+
</Alert>
8+
9+
## Options:
10+
11+
- `include` (object)
12+
13+
Controls what types of data are added to the event:
14+
15+
```js
16+
{
17+
cookies: boolean // default: true,
18+
data: boolean // default: true,
19+
headers: boolean // default: true,
20+
ip: boolean // default: false,
21+
query_string: boolean // default: true,
22+
url: boolean // default: true,
23+
user: boolean | {
24+
id: boolean // default: true,
25+
username: boolean // default: true,
26+
email: boolean // default: true,
27+
},
28+
}
29+
```
30+
31+
- `transactionNamingSchema` (string)
32+
33+
Controls how the transaction will be reported. Options are 'path' (`/some/route`),
34+
'methodPath' (`GET /some/route`), and 'handler' (the name of the route handler
35+
function, if available).
36+
Defaults to `methodPath`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A list of strings or regex patterns that match error URLs which should exclusively be sent to Sentry. If you use this option, only errors whose entire file URL contains (string) or matches (regex) at least one entry in the list will be sent. As a result, if you add `'foo.com'` to it, it will also match on `https://bar.com/myfile/foo.com`. Keep in mind that this only applies for captured exceptions, not raw message events. By default, all errors are sent.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A list of strings or regex patterns that match error URLs that should not be sent to Sentry. Errors whose entire file URL contains (string) or matches (regex) at least one entry in the list will not be sent. As a result, if you add `'foo.com'` to the list, it will also match on `https://bar.com/myfile/foo.com`. Keep in mind that this only applies for captured exceptions, not raw message events. By default, all errors are sent.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A list of strings or regex patterns that match error messages that shouldn't be sent to Sentry. Messages that match these strings or regular expressions will be filtered out before they're sent to Sentry. When using strings, partial matches will be filtered out, so if you need to filter by exact match, use regex patterns instead. By default, all errors are sent.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A list of strings or regex patterns that match transaction names that shouldn't be sent to Sentry. Transactions that match these strings or regular expressions will be filtered out before they're sent to Sentry. When using strings, partial matches will be filtered out, so if you need to filter by exact match, use regex patterns instead. By default, transactions spanning typical API health check requests are filtered out.

src/platform-includes/configuration/capture-console/javascript.mdx

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { CaptureConsole as CaptureConsoleIntegration } from "@sentry/integrations";
5+
import { CaptureConsole } from "@sentry/integrations";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
9-
integrations: [new CaptureConsoleIntegration(
10-
{
11-
// array of methods that should be captured
12-
// defaults to ['log', 'info', 'warn', 'error', 'debug', 'assert']
13-
levels: string[];
14-
}
15-
)],
9+
integrations: [new CaptureConsole()],
1610
});
1711
```
1812

@@ -28,15 +22,9 @@ Sentry.init({
2822
></script>
2923

3024
<script>
31-
Sentry.onLoad(function() {
25+
Sentry.onLoad(function () {
3226
Sentry.init({
33-
integrations: [new Sentry.Integrations.CaptureConsole(
34-
{
35-
// array of methods that should be captured
36-
// defaults to ['log', 'info', 'warn', 'error', 'debug', 'assert']
37-
levels: string[];
38-
}
39-
)],
27+
integrations: [new Sentry.Integrations.CaptureConsole()],
4028
});
4129
});
4230
</script>
@@ -57,13 +45,7 @@ Sentry.init({
5745
<script>
5846
Sentry.init({
5947
dsn: "___PUBLIC_DSN___",
60-
integrations: [new Sentry.Integrations.CaptureConsole(
61-
{
62-
// array of methods that should be captured
63-
// defaults to ['log', 'info', 'warn', 'error', 'debug', 'assert']
64-
levels: string[];
65-
}
66-
)],
48+
integrations: [new Sentry.Integrations.CaptureConsole()],
6749
});
6850
</script>
6951
```

src/platform-includes/configuration/contextlines/javascript.mdx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import { ContextLines } from "@sentry/integrations";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
9-
integrations: [
10-
new ContextLines({
11-
// The number of lines to collect around each stack frame's line number
12-
// Defaults to 7
13-
frameContextLines: 7,
14-
}),
15-
],
9+
integrations: [new ContextLines()],
1610
});
1711
```
1812

@@ -30,13 +24,7 @@ Sentry.init({
3024
<script>
3125
Sentry.onLoad(function () {
3226
Sentry.init({
33-
integrations: [
34-
new Sentry.Integrations.ContextLines({
35-
// The number of lines to collect before and after each stack frame's line number
36-
// Defaults to 7
37-
frameContextLines: 7,
38-
}),
39-
],
27+
integrations: [new Sentry.Integrations.ContextLines()],
4028
});
4129
});
4230
</script>
@@ -57,13 +45,7 @@ Sentry.init({
5745
<script>
5846
Sentry.init({
5947
dsn: "___PUBLIC_DSN___",
60-
integrations: [
61-
new Sentry.Integrations.ContextLines({
62-
// The number of lines to collect around each stack frame's line number
63-
// Defaults to 7
64-
frameContextLines: 7,
65-
}),
66-
],
48+
integrations: [new Sentry.Integrations.ContextLines()],
6749
});
6850
</script>
6951
```

src/platform-includes/configuration/debug/javascript.mdx

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { Debug as DebugIntegration } from "@sentry/integrations";
5+
import { Debug } from "@sentry/integrations";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
9-
integrations: [new DebugIntegration(
10-
{
11-
// trigger DevTools debugger instead of using console.log
12-
debugger: boolean;
13-
14-
// stringify event before passing it to console.log
15-
stringify: boolean;
16-
}
17-
)],
9+
integrations: [new Debug()],
1810
});
1911
```
2012

@@ -30,17 +22,9 @@ Sentry.init({
3022
></script>
3123

3224
<script>
33-
Sentry.onLoad(function() {
25+
Sentry.onLoad(function () {
3426
Sentry.init({
35-
integrations: [new Sentry.Integrations.Debug(
36-
{
37-
// trigger DevTools debugger instead of using console.log
38-
debugger: boolean;
39-
40-
// stringify event before passing it to console.log
41-
stringify: boolean;
42-
}
43-
)],
27+
integrations: [new Sentry.Integrations.Debug()],
4428
});
4529
});
4630
</script>
@@ -61,15 +45,7 @@ Sentry.init({
6145
<script>
6246
Sentry.init({
6347
dsn: "___PUBLIC_DSN___",
64-
integrations: [new Sentry.Integrations.Debug(
65-
{
66-
// trigger DevTools debugger instead of using console.log
67-
debugger: boolean;
68-
69-
// stringify event before passing it to console.log
70-
stringify: boolean;
71-
}
72-
)],
48+
integrations: [new Sentry.Integrations.Debug()],
7349
});
7450
</script>
7551
```

src/platform-includes/configuration/dedupe/javascript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { Dedupe as DedupeIntegration } from "@sentry/integrations";
5+
import { Dedupe } from "@sentry/integrations";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
9-
integrations: [new DedupeIntegration()],
9+
integrations: [new Dedupe()],
1010
});
1111
```
1212

src/platform-includes/configuration/enable-pluggable-integrations-lazy/javascript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { ReportingObserver as ReportingObserverIntegration } from "@sentry/integrations";
5+
import { ReportingObserver } from "@sentry/integrations";
66

77
Sentry.init({
88
integrations: [],
99
});
1010

1111
const client = Sentry.getCurrentHub().getClient();
1212
if (client) {
13-
client.addIntegration(new ReportingObserverIntegration());
13+
client.addIntegration(new ReportingObserver());
1414
}
1515
```
1616

src/platform-includes/configuration/enable-pluggable-integrations/javascript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { ReportingObserver as ReportingObserverIntegration } from "@sentry/integrations";
5+
import { ReportingObserver } from "@sentry/integrations";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
9-
integrations: [new ReportingObserverIntegration()],
9+
integrations: [new ReportingObserver()],
1010
});
1111
```
1212

src/platform-includes/configuration/extra-error-data/javascript.mdx

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
```javascript {tabTitle: ESM}
44
import * as Sentry from "@sentry/browser";
5-
import { ExtraErrorData as ExtraErrorDataIntegration } from "@sentry/integrations";
5+
import { ExtraErrorData } from "@sentry/integrations";
66

77
Sentry.init({
88
dsn: "___PUBLIC_DSN___",
9-
integrations: [
10-
new ExtraErrorDataIntegration({
11-
// Limit of how deep the object serializer should go. Anything deeper than limit will
12-
// be replaced with standard Node.js REPL notation of [Object], [Array], [Function] or
13-
// a primitive value. Defaults to 3.
14-
depth: number,
15-
}),
16-
],
9+
integrations: [new ExtraErrorData()],
1710
});
1811
```
1912

@@ -31,14 +24,7 @@ Sentry.init({
3124
<script>
3225
Sentry.onLoad(function () {
3326
Sentry.init({
34-
integrations: [
35-
new Sentry.Integrations.ExtraErrorData({
36-
// Limit of how deep the object serializer should go. Anything deeper than limit will
37-
// be replaced with standard Node.js REPL notation of [Object], [Array], [Function] or
38-
// a primitive value. Defaults to 3.
39-
depth: number,
40-
}),
41-
],
27+
integrations: [new Sentry.Integrations.ExtraErrorData()],
4228
});
4329
});
4430
</script>
@@ -59,14 +45,7 @@ Sentry.init({
5945
<script>
6046
Sentry.init({
6147
dsn: "___PUBLIC_DSN___",
62-
integrations: [
63-
new Sentry.Integrations.ExtraErrorData({
64-
// Limit of how deep the object serializer should go. Anything deeper than limit will
65-
// be replaced with standard Node.js REPL notation of [Object], [Array], [Function] or
66-
// a primitive value. Defaults to 3.
67-
depth: number,
68-
}),
69-
],
48+
integrations: [new Sentry.Integrations.ExtraErrorData()],
7049
});
7150
</script>
7251
```

0 commit comments

Comments
 (0)