Skip to content

Commit 0d9725a

Browse files
authored
feat: Require use of flag to send envelopes (getsentry#2594)
This gives us an easy kill-switch if we decide to revert back to the store endpoint. Sending envelopes becomes opt-in. Usage: Sentry.init({ dsn: '...', integrations: [new Sentry.Integrations.Tracing()], tracesSampleRate: 1, _experiments: { useEnvelope: true }, });
1 parent c843d53 commit 0d9725a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/request.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getCurrentHub } from '@sentry/hub';
12
import { Event } from '@sentry/types';
23

34
import { API } from './api';
@@ -15,7 +16,9 @@ interface SentryRequest {
1516

1617
/** Creates a SentryRequest from an event. */
1718
export function eventToSentryRequest(event: Event, api: API): SentryRequest {
18-
const useEnvelope = event.type === 'transaction';
19+
const client = getCurrentHub().getClient();
20+
const experimentsOptions = (client && client.getOptions()._experiments) || {};
21+
const useEnvelope = event.type === 'transaction' && experimentsOptions.useEnvelope;
1922

2023
const req: SentryRequest = {
2124
body: JSON.stringify(event),

0 commit comments

Comments
 (0)