@sentry/browser 9.30.0 → 9.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/build/npm/cjs/index.js +1 -2
  2. package/build/npm/cjs/index.js.map +1 -1
  3. package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js +8 -8
  4. package/build/npm/cjs/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  5. package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js +5 -4
  6. package/build/npm/cjs/integrations/featureFlags/openfeature/integration.js.map +1 -1
  7. package/build/npm/cjs/integrations/featureFlags/statsig/integration.js +7 -7
  8. package/build/npm/cjs/integrations/featureFlags/statsig/integration.js.map +1 -1
  9. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js +6 -6
  10. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js.map +1 -1
  11. package/build/npm/cjs/transports/fetch.js +1 -1
  12. package/build/npm/cjs/transports/fetch.js.map +1 -1
  13. package/build/npm/esm/index.js +1 -2
  14. package/build/npm/esm/index.js.map +1 -1
  15. package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js +9 -9
  16. package/build/npm/esm/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  17. package/build/npm/esm/integrations/featureFlags/openfeature/integration.js +6 -5
  18. package/build/npm/esm/integrations/featureFlags/openfeature/integration.js.map +1 -1
  19. package/build/npm/esm/integrations/featureFlags/statsig/integration.js +8 -8
  20. package/build/npm/esm/integrations/featureFlags/statsig/integration.js.map +1 -1
  21. package/build/npm/esm/integrations/featureFlags/unleash/integration.js +7 -7
  22. package/build/npm/esm/integrations/featureFlags/unleash/integration.js.map +1 -1
  23. package/build/npm/esm/package.json +1 -1
  24. package/build/npm/esm/transports/fetch.js +1 -1
  25. package/build/npm/esm/transports/fetch.js.map +1 -1
  26. package/build/npm/types/helpers.d.ts +1 -0
  27. package/build/npm/types/helpers.d.ts.map +1 -1
  28. package/build/npm/types/index.d.ts +2 -3
  29. package/build/npm/types/index.d.ts.map +1 -1
  30. package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts +5 -5
  31. package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts.map +1 -1
  32. package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts.map +1 -1
  33. package/build/npm/types/integrations/featureFlags/statsig/integration.d.ts.map +1 -1
  34. package/build/npm/types/integrations/featureFlags/unleash/integration.d.ts.map +1 -1
  35. package/build/npm/types-ts3.8/helpers.d.ts +1 -0
  36. package/build/npm/types-ts3.8/index.d.ts +2 -3
  37. package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/integration.d.ts +5 -5
  38. package/package.json +7 -7
  39. package/build/npm/cjs/integrations/featureFlags/featureFlagsIntegration.js +0 -46
  40. package/build/npm/cjs/integrations/featureFlags/featureFlagsIntegration.js.map +0 -1
  41. package/build/npm/cjs/utils/featureFlags.js +0 -96
  42. package/build/npm/cjs/utils/featureFlags.js.map +0 -1
  43. package/build/npm/esm/integrations/featureFlags/featureFlagsIntegration.js +0 -44
  44. package/build/npm/esm/integrations/featureFlags/featureFlagsIntegration.js.map +0 -1
  45. package/build/npm/esm/utils/featureFlags.js +0 -91
  46. package/build/npm/esm/utils/featureFlags.js.map +0 -1
  47. package/build/npm/types/integrations/featureFlags/featureFlagsIntegration.d.ts +0 -31
  48. package/build/npm/types/integrations/featureFlags/featureFlagsIntegration.d.ts.map +0 -1
  49. package/build/npm/types/integrations/featureFlags/index.d.ts +0 -2
  50. package/build/npm/types/integrations/featureFlags/index.d.ts.map +0 -1
  51. package/build/npm/types/utils/featureFlags.d.ts +0 -34
  52. package/build/npm/types/utils/featureFlags.d.ts.map +0 -1
  53. package/build/npm/types-ts3.8/integrations/featureFlags/featureFlagsIntegration.d.ts +0 -31
  54. package/build/npm/types-ts3.8/integrations/featureFlags/index.d.ts +0 -2
  55. package/build/npm/types-ts3.8/utils/featureFlags.d.ts +0 -34
@@ -31,7 +31,6 @@ const offline = require('./transports/offline.js');
31
31
  const integration = require('./profiling/integration.js');
32
32
  const spotlight = require('./integrations/spotlight.js');
33
33
  const browsersession = require('./integrations/browsersession.js');
34
- const featureFlagsIntegration = require('./integrations/featureFlags/featureFlagsIntegration.js');
35
34
  const integration$1 = require('./integrations/featureFlags/launchdarkly/integration.js');
36
35
  const integration$2 = require('./integrations/featureFlags/openfeature/integration.js');
37
36
  const integration$3 = require('./integrations/featureFlags/unleash/integration.js');
@@ -67,6 +66,7 @@ exports.dedupeIntegration = core.dedupeIntegration;
67
66
  exports.endSession = core.endSession;
68
67
  exports.eventFiltersIntegration = core.eventFiltersIntegration;
69
68
  exports.extraErrorDataIntegration = core.extraErrorDataIntegration;
69
+ exports.featureFlagsIntegration = core.featureFlagsIntegration;
70
70
  exports.flush = core.flush;
71
71
  exports.functionToStringIntegration = core.functionToStringIntegration;
72
72
  exports.getActiveSpan = core.getActiveSpan;
@@ -156,7 +156,6 @@ exports.makeBrowserOfflineTransport = offline.makeBrowserOfflineTransport;
156
156
  exports.browserProfilingIntegration = integration.browserProfilingIntegration;
157
157
  exports.spotlightBrowserIntegration = spotlight.spotlightBrowserIntegration;
158
158
  exports.browserSessionIntegration = browsersession.browserSessionIntegration;
159
- exports.featureFlagsIntegration = featureFlagsIntegration.featureFlagsIntegration;
160
159
  exports.buildLaunchDarklyFlagUsedHandler = integration$1.buildLaunchDarklyFlagUsedHandler;
161
160
  exports.launchDarklyIntegration = integration$1.launchDarklyIntegration;
162
161
  exports.OpenFeatureIntegrationHook = integration$2.OpenFeatureIntegrationHook;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,10 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
- const featureFlags = require('../../../utils/featureFlags.js');
5
4
 
6
5
  /**
7
- * Sentry integration for capturing feature flags from LaunchDarkly.
6
+ * Sentry integration for capturing feature flag evaluations from LaunchDarkly.
8
7
  *
9
8
  * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
10
9
  *
@@ -23,16 +22,16 @@ const launchDarklyIntegration = core.defineIntegration(() => {
23
22
  name: 'LaunchDarkly',
24
23
 
25
24
  processEvent(event, _hint, _client) {
26
- return featureFlags.copyFlagsFromScopeToEvent(event);
25
+ return core._INTERNAL_copyFlagsFromScopeToEvent(event);
27
26
  },
28
27
  };
29
28
  }) ;
30
29
 
31
30
  /**
32
- * LaunchDarkly hook that listens for flag evaluations and updates the `flags`
33
- * context in our Sentry scope. This needs to be registered as an
34
- * 'inspector' in LaunchDarkly initialize() options, separately from
35
- * `launchDarklyIntegration`. Both are needed to collect feature flags on error.
31
+ * LaunchDarkly hook to listen for and buffer flag evaluations. This needs to
32
+ * be registered as an 'inspector' in LaunchDarkly initialize() options,
33
+ * separately from `launchDarklyIntegration`. Both the hook and the integration
34
+ * are needed to capture LaunchDarkly flags.
36
35
  */
