Integrations
Learn more about how integrations extend the functionality of our SDK to cover common libraries and environments automatically.
The Sentry SDK uses integrations to hook into the functionality of popular libraries to automatically instrument your application and give you the best data out of the box.
Integrations automatically add error instrumentation, performance instrumentation, and/or extra context information to your application. Some are enabled by default, but you can disable them or modify their settings.
The SvelteKit SDK initializes the SDK in two runtimes: Browser and Node.js. However, it's important to note that not all integrations are compatible with all of these runtimes.
Depending on whether an integration enhances the functionality of a particular runtime, such as the BrowserTracing
integration for the browser runtime or the RequestData
integration for the Node.js.js runtime, you can only include these integrations in their respective configuration files:
- For the browser runtime integrations, add integrations to
Sentry.init
inhooks.client.js
- For the Node.js runtime integrations, add integrations to
Sentry.init
inhooks.server.js
Auto Enabled | Errors | Performance | Additional Context | |
---|---|---|---|---|
dedupeIntegration | ✓ | ✓ | ||
functionToStringIntegration | ✓ | |||
inboundFiltersIntegration | ✓ | ✓ | ||
linkedErrorsIntegration | ✓ | ✓ | ||
captureConsoleIntegration | ✓ | |||
debugIntegration | ||||
extraErrorDataIntegration | ✓ | |||
rewriteFramesIntegration | ✓ | |||
sessionTimingIntegration | ✓ |
Auto Enabled | Errors | Performance | Replay | Additional Context | |
---|---|---|---|---|---|
breadcrumbsIntegration | ✓ | ✓ | |||
browserApiErrorsIntegration | ✓ | ✓ | |||
browserTracingIntegration | ✓ | ✓ | ✓ | ||
globalHandlersIntegration | ✓ | ✓ | |||
httpContextIntegration | ✓ | ✓ | |||
browserProfilingIntegration | ✓ | ||||
contextLinesIntegration | ✓ | ||||
httpClientIntegration | ✓ | ||||
moduleMetadataIntegration | ✓ | ||||
replayIntegration | ✓ | ✓ | |||
replayCanvasIntegration | ✓ | ||||
reportingObserverIntegration | ✓ |
To disable system integrations, set defaultIntegrations: false
when calling init()
.
To override their settings, provide a new instance with your config to the integrations
option. For example, to turn off browser capturing console calls:
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [
Sentry.linkedErrorsIntegration({
limit: 7,
}),
],
});
You can add additional integrations in your init
call:
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [Sentry.reportingObserverIntegration()],
});
Alternatively, you can add integrations via Sentry.addIntegration()
. This is useful if you only want to enable an integration in a specific environment or if you want to load an integration later. For all other cases, we recommend you use the integrations
option.
import * as Sentry from "@sentry/browser";
Sentry.init({
integrations: [],
});
Sentry.addIntegration(Sentry.reportingObserverIntegration());
You can lazy load pluggable integrations via Sentry.lazyLoadIntegration()
. This will try to load the integration from the CDN, allowing you to add an integration without increasing the initial bundle size.
async function loadHttpClient() {
const httpClientIntegration = await Sentry.lazyLoadIntegration(
"httpClientIntegration",
);
Sentry.addIntegration(httpClientIntegration());
}
Note that this function will reject if it fails to load the integration from the CDN, which can happen e.g. if a user has an ad-blocker or if there is a network problem. You should always make sure to handle rejections for this function in your application.
Lazy loading is available for the following integrations:
replayIntegration
replayCanvasIntegration
feedbackIntegration
feedbackModalIntegration
feedbackScreenshotIntegration
captureConsoleIntegration
contextLinesIntegration
linkedErrorsIntegration
debugIntegration
dedupeIntegration
extraErrorDataIntegration
httpClientIntegration
reportingObserverIntegration
rewriteFramesIntegration
sessionTimingIntegration
browserProfilingIntegration
If you only want to remove a single or some of the default integrations, instead of disabling all of them with defaultIntegrations: false
, you can use the following syntax to filter out the ones you don't want.
This example removes the integration for adding breadcrumbs to the event, which is enabled by default:
Sentry.init({
// ...
integrations: function (integrations) {
// integrations will be all default integrations
return integrations.filter(function (integration) {
return integration.name !== "Breadcrumbs";
});
},
});
You can also create custom integrations.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").