getsentry / getsentry/sentry-javascript

Make it easier to opt-out of default integrations

Đang mở
#14,950 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
Improvement
Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.8k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
523

Mô tả

### 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.