37
36
  function buildLaunchDarklyFlagUsedHandler() {
38
37
  return {
@@ -45,7 +44,8 @@ function buildLaunchDarklyFlagUsedHandler() {
45
44
  * Handle a flag evaluation by storing its name and value on the current scope.
46
45
  */
47
46
  method: (flagKey, flagDetail, _context) => {
48
- featureFlags.insertFlagToScope(flagKey, flagDetail.value);
47
+ core._INTERNAL_insertFlagToScope(flagKey, flagDetail.value);
48
+ core._INTERNAL_addFeatureFlagToActiveSpan(flagKey, flagDetail.value);
49
49
  },
50
50
  };
51
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { LDContext, LDEvaluationDetail, LDInspectionFlagUsedHandler } from './types';\n\n/**\n * Sentry integration for capturing feature flags from LaunchDarkly.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from '@sentry/browser';\n * import {launchDarklyIntegration, buildLaunchDarklyFlagUsedInspector} from '@sentry/browser';\n * import * as LaunchDarkly from 'launchdarkly-js-client-sdk';\n *\n * Sentry.init(..., integrations: [launchDarklyIntegration()])\n * const ldClient = LaunchDarkly.initialize(..., {inspectors: [buildLaunchDarklyFlagUsedHandler()]});\n * ```\n */\nexport const launchDarklyIntegration = defineIntegration(() => {\n return {\n name: 'LaunchDarkly',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * LaunchDarkly hook that listens for flag evaluations and updates the `flags`\n * context in our Sentry scope. This needs to be registered as an\n * 'inspector' in LaunchDarkly initialize() options, separately from\n * `launchDarklyIntegration`. Both are needed to collect feature flags on error.\n */\nexport function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler {\n return {\n name: 'sentry-flag-auditor',\n type: 'flag-used',\n\n synchronous: true,\n\n /**\n * Handle a flag evaluation by storing its name and value on the current scope.\n */\n method: (flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext) => {\n insertFlagToScope(flagKey, flagDetail.value);\n },\n };\n}\n"],"names":["defineIntegration","copyFlagsFromScopeToEvent","insertFlagToScope"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAwB,GAAEA,sBAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,sCAAyB,CAAC,KAAK,CAAC;AAC7C,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,GAAgC;AAChF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,IAAI,EAAE,WAAW;;AAErB,IAAI,WAAW,EAAE,IAAI;;AAErB;AACA;AACA;AACA,IAAI,MAAM,EAAE,CAAC,OAAO,EAAU,UAAU,EAAsB,QAAQ,KAAgB;AACtF,MAAMC,8BAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AAClD,KAAK;AACL,GAAG;AACH;;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { LDContext, LDEvaluationDetail, LDInspectionFlagUsedHandler } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from LaunchDarkly.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from '@sentry/browser';\n * import {launchDarklyIntegration, buildLaunchDarklyFlagUsedInspector} from '@sentry/browser';\n * import * as LaunchDarkly from 'launchdarkly-js-client-sdk';\n *\n * Sentry.init(..., integrations: [launchDarklyIntegration()])\n * const ldClient = LaunchDarkly.initialize(..., {inspectors: [buildLaunchDarklyFlagUsedHandler()]});\n * ```\n */\nexport const launchDarklyIntegration = defineIntegration(() => {\n return {\n name: 'LaunchDarkly',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * LaunchDarkly hook to listen for and buffer flag evaluations. This needs to\n * be registered as an 'inspector' in LaunchDarkly initialize() options,\n * separately from `launchDarklyIntegration`. Both the hook and the integration\n * are needed to capture LaunchDarkly flags.\n */\nexport function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler {\n return {\n name: 'sentry-flag-auditor',\n type: 'flag-used',\n\n synchronous: true,\n\n /**\n * Handle a flag evaluation by storing its name and value on the current scope.\n */\n method: (flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext) => {\n _INTERNAL_insertFlagToScope(flagKey, flagDetail.value);\n _INTERNAL_addFeatureFlagToActiveSpan(flagKey, flagDetail.value);\n },\n };\n}\n"],"names":["defineIntegration","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan"],"mappings":";;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAwB,GAAEA,sBAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,wCAAmC,CAAC,KAAK,CAAC;AACvD,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,GAAgC;AAChF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,IAAI,EAAE,WAAW;;AAErB,IAAI,WAAW,EAAE,IAAI;;AAErB;AACA;AACA;AACA,IAAI,MAAM,EAAE,CAAC,OAAO,EAAU,UAAU,EAAsB,QAAQ,KAAgB;AACtF,MAAMC,gCAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AAC5D,MAAMC,yCAAoC,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AACrE,KAAK;AACL,GAAG;AACH;;;;;"}
@@ -1,14 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
- const featureFlags = require('../../../utils/featureFlags.js');
5
4
 
6
5
  const openFeatureIntegration = core.defineIntegration(() => {
7
6
  return {
8
7
  name: 'OpenFeature',
9
8
 
10
9
  processEvent(event, _hint, _client) {
11
- return featureFlags.copyFlagsFromScopeToEvent(event);
10
+ return core._INTERNAL_copyFlagsFromScopeToEvent(event);
12
11
  },
13
12
  };
14
13
  }) ;
@@ -21,14 +20,16 @@ class OpenFeatureIntegrationHook {
21
20
  * Successful evaluation result.
22
21
  */
23
22
  after(_hookContext, evaluationDetails) {
24
- featureFlags.insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);
23
+ core._INTERNAL_insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);
24
+ core._INTERNAL_addFeatureFlagToActiveSpan(evaluationDetails.flagKey, evaluationDetails.value);
25
25
  }
26
26
 
27
27
  /**
28
28
  * On error evaluation result.
29
29
  */
30
30
  error(hookContext, _error, _hookHints) {
31
- featureFlags.insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);
31
+ core._INTERNAL_insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);
32
+ core._INTERNAL_addFeatureFlagToActiveSpan(hookContext.flagKey, hookContext.defaultValue);
32
33
  }
33
34
  }
34
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * OpenFeature integration.\n *\n * Add the openFeatureIntegration() function call to your integration lists.\n * Add the integration hook to your OpenFeature object.\n * - OpenFeature.getClient().addHooks(new OpenFeatureIntegrationHook());\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":["defineIntegration","copyFlagsFromScopeToEvent","insertFlagToScope"],"mappings":";;;;;MAYa,sBAAuB,GAAEA,sBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;;AAEvB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,sCAAyB,CAAC,KAAK,CAAC;AAC7C,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACO,MAAM,4BAAsD;AACnE;AACA;AACA;AACA,GAAS,KAAK,CAAC,YAAY,EAAoC,iBAAiB,EAAsC;AACtH,IAAIC,8BAAiB,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AACzE;;AAEA;AACA;AACA;AACA,GAAS,KAAK,CAAC,WAAW,EAAoC,MAAM,EAAW,UAAU,EAAoB;AAC7G,IAAIA,8BAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AACpE;AACA;;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * Sentry integration for capturing OpenFeature feature flag evaluations.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from \"@sentry/browser\";\n * import { OpenFeature } from \"@openfeature/web-sdk\";\n *\n * Sentry.init(..., integrations: [Sentry.openFeatureIntegration()]);\n * OpenFeature.setProvider(new MyProviderOfChoice());\n * OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook());\n * ```\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n _INTERNAL_insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n _INTERNAL_addFeatureFlagToActiveSpan(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n _INTERNAL_insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n _INTERNAL_addFeatureFlagToActiveSpan(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":["defineIntegration","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan"],"mappings":";;;;MAwBa,sBAAuB,GAAEA,sBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;;AAEvB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,wCAAmC,CAAC,KAAK,CAAC;AACvD,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACO,MAAM,4BAAsD;AACnE;AACA;AACA;AACA,GAAS,KAAK,CAAC,YAAY,EAAoC,iBAAiB,EAAsC;AACtH,IAAIC,gCAA2B,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AACnF,IAAIC,yCAAoC,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AAC5F;;AAEA;AACA;AACA;AACA,GAAS,KAAK,CAAC,WAAW,EAAoC,MAAM,EAAW,UAAU,EAAoB;AAC7G,IAAID,gCAA2B,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AAC9E,IAAIC,yCAAoC,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AACvF;AACA;;;;;"}
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
- const featureFlags = require('../../../utils/featureFlags.js');
5
4
 
