getsentry / getsentry/sentry-javascript

Make it easier to opt-out of default integrations

Open
#14,950 0 comments 2 reactions 0 assignees View on GitHub
Improvement
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
523

Description

### Description

Today, it is rather annoying to opt-out of individual default integrations. You have to do something like this:

```js
Sentry.init({
integrations: (integrations) => integrations.filter(integration => intergation.name !== 'InboundFilters')
});
```

This becomes even more annoying when you _also_ want to add pluggable intergations, as then instead of this: `integrations: [Sentry.replayIntegration()]` you suddenly have to do this:

```js
Sentry.init({
integrations: (integrations) => {
integrations.push(Sentry.replayIntegration);
return integrations.filter(integration => intergation.name !== 'InboundFilters');
}
});
```

which really does not feel ideal.

I propose to add a new way to disable individual default integrations, similar to how https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node does this:

You can fully opt-out of default integrations via `defaultIntegrations: false`. In addition to this, we can allow users to pass an object, which allows to disable individual keys:

```js
Sentry.init({
defaultIntegrations: {
'InboundFilters': false,
'GlobalHandlers': false
},
// you can then continue to add integrations as normally
integrations: [Sentry.replayIntegration()]
});
```

This would be backwards compatible, but simply be a new and easier way to solve this problem.

Contributor guide

Open the contributing guide

Research direction

Start at the Sentry.init integration configuration path and trace how default integrations and the integrations option are currently combined. Compare the requested boolean and object forms with existing configuration behavior; done means individual defaults can be disabled, all defaults can be disabled, and additional integrations can still be supplied normally without breaking the current form.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.