6
5
  /**
7
6
  * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.
@@ -31,15 +30,16 @@ const statsigIntegration = core.defineIntegration(
31
30
  return {
32
31
  name: 'Statsig',
33
32
 
34
- processEvent(event, _hint, _client) {
35
- return featureFlags.copyFlagsFromScopeToEvent(event);
36
- },
37
-
38
- setup() {
33
+ setup(_client) {
39
34
  statsigClient.on('gate_evaluation', (event) => {
40
- featureFlags.insertFlagToScope(event.gate.name, event.gate.value);
35
+ core._INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);
36
+ core._INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);
41
37
  });
42
38
  },
39
+
40
+ processEvent(event, _hint, _client) {
41
+ return core._INTERNAL_copyFlagsFromScopeToEvent(event);
42
+ },
43
43
  };
44
44
  },
45
45
  ) ;
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { FeatureGate, StatsigClient } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { StatsigClient } from '@statsig/js-client';\n * import * as Sentry from '@sentry/browser';\n *\n * const statsigClient = new StatsigClient();\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})],\n * });\n *\n * await statsigClient.initializeAsync(); // or statsigClient.initializeSync();\n *\n * const result = statsigClient.checkGate('my-feature-gate');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const statsigIntegration = defineIntegration(\n ({ featureFlagClient: statsigClient }: { featureFlagClient: StatsigClient }) => {\n return {\n name: 'Statsig',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n\n setup() {\n statsigClient.on('gate_evaluation', (event: { gate: FeatureGate }) => {\n insertFlagToScope(event.gate.name, event.gate.value);\n });\n },\n };\n },\n) satisfies IntegrationFn;\n"],"names":["defineIntegration","copyFlagsFromScopeToEvent","insertFlagToScope"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAEA,sBAAiB;AACnD,EAAE,CAAC,EAAE,iBAAiB,EAAE,aAAc,EAAC,KAA2C;AAClF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAOC,sCAAyB,CAAC,KAAK,CAAC;AAC/C,OAAO;;AAEP,MAAM,KAAK,GAAG;AACd,QAAQ,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,KAA4B;AAC9E,UAAUC,8BAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC9D,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { FeatureGate, StatsigClient } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { StatsigClient } from '@statsig/js-client';\n * import * as Sentry from '@sentry/browser';\n *\n * const statsigClient = new StatsigClient();\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})],\n * });\n *\n * await statsigClient.initializeAsync(); // or statsigClient.initializeSync();\n *\n * const result = statsigClient.checkGate('my-feature-gate');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const statsigIntegration = defineIntegration(\n ({ featureFlagClient: statsigClient }: { featureFlagClient: StatsigClient }) => {\n return {\n name: 'Statsig',\n\n setup(_client: Client) {\n statsigClient.on('gate_evaluation', (event: { gate: FeatureGate }) => {\n _INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);\n _INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);\n });\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n"],"names":["defineIntegration","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan","_INTERNAL_copyFlagsFromScopeToEvent"],"mappings":";;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAEA,sBAAiB;AACnD,EAAE,CAAC,EAAE,iBAAiB,EAAE,aAAc,EAAC,KAA2C;AAClF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,KAAK,CAAC,OAAO,EAAU;AAC7B,QAAQ,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,KAA4B;AAC9E,UAAUC,gCAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACxE,UAAUC,yCAAoC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACjF,SAAS,CAAC;AACV,OAAO;;AAEP,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAOC,wCAAmC,CAAC,KAAK,CAAC;AACzD,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;;;"}
@@ -2,7 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
4
  const debugBuild = require('../../../debug-build.js');
5
- const featureFlags = require('../../../utils/featureFlags.js');
6
5
 
7
6
  /**
8
7
  * Sentry integration for capturing feature flag evaluations from the Unleash SDK.
@@ -31,14 +30,14 @@ const unleashIntegration = core.defineIntegration(
31
30
  return {
32
31
  name: 'Unleash',
33
32
 
34
- processEvent(event, _hint, _client) {
35
- return featureFlags.copyFlagsFromScopeToEvent(event);
36
- },
37
-
38
33
  setupOnce() {
39
34
  const unleashClientPrototype = unleashClientClass.prototype ;
40
35
  core.fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);
41
36
  },
37
+
38
+ processEvent(event, _hint, _client) {
39
+ return core._INTERNAL_copyFlagsFromScopeToEvent(event);
40
+ },
42
41
  };
43
42
  },
44
43
  ) ;
@@ -60,7 +59,8 @@ function _wrappedIsEnabled(
60
59
  const result = original.apply(this, args);
61
60
 
62
61
  if (typeof toggleName === 'string' && typeof result === 'boolean') {
63
- featureFlags.insertFlagToScope(toggleName, result);
62
+ core._INTERNAL_insertFlagToScope(toggleName, result);
63
+ core._INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);
64
64
  } else if (debugBuild.DEBUG_BUILD) {
65
65
  core.logger.error(
66
66
  `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { UnleashClient, UnleashClientClass } from './types';\n\ntype UnleashIntegrationOptions = {\n featureFlagClientClass: UnleashClientClass;\n};\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Unleash SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { UnleashClient } from 'unleash-proxy-client';\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],\n * });\n *\n * const unleash = new UnleashClient(...);\n * unleash.start();\n *\n * unleash.isEnabled('my-feature');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const unleashIntegration = defineIntegration(\n ({ featureFlagClientClass: unleashClientClass }: UnleashIntegrationOptions) => {\n return {\n name: 'Unleash',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n\n setupOnce() {\n const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;\n fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);\n },\n };\n },\n) satisfies IntegrationFn;\n\n/**\n * Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.\n *\n * This wrapper is safe for all isEnabled signatures. If the signature does not match (this: UnleashClient, toggleName: string, ...args: unknown[]) => boolean,\n * we log an error and return the original result.\n *\n * @param original - The original method.\n * @returns Wrapped method. Results should match the original.\n */\nfunction _wrappedIsEnabled(\n original: (this: UnleashClient, ...args: unknown[]) => unknown,\n): (this: UnleashClient, ...args: unknown[]) => unknown {\n return function (this: UnleashClient, ...args: unknown[]): unknown {\n const toggleName = args[0];\n const result = original.apply(this, args);\n\n if (typeof toggleName === 'string' && typeof result === 'boolean') {\n insertFlagToScope(toggleName, result);\n } else if (DEBUG_BUILD) {\n logger.error(\n `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,\n );\n }\n return result;\n };\n}\n"],"names":["defineIntegration","copyFlagsFromScopeToEvent","fill","insertFlagToScope","DEBUG_BUILD","logger"],"mappings":";;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAEA,sBAAiB;AACnD,EAAE,CAAC,EAAE,sBAAsB,EAAE,kBAAmB,EAAC,KAAgC;AACjF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAOC,sCAAyB,CAAC,KAAK,CAAC;AAC/C,OAAO;;AAEP,MAAM,SAAS,GAAG;AAClB,QAAQ,MAAM,sBAAA,GAAyB,kBAAkB,CAAC,SAAU;AACpE,QAAQC,SAAI,CAAC,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACpE,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB;AAC1B,EAAE,QAAQ;AACV,EAAwD;AACxD,EAAE,OAAO,WAA+B,GAAG,IAAI,EAAsB;AACrE,IAAI,MAAM,UAAW,GAAE,IAAI,CAAC,CAAC,CAAC;AAC9B,IAAI,MAAM,MAAO,GAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;;AAE7C,IAAI,IAAI,OAAO,UAAW,KAAI,QAAS,IAAG,OAAO,MAAA,KAAW,SAAS,EAAE;AACvE,MAAMC,8BAAiB,CAAC,UAAU,EAAE,MAAM,CAAC;AAC3C,KAAM,MAAK,IAAIC,sBAAW,EAAE;AAC5B,MAAMC,WAAM,CAAC,KAAK;AAClB,QAAQ,CAAC,iFAAiF,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;AACrK,OAAO;AACP;AACA,IAAI,OAAO,MAAM;AACjB,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n fill,\n logger,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { UnleashClient, UnleashClientClass } from './types';\n\ntype UnleashIntegrationOptions = {\n featureFlagClientClass: UnleashClientClass;\n};\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Unleash SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { UnleashClient } from 'unleash-proxy-client';\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],\n * });\n *\n * const unleash = new UnleashClient(...);\n * unleash.start();\n *\n * unleash.isEnabled('my-feature');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const unleashIntegration = defineIntegration(\n ({ featureFlagClientClass: unleashClientClass }: UnleashIntegrationOptions) => {\n return {\n name: 'Unleash',\n\n setupOnce() {\n const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;\n fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n\n/**\n * Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.\n *\n * This wrapper is safe for all isEnabled signatures. If the signature does not match (this: UnleashClient, toggleName: string, ...args: unknown[]) => boolean,\n * we log an error and return the original result.\n *\n * @param original - The original method.\n * @returns Wrapped method. Results should match the original.\n */\nfunction _wrappedIsEnabled(\n original: (this: UnleashClient, ...args: unknown[]) => unknown,\n): (this: UnleashClient, ...args: unknown[]) => unknown {\n return function (this: UnleashClient, ...args: unknown[]): unknown {\n const toggleName = args[0];\n const result = original.apply(this, args);\n\n if (typeof toggleName === 'string' && typeof result === 'boolean') {\n _INTERNAL_insertFlagToScope(toggleName, result);\n _INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);\n } else if (DEBUG_BUILD) {\n logger.error(\n `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,\n );\n }\n return result;\n };\n}\n"],"names":["defineIntegration","fill","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan","DEBUG_BUILD","logger"],"mappings":";;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAEA,sBAAiB;AACnD,EAAE,CAAC,EAAE,sBAAsB,EAAE,kBAAmB,EAAC,KAAgC;AACjF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,SAAS,GAAG;AAClB,QAAQ,MAAM,sBAAA,GAAyB,kBAAkB,CAAC,SAAU;AACpE,QAAQC,SAAI,CAAC,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACpE,OAAO;;AAEP,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAOC,wCAAmC,CAAC,KAAK,CAAC;AACzD,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB;AAC1B,EAAE,QAAQ;AACV,EAAwD;AACxD,EAAE,OAAO,WAA+B,GAAG,IAAI,EAAsB;AACrE,IAAI,MAAM,UAAW,GAAE,IAAI,CAAC,CAAC,CAAC;AAC9B,IAAI,MAAM,MAAO,GAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;;AAE7C,IAAI,IAAI,OAAO,UAAW,KAAI,QAAS,IAAG,OAAO,MAAA,KAAW,SAAS,EAAE;AACvE,MAAMC,gCAA2B,CAAC,UAAU,EAAE,MAAM,CAAC;AACrD,MAAMC,yCAAoC,CAAC,UAAU,EAAE,MAAM,CAAC;AAC9D,KAAM,MAAK,IAAIC,sBAAW,EAAE;AAC5B,MAAMC,WAAM,CAAC,KAAK;AAClB,QAAQ,CAAC,iFAAiF,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;AACrK,OAAO;AACP;AACA,IAAI,OAAO,MAAM;AACjB,GAAG;AACH;;;;"}
@@ -44,7 +44,7 @@ function makeFetchTransport(
44
44
  }
45
45
 
46
46
  try {
47
- // TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL
47
+ // Note: We do not need to suppress tracing here, becasue we are using the native fetch, instead of our wrapped one.
48
48
  return nativeFetch(options.url, requestOptions).then(response => {
49
49
  pendingBodySize -= requestSize;
50
50
  pendingCount--;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["../../../../src/transports/fetch.ts"],"sourcesContent":["import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, rejectedSyncPromise } from '@sentry/core';\nimport { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';\nimport type { WINDOW } from '../helpers';\nimport type { BrowserTransportOptions } from './types';\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeFetchTransport(\n options: BrowserTransportOptions,\n nativeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch'),\n): Transport {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions: RequestInit = {\n body: request.body,\n method: 'POST',\n referrerPolicy: 'strict-origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60_000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n if (!nativeFetch) {\n clearCachedImplementation('fetch');\n return rejectedSyncPromise('No fetch implementation available');\n }\n\n try {\n // TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL\n return nativeFetch(options.url, requestOptions).then(response => {\n pendingBodySize -= requestSize;\n pendingCount--;\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n } catch (e) {\n clearCachedImplementation('fetch');\n pendingBodySize -= requestSize;\n pendingCount--;\n return rejectedSyncPromise(e);\n }\n }\n\n return createTransport(options, makeRequest);\n}\n"],"names":["getNativeImplementation","clearCachedImplementation","rejectedSyncPromise","createTransport"],"mappings":";;;;;AAMA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,OAAO;AACT,EAAE,WAAW,GAAoCA,oCAAuB,CAAC,OAAO,CAAC;AACjF,EAAa;AACb,EAAE,IAAI,eAAgB,GAAE,CAAC;AACzB,EAAE,IAAI,YAAa,GAAE,CAAC;;AAEtB,EAAE,SAAS,WAAW,CAAC,OAAO,EAA+D;AAC7F,IAAI,MAAM,WAAY,GAAE,OAAO,CAAC,IAAI,CAAC,MAAM;AAC3C,IAAI,eAAA,IAAmB,WAAW;AAClC,IAAI,YAAY,EAAE;;AAElB,IAAI,MAAM,cAAc,GAAgB;AACxC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI;AACxB,MAAM,MAAM,EAAE,MAAM;AACpB,MAAM,cAAc,EAAE,eAAe;AACrC,MAAM,OAAO,EAAE,OAAO,CAAC,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,EAAE,eAAgB,IAAG,SAAU,YAAA,GAAe,EAAE;AAC/D,MAAM,GAAG,OAAO,CAAC,YAAY;AAC7B,KAAK;;AAEL,IAAI,IAAI,CAAC,WAAW,EAAE;AACtB,MAAMC,sCAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,OAAOC,wBAAmB,CAAC,mCAAmC,CAAC;AACrE;;AAEA,IAAI,IAAI;AACR;AACA,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY;AACvE,QAAQ,eAAA,IAAmB,WAAW;AACtC,QAAQ,YAAY,EAAE;AACtB,QAAQ,OAAO;AACf,UAAU,UAAU,EAAE,QAAQ,CAAC,MAAM;AACrC,UAAU,OAAO,EAAE;AACnB,YAAY,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAChF,YAAY,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC9D,WAAW;AACX,SAAS;AACT,OAAO,CAAC;AACR,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAMD,sCAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,eAAA,IAAmB,WAAW;AACpC,MAAM,YAAY,EAAE;AACpB,MAAM,OAAOC,wBAAmB,CAAC,CAAC,CAAC;AACnC;AACA;;AAEA,EAAE,OAAOC,oBAAe,CAAC,OAAO,EAAE,WAAW,CAAC;AAC9C;;;;"}
1
+ {"version":3,"file":"fetch.js","sources":["../../../../src/transports/fetch.ts"],"sourcesContent":["import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, rejectedSyncPromise } from '@sentry/core';\nimport { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';\nimport type { WINDOW } from '../helpers';\nimport type { BrowserTransportOptions } from './types';\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeFetchTransport(\n options: BrowserTransportOptions,\n nativeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch'),\n): Transport {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions: RequestInit = {\n body: request.body,\n method: 'POST',\n referrerPolicy: 'strict-origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60_000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n if (!nativeFetch) {\n clearCachedImplementation('fetch');\n return rejectedSyncPromise('No fetch implementation available');\n }\n\n try {\n // Note: We do not need to suppress tracing here, becasue we are using the native fetch, instead of our wrapped one.\n return nativeFetch(options.url, requestOptions).then(response => {\n pendingBodySize -= requestSize;\n pendingCount--;\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n } catch (e) {\n clearCachedImplementation('fetch');\n pendingBodySize -= requestSize;\n pendingCount--;\n return rejectedSyncPromise(e);\n }\n }\n\n return createTransport(options, makeRequest);\n}\n"],"names":["getNativeImplementation","clearCachedImplementation","rejectedSyncPromise","createTransport"],"mappings":";;;;;AAMA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,OAAO;AACT,EAAE,WAAW,GAAoCA,oCAAuB,CAAC,OAAO,CAAC;AACjF,EAAa;AACb,EAAE,IAAI,eAAgB,GAAE,CAAC;AACzB,EAAE,IAAI,YAAa,GAAE,CAAC;;AAEtB,EAAE,SAAS,WAAW,CAAC,OAAO,EAA+D;AAC7F,IAAI,MAAM,WAAY,GAAE,OAAO,CAAC,IAAI,CAAC,MAAM;AAC3C,IAAI,eAAA,IAAmB,WAAW;AAClC,IAAI,YAAY,EAAE;;AAElB,IAAI,MAAM,cAAc,GAAgB;AACxC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI;AACxB,MAAM,MAAM,EAAE,MAAM;AACpB,MAAM,cAAc,EAAE,eAAe;AACrC,MAAM,OAAO,EAAE,OAAO,CAAC,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,EAAE,eAAgB,IAAG,SAAU,YAAA,GAAe,EAAE;AAC/D,MAAM,GAAG,OAAO,CAAC,YAAY;AAC7B,KAAK;;AAEL,IAAI,IAAI,CAAC,WAAW,EAAE;AACtB,MAAMC,sCAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,OAAOC,wBAAmB,CAAC,mCAAmC,CAAC;AACrE;;AAEA,IAAI,IAAI;AACR;AACA,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY;AACvE,QAAQ,eAAA,IAAmB,WAAW;AACtC,QAAQ,YAAY,EAAE;AACtB,QAAQ,OAAO;AACf,UAAU,UAAU,EAAE,QAAQ,CAAC,MAAM;AACrC,UAAU,OAAO,EAAE;AACnB,YAAY,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAChF,YAAY,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC9D,WAAW;AACX,SAAS;AACT,OAAO,CAAC;AACR,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAMD,sCAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,eAAA,IAAmB,WAAW;AACpC,MAAM,YAAY,EAAE;AACpB,MAAM,OAAOC,wBAAmB,CAAC,CAAC,CAAC;AACnC;AACA;;AAEA,EAAE,OAAOC,oBAAe,CAAC,OAAO,EAAE,WAAW,CAAC;AAC9C;;;;"}
@@ -2,7 +2,7 @@ export { feedbackAsyncIntegration } from './feedbackAsync.js';
2
2
  export { feedbackSyncIntegration as feedbackIntegration, feedbackSyncIntegration } from './feedbackSync.js';
3
3
  import * as log from './log.js';
4
4
  export { log as logger };
5
- export { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, captureConsoleIntegration, captureEvent, captureException, captureFeedback, captureMessage, captureSession, close, consoleLoggingIntegration, continueTrace, createTransport, dedupeIntegration, endSession, eventFiltersIntegration, extraErrorDataIntegration, flush, functionToStringIntegration, getActiveSpan, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSpanDescendants, getSpanStatusFromHttpCode, getTraceData, inboundFiltersIntegration, instrumentSupabaseClient, isEnabled, isInitialized, lastEventId, makeMultiplexedTransport, moduleMetadataIntegration, parameterize, registerSpanErrorInstrumentation, rewriteFramesIntegration, setContext, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, spanToBaggageHeader, spanToJSON, spanToTraceHeader, startInactiveSpan, startNewTrace, startSession, startSpan, startSpanManual, supabaseIntegration, suppressTracing, thirdPartyErrorFilterIntegration, updateSpanName, withActiveSpan, withIsolationScope, withScope, zodErrorsIntegration } from '@sentry/core';
5
+ export { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, captureConsoleIntegration, captureEvent, captureException, captureFeedback, captureMessage, captureSession, close, consoleLoggingIntegration, continueTrace, createTransport, dedupeIntegration, endSession, eventFiltersIntegration, extraErrorDataIntegration, featureFlagsIntegration, flush, functionToStringIntegration, getActiveSpan, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSpanDescendants, getSpanStatusFromHttpCode, getTraceData, inboundFiltersIntegration, instrumentSupabaseClient, isEnabled, isInitialized, lastEventId, makeMultiplexedTransport, moduleMetadataIntegration, parameterize, registerSpanErrorInstrumentation, rewriteFramesIntegration, setContext, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, spanToBaggageHeader, spanToJSON, spanToTraceHeader, startInactiveSpan, startNewTrace, startSession, startSpan, startSpanManual, supabaseIntegration, suppressTracing, thirdPartyErrorFilterIntegration, updateSpanName, withActiveSpan, withIsolationScope, withScope, zodErrorsIntegration } from '@sentry/core';
6
6
  export { WINDOW } from './helpers.js';
7
7
  export { BrowserClient } from './client.js';
8
8
  export { makeFetchTransport } from './transports/fetch.js';
@@ -30,7 +30,6 @@ export { makeBrowserOfflineTransport } from './transports/offline.js';
30
30
  export { browserProfilingIntegration } from './profiling/integration.js';
31
31
  export { spotlightBrowserIntegration } from './integrations/spotlight.js';
32
32
  export { browserSessionIntegration } from './integrations/browsersession.js';
33
- export { featureFlagsIntegration } from './integrations/featureFlags/featureFlagsIntegration.js';
34
33
  export { buildLaunchDarklyFlagUsedHandler, launchDarklyIntegration } from './integrations/featureFlags/launchdarkly/integration.js';
35
34
  export { OpenFeatureIntegrationHook, openFeatureIntegration } from './integrations/featureFlags/openfeature/integration.js';
36
35
  export { unleashIntegration } from './integrations/featureFlags/unleash/integration.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,7 @@
1
- import { defineIntegration } from '@sentry/core';
2
- import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags.js';
1
+ import { defineIntegration, _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan } from '@sentry/core';
3
2
 
4
3
  /**
5
- * Sentry integration for capturing feature flags from LaunchDarkly.
4
+ * Sentry integration for capturing feature flag evaluations from LaunchDarkly.
6
5
  *
7
6
  * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
8
7
  *
@@ -21,16 +20,16 @@ const launchDarklyIntegration = defineIntegration(() => {
21
20
  name: 'LaunchDarkly',
22
21
 
23
22
  processEvent(event, _hint, _client) {
24
- return copyFlagsFromScopeToEvent(event);
23
+ return _INTERNAL_copyFlagsFromScopeToEvent(event);
25
24
  },
26
25
  };
27
26
  }) ;
28
27
 
29
28
  /**
30
- * LaunchDarkly hook that listens for flag evaluations and updates the `flags`
31
- * context in our Sentry scope. This needs to be registered as an
32
- * 'inspector' in LaunchDarkly initialize() options, separately from
33
- * `launchDarklyIntegration`. Both are needed to collect feature flags on error.
29
+ * LaunchDarkly hook to listen for and buffer flag evaluations. This needs to
30
+ * be registered as an 'inspector' in LaunchDarkly initialize() options,
31
+ * separately from `launchDarklyIntegration`. Both the hook and the integration
32
+ * are needed to capture LaunchDarkly flags.
34
33
  */
35
34
  function buildLaunchDarklyFlagUsedHandler() {
36
35
  return {
@@ -43,7 +42,8 @@ function buildLaunchDarklyFlagUsedHandler() {
43
42
  * Handle a flag evaluation by storing its name and value on the current scope.
44
43
  */
45
44
  method: (flagKey, flagDetail, _context) => {
46
- insertFlagToScope(flagKey, flagDetail.value);
45
+ _INTERNAL_insertFlagToScope(flagKey, flagDetail.value);
46
+ _INTERNAL_addFeatureFlagToActiveSpan(flagKey, flagDetail.value);
47
47
  },
48
48
  };
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { LDContext, LDEvaluationDetail, LDInspectionFlagUsedHandler } from './types';\n\n/**\n * Sentry integration for capturing feature flags from LaunchDarkly.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from '@sentry/browser';\n * import {launchDarklyIntegration, buildLaunchDarklyFlagUsedInspector} from '@sentry/browser';\n * import * as LaunchDarkly from 'launchdarkly-js-client-sdk';\n *\n * Sentry.init(..., integrations: [launchDarklyIntegration()])\n * const ldClient = LaunchDarkly.initialize(..., {inspectors: [buildLaunchDarklyFlagUsedHandler()]});\n * ```\n */\nexport const launchDarklyIntegration = defineIntegration(() => {\n return {\n name: 'LaunchDarkly',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * LaunchDarkly hook that listens for flag evaluations and updates the `flags`\n * context in our Sentry scope. This needs to be registered as an\n * 'inspector' in LaunchDarkly initialize() options, separately from\n * `launchDarklyIntegration`. Both are needed to collect feature flags on error.\n */\nexport function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler {\n return {\n name: 'sentry-flag-auditor',\n type: 'flag-used',\n\n synchronous: true,\n\n /**\n * Handle a flag evaluation by storing its name and value on the current scope.\n */\n method: (flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext) => {\n insertFlagToScope(flagKey, flagDetail.value);\n },\n };\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAwB,GAAE,iBAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAO,yBAAyB,CAAC,KAAK,CAAC;AAC7C,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,GAAgC;AAChF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,IAAI,EAAE,WAAW;;AAErB,IAAI,WAAW,EAAE,IAAI;;AAErB;AACA;AACA;AACA,IAAI,MAAM,EAAE,CAAC,OAAO,EAAU,UAAU,EAAsB,QAAQ,KAAgB;AACtF,MAAM,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AAClD,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/launchdarkly/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { LDContext, LDEvaluationDetail, LDInspectionFlagUsedHandler } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from LaunchDarkly.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from '@sentry/browser';\n * import {launchDarklyIntegration, buildLaunchDarklyFlagUsedInspector} from '@sentry/browser';\n * import * as LaunchDarkly from 'launchdarkly-js-client-sdk';\n *\n * Sentry.init(..., integrations: [launchDarklyIntegration()])\n * const ldClient = LaunchDarkly.initialize(..., {inspectors: [buildLaunchDarklyFlagUsedHandler()]});\n * ```\n */\nexport const launchDarklyIntegration = defineIntegration(() => {\n return {\n name: 'LaunchDarkly',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * LaunchDarkly hook to listen for and buffer flag evaluations. This needs to\n * be registered as an 'inspector' in LaunchDarkly initialize() options,\n * separately from `launchDarklyIntegration`. Both the hook and the integration\n * are needed to capture LaunchDarkly flags.\n */\nexport function buildLaunchDarklyFlagUsedHandler(): LDInspectionFlagUsedHandler {\n return {\n name: 'sentry-flag-auditor',\n type: 'flag-used',\n\n synchronous: true,\n\n /**\n * Handle a flag evaluation by storing its name and value on the current scope.\n */\n method: (flagKey: string, flagDetail: LDEvaluationDetail, _context: LDContext) => {\n _INTERNAL_insertFlagToScope(flagKey, flagDetail.value);\n _INTERNAL_addFeatureFlagToActiveSpan(flagKey, flagDetail.value);\n },\n };\n}\n"],"names":[],"mappings":";;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAwB,GAAE,iBAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAO,mCAAmC,CAAC,KAAK,CAAC;AACvD,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,GAAgC;AAChF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,IAAI,EAAE,WAAW;;AAErB,IAAI,WAAW,EAAE,IAAI;;AAErB;AACA;AACA;AACA,IAAI,MAAM,EAAE,CAAC,OAAO,EAAU,UAAU,EAAsB,QAAQ,KAAgB;AACtF,MAAM,2BAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AAC5D,MAAM,oCAAoC,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;AACrE,KAAK;AACL,GAAG;AACH;;;;"}
@@ -1,12 +1,11 @@
1
- import { defineIntegration } from '@sentry/core';
2
- import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags.js';
1
+ import { defineIntegration, _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan } from '@sentry/core';
3
2
 
4
3
  const openFeatureIntegration = defineIntegration(() => {
5
4
  return {
6
5
  name: 'OpenFeature',
7
6
 
8
7
  processEvent(event, _hint, _client) {
9
- return copyFlagsFromScopeToEvent(event);
8
+ return _INTERNAL_copyFlagsFromScopeToEvent(event);
10
9
  },
11
10
  };
12
11
  }) ;
@@ -19,14 +18,16 @@ class OpenFeatureIntegrationHook {
19
18
  * Successful evaluation result.
20
19
  */
21
20
  after(_hookContext, evaluationDetails) {
22
- insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);
21
+ _INTERNAL_insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);
22
+ _INTERNAL_addFeatureFlagToActiveSpan(evaluationDetails.flagKey, evaluationDetails.value);
23
23
  }
24
24
 
25
25
  /**
26
26
  * On error evaluation result.
27
27
  */
28
28
  error(hookContext, _error, _hookHints) {
29
- insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);
29
+ _INTERNAL_insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);
30
+ _INTERNAL_addFeatureFlagToActiveSpan(hookContext.flagKey, hookContext.defaultValue);
30
31
  }
31
32
  }
32
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * OpenFeature integration.\n *\n * Add the openFeatureIntegration() function call to your integration lists.\n * Add the integration hook to your OpenFeature object.\n * - OpenFeature.getClient().addHooks(new OpenFeatureIntegrationHook());\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":[],"mappings":";;;MAYa,sBAAuB,GAAE,iBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;;AAEvB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAO,yBAAyB,CAAC,KAAK,CAAC;AAC7C,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACO,MAAM,4BAAsD;AACnE;AACA;AACA;AACA,GAAS,KAAK,CAAC,YAAY,EAAoC,iBAAiB,EAAsC;AACtH,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AACzE;;AAEA;AACA;AACA;AACA,GAAS,KAAK,CAAC,WAAW,EAAoC,MAAM,EAAW,UAAU,EAAoB;AAC7G,IAAI,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AACpE;AACA;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/openfeature/integration.ts"],"sourcesContent":["/**\n * Sentry integration for capturing OpenFeature feature flag evaluations.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from \"@sentry/browser\";\n * import { OpenFeature } from \"@openfeature/web-sdk\";\n *\n * Sentry.init(..., integrations: [Sentry.openFeatureIntegration()]);\n * OpenFeature.setProvider(new MyProviderOfChoice());\n * OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook());\n * ```\n */\nimport type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types';\n\nexport const openFeatureIntegration = defineIntegration(() => {\n return {\n name: 'OpenFeature',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * OpenFeature Hook class implementation.\n */\nexport class OpenFeatureIntegrationHook implements OpenFeatureHook {\n /**\n * Successful evaluation result.\n */\n public after(_hookContext: Readonly<HookContext<JsonValue>>, evaluationDetails: EvaluationDetails<JsonValue>): void {\n _INTERNAL_insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value);\n _INTERNAL_addFeatureFlagToActiveSpan(evaluationDetails.flagKey, evaluationDetails.value);\n }\n\n /**\n * On error evaluation result.\n */\n public error(hookContext: Readonly<HookContext<JsonValue>>, _error: unknown, _hookHints?: HookHints): void {\n _INTERNAL_insertFlagToScope(hookContext.flagKey, hookContext.defaultValue);\n _INTERNAL_addFeatureFlagToActiveSpan(hookContext.flagKey, hookContext.defaultValue);\n }\n}\n"],"names":[],"mappings":";;MAwBa,sBAAuB,GAAE,iBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;;AAEvB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAO,mCAAmC,CAAC,KAAK,CAAC;AACvD,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACO,MAAM,4BAAsD;AACnE;AACA;AACA;AACA,GAAS,KAAK,CAAC,YAAY,EAAoC,iBAAiB,EAAsC;AACtH,IAAI,2BAA2B,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AACnF,IAAI,oCAAoC,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC;AAC5F;;AAEA;AACA;AACA;AACA,GAAS,KAAK,CAAC,WAAW,EAAoC,MAAM,EAAW,UAAU,EAAoB;AAC7G,IAAI,2BAA2B,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AAC9E,IAAI,oCAAoC,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC;AACvF;AACA;;;;"}
@@ -1,5 +1,4 @@
1
- import { defineIntegration } from '@sentry/core';
2
- import { insertFlagToScope, copyFlagsFromScopeToEvent } from '../../../utils/featureFlags.js';
1
+ import { defineIntegration, _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan } from '@sentry/core';
3
2
 
4
3
  /**
5
4
  * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.
@@ -29,15 +28,16 @@ const statsigIntegration = defineIntegration(
29
28
  return {
30
29
  name: 'Statsig',
31
30
 
32
- processEvent(event, _hint, _client) {
33
- return copyFlagsFromScopeToEvent(event);
34
- },
35
-
36
- setup() {
31
+ setup(_client) {
37
32
  statsigClient.on('gate_evaluation', (event) => {
38
- insertFlagToScope(event.gate.name, event.gate.value);
33
+ _INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);
34
+ _INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);
39
35
  });
40
36
  },
37
+
38
+ processEvent(event, _hint, _client) {
39
+ return _INTERNAL_copyFlagsFromScopeToEvent(event);
40
+ },
41
41
  };
42
42
  },
43
43
  ) ;
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { FeatureGate, StatsigClient } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { StatsigClient } from '@statsig/js-client';\n * import * as Sentry from '@sentry/browser';\n *\n * const statsigClient = new StatsigClient();\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})],\n * });\n *\n * await statsigClient.initializeAsync(); // or statsigClient.initializeSync();\n *\n * const result = statsigClient.checkGate('my-feature-gate');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const statsigIntegration = defineIntegration(\n ({ featureFlagClient: statsigClient }: { featureFlagClient: StatsigClient }) => {\n return {\n name: 'Statsig',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n\n setup() {\n statsigClient.on('gate_evaluation', (event: { gate: FeatureGate }) => {\n insertFlagToScope(event.gate.name, event.gate.value);\n });\n },\n };\n },\n) satisfies IntegrationFn;\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAE,iBAAiB;AACnD,EAAE,CAAC,EAAE,iBAAiB,EAAE,aAAc,EAAC,KAA2C;AAClF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAO,yBAAyB,CAAC,KAAK,CAAC;AAC/C,OAAO;;AAEP,MAAM,KAAK,GAAG;AACd,QAAQ,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,KAA4B;AAC9E,UAAU,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC9D,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/statsig/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n} from '@sentry/core';\nimport type { FeatureGate, StatsigClient } from './types';\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Statsig js-client SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { StatsigClient } from '@statsig/js-client';\n * import * as Sentry from '@sentry/browser';\n *\n * const statsigClient = new StatsigClient();\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})],\n * });\n *\n * await statsigClient.initializeAsync(); // or statsigClient.initializeSync();\n *\n * const result = statsigClient.checkGate('my-feature-gate');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const statsigIntegration = defineIntegration(\n ({ featureFlagClient: statsigClient }: { featureFlagClient: StatsigClient }) => {\n return {\n name: 'Statsig',\n\n setup(_client: Client) {\n statsigClient.on('gate_evaluation', (event: { gate: FeatureGate }) => {\n _INTERNAL_insertFlagToScope(event.gate.name, event.gate.value);\n _INTERNAL_addFeatureFlagToActiveSpan(event.gate.name, event.gate.value);\n });\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n"],"names":[],"mappings":";;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAE,iBAAiB;AACnD,EAAE,CAAC,EAAE,iBAAiB,EAAE,aAAc,EAAC,KAA2C;AAClF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,KAAK,CAAC,OAAO,EAAU;AAC7B,QAAQ,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,KAA4B;AAC9E,UAAU,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACxE,UAAU,oCAAoC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACjF,SAAS,CAAC;AACV,OAAO;;AAEP,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAO,mCAAmC,CAAC,KAAK,CAAC;AACzD,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;;;"}
@@ -1,6 +1,5 @@
1
- import { defineIntegration, fill, logger } from '@sentry/core';
1
+ import { defineIntegration, _INTERNAL_copyFlagsFromScopeToEvent, fill, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan, logger } from '@sentry/core';
2
2
  import { DEBUG_BUILD } from '../../../debug-build.js';
3
- import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags.js';
4
3
 
5
4
  /**
6
5
  * Sentry integration for capturing feature flag evaluations from the Unleash SDK.
@@ -29,14 +28,14 @@ const unleashIntegration = defineIntegration(
29
28
  return {
30
29
  name: 'Unleash',
31
30
 
32
- processEvent(event, _hint, _client) {
33
- return copyFlagsFromScopeToEvent(event);
34
- },
35
-
36
31
  setupOnce() {
37
32
  const unleashClientPrototype = unleashClientClass.prototype ;
38
33
  fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);
39
34
  },
35
+
36
+ processEvent(event, _hint, _client) {
37
+ return _INTERNAL_copyFlagsFromScopeToEvent(event);
38
+ },
40
39
  };
41
40
  },
42
41
  ) ;
@@ -58,7 +57,8 @@ function _wrappedIsEnabled(
58
57
  const result = original.apply(this, args);
59
58
 
60
59
  if (typeof toggleName === 'string' && typeof result === 'boolean') {
61
- insertFlagToScope(toggleName, result);
60
+ _INTERNAL_insertFlagToScope(toggleName, result);
61
+ _INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);
62
62
  } else if (DEBUG_BUILD) {
63
63
  logger.error(
64
64
  `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';\nimport type { UnleashClient, UnleashClientClass } from './types';\n\ntype UnleashIntegrationOptions = {\n featureFlagClientClass: UnleashClientClass;\n};\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Unleash SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { UnleashClient } from 'unleash-proxy-client';\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],\n * });\n *\n * const unleash = new UnleashClient(...);\n * unleash.start();\n *\n * unleash.isEnabled('my-feature');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const unleashIntegration = defineIntegration(\n ({ featureFlagClientClass: unleashClientClass }: UnleashIntegrationOptions) => {\n return {\n name: 'Unleash',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return copyFlagsFromScopeToEvent(event);\n },\n\n setupOnce() {\n const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;\n fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);\n },\n };\n },\n) satisfies IntegrationFn;\n\n/**\n * Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.\n *\n * This wrapper is safe for all isEnabled signatures. If the signature does not match (this: UnleashClient, toggleName: string, ...args: unknown[]) => boolean,\n * we log an error and return the original result.\n *\n * @param original - The original method.\n * @returns Wrapped method. Results should match the original.\n */\nfunction _wrappedIsEnabled(\n original: (this: UnleashClient, ...args: unknown[]) => unknown,\n): (this: UnleashClient, ...args: unknown[]) => unknown {\n return function (this: UnleashClient, ...args: unknown[]): unknown {\n const toggleName = args[0];\n const result = original.apply(this, args);\n\n if (typeof toggleName === 'string' && typeof result === 'boolean') {\n insertFlagToScope(toggleName, result);\n } else if (DEBUG_BUILD) {\n logger.error(\n `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,\n );\n }\n return result;\n };\n}\n"],"names":[],"mappings":";;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAE,iBAAiB;AACnD,EAAE,CAAC,EAAE,sBAAsB,EAAE,kBAAmB,EAAC,KAAgC;AACjF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAO,yBAAyB,CAAC,KAAK,CAAC;AAC/C,OAAO;;AAEP,MAAM,SAAS,GAAG;AAClB,QAAQ,MAAM,sBAAA,GAAyB,kBAAkB,CAAC,SAAU;AACpE,QAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACpE,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB;AAC1B,EAAE,QAAQ;AACV,EAAwD;AACxD,EAAE,OAAO,WAA+B,GAAG,IAAI,EAAsB;AACrE,IAAI,MAAM,UAAW,GAAE,IAAI,CAAC,CAAC,CAAC;AAC9B,IAAI,MAAM,MAAO,GAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;;AAE7C,IAAI,IAAI,OAAO,UAAW,KAAI,QAAS,IAAG,OAAO,MAAA,KAAW,SAAS,EAAE;AACvE,MAAM,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC;AAC3C,KAAM,MAAK,IAAI,WAAW,EAAE;AAC5B,MAAM,MAAM,CAAC,KAAK;AAClB,QAAQ,CAAC,iFAAiF,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;AACrK,OAAO;AACP;AACA,IAAI,OAAO,MAAM;AACjB,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../../../../../src/integrations/featureFlags/unleash/integration.ts"],"sourcesContent":["import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n defineIntegration,\n fill,\n logger,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { UnleashClient, UnleashClientClass } from './types';\n\ntype UnleashIntegrationOptions = {\n featureFlagClientClass: UnleashClientClass;\n};\n\n/**\n * Sentry integration for capturing feature flag evaluations from the Unleash SDK.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import { UnleashClient } from 'unleash-proxy-client';\n * import * as Sentry from '@sentry/browser';\n *\n * Sentry.init({\n * dsn: '___PUBLIC_DSN___',\n * integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],\n * });\n *\n * const unleash = new UnleashClient(...);\n * unleash.start();\n *\n * unleash.isEnabled('my-feature');\n * Sentry.captureException(new Error('something went wrong'));\n * ```\n */\nexport const unleashIntegration = defineIntegration(\n ({ featureFlagClientClass: unleashClientClass }: UnleashIntegrationOptions) => {\n return {\n name: 'Unleash',\n\n setupOnce() {\n const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;\n fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);\n },\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n };\n },\n) satisfies IntegrationFn;\n\n/**\n * Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.\n *\n * This wrapper is safe for all isEnabled signatures. If the signature does not match (this: UnleashClient, toggleName: string, ...args: unknown[]) => boolean,\n * we log an error and return the original result.\n *\n * @param original - The original method.\n * @returns Wrapped method. Results should match the original.\n */\nfunction _wrappedIsEnabled(\n original: (this: UnleashClient, ...args: unknown[]) => unknown,\n): (this: UnleashClient, ...args: unknown[]) => unknown {\n return function (this: UnleashClient, ...args: unknown[]): unknown {\n const toggleName = args[0];\n const result = original.apply(this, args);\n\n if (typeof toggleName === 'string' && typeof result === 'boolean') {\n _INTERNAL_insertFlagToScope(toggleName, result);\n _INTERNAL_addFeatureFlagToActiveSpan(toggleName, result);\n } else if (DEBUG_BUILD) {\n logger.error(\n `[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,\n );\n }\n return result;\n };\n}\n"],"names":[],"mappings":";;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAmB,GAAE,iBAAiB;AACnD,EAAE,CAAC,EAAE,sBAAsB,EAAE,kBAAmB,EAAC,KAAgC;AACjF,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,SAAS;;AAErB,MAAM,SAAS,GAAG;AAClB,QAAQ,MAAM,sBAAA,GAAyB,kBAAkB,CAAC,SAAU;AACpE,QAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACpE,OAAO;;AAEP,MAAM,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AAC3E,QAAQ,OAAO,mCAAmC,CAAC,KAAK,CAAC;AACzD,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB;AAC1B,EAAE,QAAQ;AACV,EAAwD;AACxD,EAAE,OAAO,WAA+B,GAAG,IAAI,EAAsB;AACrE,IAAI,MAAM,UAAW,GAAE,IAAI,CAAC,CAAC,CAAC;AAC9B,IAAI,MAAM,MAAO,GAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;;AAE7C,IAAI,IAAI,OAAO,UAAW,KAAI,QAAS,IAAG,OAAO,MAAA,KAAW,SAAS,EAAE;AACvE,MAAM,2BAA2B,CAAC,UAAU,EAAE,MAAM,CAAC;AACrD,MAAM,oCAAoC,CAAC,UAAU,EAAE,MAAM,CAAC;AAC9D,KAAM,MAAK,IAAI,WAAW,EAAE;AAC5B,MAAM,MAAM,CAAC,KAAK;AAClB,QAAQ,CAAC,iFAAiF,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;AACrK,OAAO;AACP;AACA,IAAI,OAAO,MAAM;AACjB,GAAG;AACH;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"9.30.0","sideEffects":false}
1
+ {"type":"module","version":"9.32.0","sideEffects":false}
@@ -42,7 +42,7 @@ function makeFetchTransport(
42
42
  }
43
43
 
44
44
  try {
45
- // TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL
45
+ // Note: We do not need to suppress tracing here, becasue we are using the native fetch, instead of our wrapped one.
46
46
  return nativeFetch(options.url, requestOptions).then(response => {
47
47
  pendingBodySize -= requestSize;
48
48
  pendingCount--;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["../../../../src/transports/fetch.ts"],"sourcesContent":["import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, rejectedSyncPromise } from '@sentry/core';\nimport { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';\nimport type { WINDOW } from '../helpers';\nimport type { BrowserTransportOptions } from './types';\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeFetchTransport(\n options: BrowserTransportOptions,\n nativeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch'),\n): Transport {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions: RequestInit = {\n body: request.body,\n method: 'POST',\n referrerPolicy: 'strict-origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60_000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n if (!nativeFetch) {\n clearCachedImplementation('fetch');\n return rejectedSyncPromise('No fetch implementation available');\n }\n\n try {\n // TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL\n return nativeFetch(options.url, requestOptions).then(response => {\n pendingBodySize -= requestSize;\n pendingCount--;\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n } catch (e) {\n clearCachedImplementation('fetch');\n pendingBodySize -= requestSize;\n pendingCount--;\n return rejectedSyncPromise(e);\n }\n }\n\n return createTransport(options, makeRequest);\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,OAAO;AACT,EAAE,WAAW,GAAoC,uBAAuB,CAAC,OAAO,CAAC;AACjF,EAAa;AACb,EAAE,IAAI,eAAgB,GAAE,CAAC;AACzB,EAAE,IAAI,YAAa,GAAE,CAAC;;AAEtB,EAAE,SAAS,WAAW,CAAC,OAAO,EAA+D;AAC7F,IAAI,MAAM,WAAY,GAAE,OAAO,CAAC,IAAI,CAAC,MAAM;AAC3C,IAAI,eAAA,IAAmB,WAAW;AAClC,IAAI,YAAY,EAAE;;AAElB,IAAI,MAAM,cAAc,GAAgB;AACxC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI;AACxB,MAAM,MAAM,EAAE,MAAM;AACpB,MAAM,cAAc,EAAE,eAAe;AACrC,MAAM,OAAO,EAAE,OAAO,CAAC,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,EAAE,eAAgB,IAAG,SAAU,YAAA,GAAe,EAAE;AAC/D,MAAM,GAAG,OAAO,CAAC,YAAY;AAC7B,KAAK;;AAEL,IAAI,IAAI,CAAC,WAAW,EAAE;AACtB,MAAM,yBAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,OAAO,mBAAmB,CAAC,mCAAmC,CAAC;AACrE;;AAEA,IAAI,IAAI;AACR;AACA,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY;AACvE,QAAQ,eAAA,IAAmB,WAAW;AACtC,QAAQ,YAAY,EAAE;AACtB,QAAQ,OAAO;AACf,UAAU,UAAU,EAAE,QAAQ,CAAC,MAAM;AACrC,UAAU,OAAO,EAAE;AACnB,YAAY,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAChF,YAAY,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC9D,WAAW;AACX,SAAS;AACT,OAAO,CAAC;AACR,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAM,yBAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,eAAA,IAAmB,WAAW;AACpC,MAAM,YAAY,EAAE;AACpB,MAAM,OAAO,mBAAmB,CAAC,CAAC,CAAC;AACnC;AACA;;AAEA,EAAE,OAAO,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC;AAC9C;;;;"}
1
+ {"version":3,"file":"fetch.js","sources":["../../../../src/transports/fetch.ts"],"sourcesContent":["import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';\nimport { createTransport, rejectedSyncPromise } from '@sentry/core';\nimport { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';\nimport type { WINDOW } from '../helpers';\nimport type { BrowserTransportOptions } from './types';\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nexport function makeFetchTransport(\n options: BrowserTransportOptions,\n nativeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch'),\n): Transport {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions: RequestInit = {\n body: request.body,\n method: 'POST',\n referrerPolicy: 'strict-origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60_000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n if (!nativeFetch) {\n clearCachedImplementation('fetch');\n return rejectedSyncPromise('No fetch implementation available');\n }\n\n try {\n // Note: We do not need to suppress tracing here, becasue we are using the native fetch, instead of our wrapped one.\n return nativeFetch(options.url, requestOptions).then(response => {\n pendingBodySize -= requestSize;\n pendingCount--;\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n } catch (e) {\n clearCachedImplementation('fetch');\n pendingBodySize -= requestSize;\n pendingCount--;\n return rejectedSyncPromise(e);\n }\n }\n\n return createTransport(options, makeRequest);\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,OAAO;AACT,EAAE,WAAW,GAAoC,uBAAuB,CAAC,OAAO,CAAC;AACjF,EAAa;AACb,EAAE,IAAI,eAAgB,GAAE,CAAC;AACzB,EAAE,IAAI,YAAa,GAAE,CAAC;;AAEtB,EAAE,SAAS,WAAW,CAAC,OAAO,EAA+D;AAC7F,IAAI,MAAM,WAAY,GAAE,OAAO,CAAC,IAAI,CAAC,MAAM;AAC3C,IAAI,eAAA,IAAmB,WAAW;AAClC,IAAI,YAAY,EAAE;;AAElB,IAAI,MAAM,cAAc,GAAgB;AACxC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI;AACxB,MAAM,MAAM,EAAE,MAAM;AACpB,MAAM,cAAc,EAAE,eAAe;AACrC,MAAM,OAAO,EAAE,OAAO,CAAC,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,EAAE,eAAgB,IAAG,SAAU,YAAA,GAAe,EAAE;AAC/D,MAAM,GAAG,OAAO,CAAC,YAAY;AAC7B,KAAK;;AAEL,IAAI,IAAI,CAAC,WAAW,EAAE;AACtB,MAAM,yBAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,OAAO,mBAAmB,CAAC,mCAAmC,CAAC;AACrE;;AAEA,IAAI,IAAI;AACR;AACA,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY;AACvE,QAAQ,eAAA,IAAmB,WAAW;AACtC,QAAQ,YAAY,EAAE;AACtB,QAAQ,OAAO;AACf,UAAU,UAAU,EAAE,QAAQ,CAAC,MAAM;AACrC,UAAU,OAAO,EAAE;AACnB,YAAY,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAChF,YAAY,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC9D,WAAW;AACX,SAAS;AACT,OAAO,CAAC;AACR,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAM,yBAAyB,CAAC,OAAO,CAAC;AACxC,MAAM,eAAA,IAAmB,WAAW;AACpC,MAAM,YAAY,EAAE;AACpB,MAAM,OAAO,mBAAmB,CAAC,CAAC,CAAC;AACnC;AACA;;AAEA,EAAE,OAAO,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC;AAC9C;;;;"}
@@ -25,6 +25,7 @@ export declare const WINDOW: {
25
25
  _sentryDebugIds?: Record<string, string> | undefined;
26
26
  _sentryModuleMetadata?: Record<string, any> | undefined;
27
27
  _sentryEsmLoaderHookRegistered?: boolean | undefined;
28
+ _spanToFlagBufferMap?: WeakMap<import("@sentry/core").Span, Set<string>> | undefined;
28
29
  } & import("@sentry/core").Carrier & Window;
29
30
  /**
30
31
  * @hidden
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAa/D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;2CAA2C,CAAC;AAI/D;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAGD,KAAK,iBAAiB,GAAG,QAAQ,CAAC;AAElC,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAC9C,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,eAAe,CAAC,CAAC,CAAC,CAAC;AACtB,wBAAgB,IAAI,CAAC,WAAW,EAC9B,EAAE,EAAE,WAAW,EACf,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,WAAW,CAAC;AAkIf;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAgBrF"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAa/D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAA2C,CAAC;AAI/D;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAGD,KAAK,iBAAiB,GAAG,QAAQ,CAAC;AAElC,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAC9C,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,eAAe,CAAC,CAAC,CAAC,CAAC;AACtB,wBAAgB,IAAI,CAAC,WAAW,EAC9B,EAAE,EAAE,WAAW,EACf,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACA,WAAW,CAAC;AAkIf;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAgBrF"}