@sentry/core 10.39.0-alpha.0 → 10.39.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 (155) hide show
  1. package/build/cjs/attributes.js.map +1 -1
  2. package/build/cjs/client.js +6 -13
  3. package/build/cjs/client.js.map +1 -1
  4. package/build/cjs/envelope.js +7 -41
  5. package/build/cjs/envelope.js.map +1 -1
  6. package/build/cjs/index.js +0 -48
  7. package/build/cjs/index.js.map +1 -1
  8. package/build/cjs/integration.js +0 -12
  9. package/build/cjs/integration.js.map +1 -1
  10. package/build/cjs/integrations/eventFilters.js +1 -1
  11. package/build/cjs/integrations/eventFilters.js.map +1 -1
  12. package/build/cjs/integrations/requestdata.js +6 -72
  13. package/build/cjs/integrations/requestdata.js.map +1 -1
  14. package/build/cjs/semanticAttributes.js +0 -84
  15. package/build/cjs/semanticAttributes.js.map +1 -1
  16. package/build/cjs/tracing/sentrySpan.js +0 -32
  17. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  18. package/build/cjs/tracing/trace.js +0 -1
  19. package/build/cjs/tracing/trace.js.map +1 -1
  20. package/build/cjs/tracing/vercel-ai/index.js +0 -1
  21. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  22. package/build/cjs/utils/featureFlags.js +0 -1
  23. package/build/cjs/utils/featureFlags.js.map +1 -1
  24. package/build/cjs/utils/scopeData.js +0 -4
  25. package/build/cjs/utils/scopeData.js.map +1 -1
  26. package/build/cjs/utils/should-ignore-span.js +9 -31
  27. package/build/cjs/utils/should-ignore-span.js.map +1 -1
  28. package/build/cjs/utils/spanUtils.js +2 -90
  29. package/build/cjs/utils/spanUtils.js.map +1 -1
  30. package/build/cjs/utils/version.js +1 -1
  31. package/build/cjs/utils/version.js.map +1 -1
  32. package/build/esm/attributes.js.map +1 -1
  33. package/build/esm/client.js +2 -9
  34. package/build/esm/client.js.map +1 -1
  35. package/build/esm/envelope.js +8 -41
  36. package/build/esm/envelope.js.map +1 -1
  37. package/build/esm/index.js +3 -10
  38. package/build/esm/index.js.map +1 -1
  39. package/build/esm/integration.js +1 -12
  40. package/build/esm/integration.js.map +1 -1
  41. package/build/esm/integrations/eventFilters.js +1 -1
  42. package/build/esm/integrations/eventFilters.js.map +1 -1
  43. package/build/esm/integrations/requestdata.js +6 -72
  44. package/build/esm/integrations/requestdata.js.map +1 -1
  45. package/build/esm/package.json +1 -1
  46. package/build/esm/semanticAttributes.js +1 -57
  47. package/build/esm/semanticAttributes.js.map +1 -1
  48. package/build/esm/tracing/sentrySpan.js +1 -33
  49. package/build/esm/tracing/sentrySpan.js.map +1 -1
  50. package/build/esm/tracing/trace.js +0 -1
  51. package/build/esm/tracing/trace.js.map +1 -1
  52. package/build/esm/tracing/vercel-ai/index.js +0 -1
  53. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  54. package/build/esm/utils/featureFlags.js +0 -1
  55. package/build/esm/utils/featureFlags.js.map +1 -1
  56. package/build/esm/utils/scopeData.js +0 -4
  57. package/build/esm/utils/scopeData.js.map +1 -1
  58. package/build/esm/utils/should-ignore-span.js +9 -31
  59. package/build/esm/utils/should-ignore-span.js.map +1 -1
  60. package/build/esm/utils/spanUtils.js +3 -87
  61. package/build/esm/utils/spanUtils.js.map +1 -1
  62. package/build/esm/utils/version.js +1 -1
  63. package/build/esm/utils/version.js.map +1 -1
  64. package/build/types/attributes.d.ts +1 -1
  65. package/build/types/attributes.d.ts.map +1 -1
  66. package/build/types/client.d.ts +2 -40
  67. package/build/types/client.d.ts.map +1 -1
  68. package/build/types/envelope.d.ts +1 -6
  69. package/build/types/envelope.d.ts.map +1 -1
  70. package/build/types/index.d.ts +4 -11
  71. package/build/types/index.d.ts.map +1 -1
  72. package/build/types/integration.d.ts +0 -4
  73. package/build/types/integration.d.ts.map +1 -1
  74. package/build/types/integrations/requestdata.d.ts.map +1 -1
  75. package/build/types/semanticAttributes.d.ts +0 -38
  76. package/build/types/semanticAttributes.d.ts.map +1 -1
  77. package/build/types/tracing/sentrySpan.d.ts +1 -10
  78. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  79. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  80. package/build/types/types-hoist/envelope.d.ts +2 -22
  81. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  82. package/build/types/types-hoist/integration.d.ts +0 -7
  83. package/build/types/types-hoist/integration.d.ts.map +1 -1
  84. package/build/types/types-hoist/link.d.ts +2 -2
  85. package/build/types/types-hoist/link.d.ts.map +1 -1
  86. package/build/types/types-hoist/options.d.ts +2 -18
  87. package/build/types/types-hoist/options.d.ts.map +1 -1
  88. package/build/types/types-hoist/span.d.ts +0 -27
  89. package/build/types/types-hoist/span.d.ts.map +1 -1
  90. package/build/types/utils/featureFlags.d.ts.map +1 -1
  91. package/build/types/utils/scopeData.d.ts.map +1 -1
  92. package/build/types/utils/should-ignore-span.d.ts +3 -3
  93. package/build/types/utils/should-ignore-span.d.ts.map +1 -1
  94. package/build/types/utils/spanUtils.d.ts +2 -22
  95. package/build/types/utils/spanUtils.d.ts.map +1 -1
  96. package/build/types-ts3.8/attributes.d.ts +1 -1
  97. package/build/types-ts3.8/client.d.ts +2 -40
  98. package/build/types-ts3.8/envelope.d.ts +1 -6
  99. package/build/types-ts3.8/index.d.ts +4 -11
  100. package/build/types-ts3.8/integration.d.ts +0 -4
  101. package/build/types-ts3.8/semanticAttributes.d.ts +0 -38
  102. package/build/types-ts3.8/tracing/sentrySpan.d.ts +1 -10
  103. package/build/types-ts3.8/types-hoist/envelope.d.ts +2 -22
  104. package/build/types-ts3.8/types-hoist/integration.d.ts +0 -7
  105. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  106. package/build/types-ts3.8/types-hoist/options.d.ts +2 -18
  107. package/build/types-ts3.8/types-hoist/span.d.ts +0 -27
  108. package/build/types-ts3.8/utils/should-ignore-span.d.ts +3 -3
  109. package/build/types-ts3.8/utils/spanUtils.d.ts +2 -22
  110. package/package.json +1 -1
  111. package/build/cjs/integrations/spanStreaming.js +0 -54
  112. package/build/cjs/integrations/spanStreaming.js.map +0 -1
  113. package/build/cjs/spans/captureSpan.js +0 -104
  114. package/build/cjs/spans/captureSpan.js.map +0 -1
  115. package/build/cjs/spans/spanBuffer.js +0 -121
  116. package/build/cjs/spans/spanBuffer.js.map +0 -1
  117. package/build/cjs/spans/spanFirstUtils.js +0 -186
  118. package/build/cjs/spans/spanFirstUtils.js.map +0 -1
  119. package/build/cjs/utils/beforeSendSpan.js +0 -36
  120. package/build/cjs/utils/beforeSendSpan.js.map +0 -1
  121. package/build/cjs/utils/hasSpanStreamingEnabled.js +0 -21
  122. package/build/cjs/utils/hasSpanStreamingEnabled.js.map +0 -1
  123. package/build/esm/integrations/spanStreaming.js +0 -52
  124. package/build/esm/integrations/spanStreaming.js.map +0 -1
  125. package/build/esm/spans/captureSpan.js +0 -102
  126. package/build/esm/spans/captureSpan.js.map +0 -1
  127. package/build/esm/spans/spanBuffer.js +0 -119
  128. package/build/esm/spans/spanBuffer.js.map +0 -1
  129. package/build/esm/spans/spanFirstUtils.js +0 -182
  130. package/build/esm/spans/spanFirstUtils.js.map +0 -1
  131. package/build/esm/utils/beforeSendSpan.js +0 -33
  132. package/build/esm/utils/beforeSendSpan.js.map +0 -1
  133. package/build/esm/utils/hasSpanStreamingEnabled.js +0 -19
  134. package/build/esm/utils/hasSpanStreamingEnabled.js.map +0 -1
  135. package/build/types/integrations/spanStreaming.d.ts +0 -11
  136. package/build/types/integrations/spanStreaming.d.ts.map +0 -1
  137. package/build/types/spans/captureSpan.d.ts +0 -10
  138. package/build/types/spans/captureSpan.d.ts.map +0 -1
  139. package/build/types/spans/spanBuffer.d.ts +0 -35
  140. package/build/types/spans/spanBuffer.d.ts.map +0 -1
  141. package/build/types/spans/spanFirstUtils.d.ts +0 -20
  142. package/build/types/spans/spanFirstUtils.d.ts.map +0 -1
  143. package/build/types/types-hoist/attributes.d.ts +0 -19
  144. package/build/types/types-hoist/attributes.d.ts.map +0 -1
  145. package/build/types/utils/beforeSendSpan.d.ts +0 -22
  146. package/build/types/utils/beforeSendSpan.d.ts.map +0 -1
  147. package/build/types/utils/hasSpanStreamingEnabled.d.ts +0 -9
  148. package/build/types/utils/hasSpanStreamingEnabled.d.ts.map +0 -1
  149. package/build/types-ts3.8/integrations/spanStreaming.d.ts +0 -11
  150. package/build/types-ts3.8/spans/captureSpan.d.ts +0 -10
  151. package/build/types-ts3.8/spans/spanBuffer.d.ts +0 -35
  152. package/build/types-ts3.8/spans/spanFirstUtils.d.ts +0 -20
  153. package/build/types-ts3.8/types-hoist/attributes.d.ts +0 -19
  154. package/build/types-ts3.8/utils/beforeSendSpan.d.ts +0 -22
  155. package/build/types-ts3.8/utils/hasSpanStreamingEnabled.d.ts +0 -9
@@ -9,8 +9,8 @@ export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromScope
9
9
  export { setMeasurement, timedEventsToMeasurements } from './tracing/measurement.js';
10
10
  export { sampleSpan } from './tracing/sampling.js';
11
11
  export { logSpanEnd, logSpanStart } from './tracing/logSpans.js';
12
- export { GEN_AI_CONVERSATION_ID_ATTRIBUTE, SEMANTIC_ATTRIBUTE_BROWSER_CONNECTION_RTT, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_TIME_TO_FIRST_BYTE, SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID, SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SPAN_SOURCE, SEMANTIC_ATTRIBUTE_URL_FULL, SEMANTIC_ATTRIBUTE_URL_QUERY, SEMANTIC_ATTRIBUTE_USER_EMAIL, SEMANTIC_ATTRIBUTE_USER_ID, SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS, SEMANTIC_ATTRIBUTE_USER_USERNAME, SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_SOURCES, SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_FCP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_FP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_INP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ELEMENT, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ID, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_LOAD_TIME, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_RENDER_TIME, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_SIZE, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_URL, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_REQUEST_TIME, SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_VALUE, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE } from './semanticAttributes.js';
13
- export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope, createSpanV2Envelope } from './envelope.js';
12
+ export { GEN_AI_CONVERSATION_ID_ATTRIBUTE, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_URL_FULL, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE } from './semanticAttributes.js';
13
+ export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope.js';
14
14
  export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js';
15
15
  export { getClient, getCurrentScope, getGlobalScope, getIsolationScope, getTraceContextFromScope, withIsolationScope, withScope } from './currentScopes.js';
16
16
  export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes.js';
@@ -33,15 +33,11 @@ export { applyScopeDataToEvent, getCombinedScopeData, mergeScopeData } from './u
33
33
  export { prepareEvent } from './utils/prepareEvent.js';
34
34
  export { createCheckInEnvelope } from './checkin.js';
35
35
  export { hasSpansEnabled } from './utils/hasSpansEnabled.js';
36
- export { hasSpanStreamingEnabled } from './utils/hasSpanStreamingEnabled.js';
37
36
  export { isSentryRequestUrl } from './utils/isSentryRequestUrl.js';
38
37
  export { handleCallbackErrors } from './utils/handleCallbackErrors.js';
39
38
  export { fmt, parameterize } from './utils/parameterize.js';
40
39
  export { addAutoIpAddressToSession, addAutoIpAddressToUser } from './utils/ipAddress.js';
41
- export { INTERNAL_getSegmentSpan, addChildSpanToSpan, convertSpanLinksForEnvelope, getActiveSpan, getRootSpan, getSpanDescendants, getStatusMessage, showSpanDropWarning, spanIsSampled, spanTimeInputToSeconds, spanToJSON, spanToTraceContext, spanToTraceHeader, spanToV2JSON, updateSpanName } from './utils/spanUtils.js';
42
- export { captureSpan } from './spans/captureSpan.js';
43
- export { safeSetSpanJSONAttributes } from './spans/spanFirstUtils.js';
44
- export { SpanBuffer } from './spans/spanBuffer.js';
40
+ export { addChildSpanToSpan, convertSpanLinksForEnvelope, getActiveSpan, getRootSpan, getSpanDescendants, getStatusMessage, spanIsSampled, spanTimeInputToSeconds, spanToJSON, spanToTraceContext, spanToTraceHeader, updateSpanName } from './utils/spanUtils.js';
45
41
  export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope.js';
46
42
  export { parseSampleRate } from './utils/parseSampleRate.js';
47
43
  export { applySdkMetadata } from './utils/sdkMetadata.js';
@@ -68,7 +64,6 @@ export { consoleIntegration } from './integrations/console.js';
68
64
  export { featureFlagsIntegration } from './integrations/featureFlags/featureFlagsIntegration.js';
69
65
  export { growthbookIntegration } from './integrations/featureFlags/growthbook.js';
70
66
  export { conversationIdIntegration } from './integrations/conversationId.js';
71
- export { spanStreamingIntegration } from './integrations/spanStreaming.js';
72
67
  export { profiler } from './profiling.js';
73
68
  export { instrumentFetchRequest } from './fetch.js';
74
69
  export { trpcMiddleware } from './trpc.js';
@@ -140,7 +135,5 @@ export { SDK_VERSION } from './utils/version.js';
140
135
  export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids.js';
141
136
  export { getFilenameToMetadataMap } from './metadata.js';
142
137
  export { escapeStringForRegex } from './vendor/escapeStringForRegex.js';
143
- export { isV2BeforeSendSpanCallback, withStreamSpan } from './utils/beforeSendSpan.js';
144
- export { reparentChildSpans, shouldIgnoreSpan } from './utils/should-ignore-span.js';
145
138
  export { safeDateNow as _INTERNAL_safeDateNow, safeMathRandom as _INTERNAL_safeMathRandom, withRandomSafeContext as _INTERNAL_withRandomSafeContext } from './utils/randomSafeContext.js';
146
139
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -77,17 +77,6 @@ function setupIntegrations(client, integrations) {
77
77
  return integrationIndex;
78
78
  }
79
79
 
80
- /**
81
- * Runs the `beforeSetup` hooks of the given integrations on the given client.
82
- */
83
- function beforeSetupIntegrations(client, integrations) {
84
- for (const integration of integrations) {
85
- if (integration?.beforeSetup) {
86
- integration.beforeSetup(client);
87
- }
88
- }
89
- }
90
-
91
80
  /**
92
81
  * Execute the `afterAllSetup` hooks of the given integrations.
93
82
  */
@@ -157,5 +146,5 @@ function defineIntegration(fn) {
157
146
  return fn;
158
147
  }
159
148
 
160
- export { addIntegration, afterSetupIntegrations, beforeSetupIntegrations, defineIntegration, getIntegrationsToSetup, installedIntegrations, setupIntegration, setupIntegrations };
149
+ export { addIntegration, afterSetupIntegrations, defineIntegration, getIntegrationsToSetup, installedIntegrations, setupIntegration, setupIntegrations };
161
150
  //# sourceMappingURL=integration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sources":["../../src/integration.ts"],"sourcesContent":["import type { Client } from './client';\nimport { getClient } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { Event, EventHint } from './types-hoist/event';\nimport type { Integration, IntegrationFn } from './types-hoist/integration';\nimport type { CoreOptions } from './types-hoist/options';\nimport { debug } from './utils/debug-logger';\n\nexport const installedIntegrations: string[] = [];\n\n/** Map of integrations assigned to a client */\nexport type IntegrationIndex = {\n [key: string]: Integration;\n};\n\ntype IntegrationWithDefaultInstance = Integration & { isDefaultInstance?: true };\n\n/**\n * Remove duplicates from the given array, preferring the last instance of any duplicate. Not guaranteed to\n * preserve the order of integrations in the array.\n *\n * @private\n */\nfunction filterDuplicates(integrations: Integration[]): Integration[] {\n const integrationsByName: { [key: string]: Integration } = {};\n\n integrations.forEach((currentInstance: IntegrationWithDefaultInstance) => {\n const { name } = currentInstance;\n\n const existingInstance: IntegrationWithDefaultInstance | undefined = integrationsByName[name];\n\n // We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a\n // default instance to overwrite an existing user instance\n if (existingInstance && !existingInstance.isDefaultInstance && currentInstance.isDefaultInstance) {\n return;\n }\n\n integrationsByName[name] = currentInstance;\n });\n\n return Object.values(integrationsByName);\n}\n\n/** Gets integrations to install */\nexport function getIntegrationsToSetup(\n options: Pick<CoreOptions, 'defaultIntegrations' | 'integrations'>,\n): Integration[] {\n const defaultIntegrations = options.defaultIntegrations || [];\n const userIntegrations = options.integrations;\n\n // We flag default instances, so that later we can tell them apart from any user-created instances of the same class\n defaultIntegrations.forEach((integration: IntegrationWithDefaultInstance) => {\n integration.isDefaultInstance = true;\n });\n\n let integrations: Integration[];\n\n if (Array.isArray(userIntegrations)) {\n integrations = [...defaultIntegrations, ...userIntegrations];\n } else if (typeof userIntegrations === 'function') {\n const resolvedUserIntegrations = userIntegrations(defaultIntegrations);\n integrations = Array.isArray(resolvedUserIntegrations) ? resolvedUserIntegrations : [resolvedUserIntegrations];\n } else {\n integrations = defaultIntegrations;\n }\n\n return filterDuplicates(integrations);\n}\n\n/**\n * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default\n * integrations are added unless they were already provided before.\n * @param integrations array of integration instances\n * @param withDefault should enable default integrations\n */\nexport function setupIntegrations(client: Client, integrations: Integration[]): IntegrationIndex {\n const integrationIndex: IntegrationIndex = {};\n\n integrations.forEach((integration: Integration | undefined) => {\n // guard against empty provided integrations\n if (integration) {\n setupIntegration(client, integration, integrationIndex);\n }\n });\n\n return integrationIndex;\n}\n\n/**\n * Runs the `beforeSetup` hooks of the given integrations on the given client.\n */\nexport function beforeSetupIntegrations(client: Client, integrations: Integration[]): void {\n for (const integration of integrations) {\n if (integration?.beforeSetup) {\n integration.beforeSetup(client);\n }\n }\n}\n\n/**\n * Execute the `afterAllSetup` hooks of the given integrations.\n */\nexport function afterSetupIntegrations(client: Client, integrations: Integration[]): void {\n for (const integration of integrations) {\n // guard against empty provided integrations\n if (integration?.afterAllSetup) {\n integration.afterAllSetup(client);\n }\n }\n}\n\n/** Setup a single integration. */\nexport function setupIntegration(client: Client, integration: Integration, integrationIndex: IntegrationIndex): void {\n if (integrationIndex[integration.name]) {\n DEBUG_BUILD && debug.log(`Integration skipped because it was already installed: ${integration.name}`);\n return;\n }\n integrationIndex[integration.name] = integration;\n\n // `setupOnce` is only called the first time\n if (!installedIntegrations.includes(integration.name) && typeof integration.setupOnce === 'function') {\n integration.setupOnce();\n installedIntegrations.push(integration.name);\n }\n\n // `setup` is run for each client\n if (integration.setup && typeof integration.setup === 'function') {\n integration.setup(client);\n }\n\n if (typeof integration.preprocessEvent === 'function') {\n const callback = integration.preprocessEvent.bind(integration) as typeof integration.preprocessEvent;\n client.on('preprocessEvent', (event, hint) => callback(event, hint, client));\n }\n\n if (typeof integration.processEvent === 'function') {\n const callback = integration.processEvent.bind(integration) as typeof integration.processEvent;\n\n const processor = Object.assign((event: Event, hint: EventHint) => callback(event, hint, client), {\n id: integration.name,\n });\n\n client.addEventProcessor(processor);\n }\n\n DEBUG_BUILD && debug.log(`Integration installed: ${integration.name}`);\n}\n\n/** Add an integration to the current scope's client. */\nexport function addIntegration(integration: Integration): void {\n const client = getClient();\n\n if (!client) {\n DEBUG_BUILD && debug.warn(`Cannot add integration \"${integration.name}\" because no SDK Client is available.`);\n return;\n }\n\n client.addIntegration(integration);\n}\n\n/**\n * Define an integration function that can be used to create an integration instance.\n * Note that this by design hides the implementation details of the integration, as they are considered internal.\n */\nexport function defineIntegration<Fn extends IntegrationFn>(fn: Fn): (...args: Parameters<Fn>) => Integration {\n return fn;\n}\n"],"names":[],"mappings":";;;;AAQO,MAAM,qBAAqB,GAAa;;AAE/C;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAgB,CAAC,YAAY,EAAgC;AACtE,EAAE,MAAM,kBAAkB,GAAmC,EAAE;;AAE/D,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,eAAe,KAAqC;AAC5E,IAAI,MAAM,EAAE,IAAA,EAAK,GAAI,eAAe;;AAEpC,IAAI,MAAM,gBAAgB,GAA+C,kBAAkB,CAAC,IAAI,CAAC;;AAEjG;AACA;AACA,IAAI,IAAI,gBAAA,IAAoB,CAAC,gBAAgB,CAAC,iBAAA,IAAqB,eAAe,CAAC,iBAAiB,EAAE;AACtG,MAAM;AACN,IAAI;;AAEJ,IAAI,kBAAkB,CAAC,IAAI,CAAA,GAAI,eAAe;AAC9C,EAAE,CAAC,CAAC;;AAEJ,EAAE,OAAO,MAAM,CAAC,MAAM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CAAA,eAAA,CAAA,IAAA,CAAA,WAAA,CAAA;AACA,IAAA,MAAA,CAAA,EAAA,CAAA,iBAAA,EAAA,CAAA,KAAA,EAAA,IAAA,KAAA,QAAA,CAAA,KAAA,EAAA,IAAA,EAAA,MAAA,CAAA,CAAA;AACA,EAAA;;AAEA,EAAA,IAAA,OAAA,WAAA,CAAA,YAAA,KAAA,UAAA,EAAA;AACA,IAAA,MAAA,QAAA,GAAA,WAAA,CAAA,YAAA,CAAA,IAAA,CAAA,WAAA,CAAA;;AAEA,IAAA,MAAA,SAAA,GAAA,MAAA,CAAA,MAAA,CAAA,CAAA,KAAA,EAAA,IAAA,KAAA,QAAA,CAAA,KAAA,EAAA,IAAA,EAAA,MAAA,CAAA,EAAA;AACA,MAAA,EAAA,EAAA,WAAA,CAAA,IAAA;AACA,KAAA,CAAA;;AAEA,IAAA,MAAA,CAAA,iBAAA,CAAA,SAAA,CAAA;AACA,EAAA;;AAEA,EAAA,WAAA,IAAA,KAAA,CAAA,GAAA,CAAA,CAAA,uBAAA,EAAA,WAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA;;AAEA;AACA,SAAA,cAAA,CAAA,WAAA,EAAA;AACA,EAAA,MAAA,MAAA,GAAA,SAAA,EAAA;;AAEA,EAAA,IAAA,CAAA,MAAA,EAAA;AACA,IAAA,WAAA,IAAA,KAAA,CAAA,IAAA,CAAA,CAAA,wBAAA,EAAA,WAAA,CAAA,IAAA,CAAA,qCAAA,CAAA,CAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,MAAA,CAAA,cAAA,CAAA,WAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,iBAAA,CAAA,EAAA,EAAA;AACA,EAAA,OAAA,EAAA;AACA;;;;"}
1
+ {"version":3,"file":"integration.js","sources":["../../src/integration.ts"],"sourcesContent":["import type { Client } from './client';\nimport { getClient } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { Event, EventHint } from './types-hoist/event';\nimport type { Integration, IntegrationFn } from './types-hoist/integration';\nimport type { CoreOptions } from './types-hoist/options';\nimport { debug } from './utils/debug-logger';\n\nexport const installedIntegrations: string[] = [];\n\n/** Map of integrations assigned to a client */\nexport type IntegrationIndex = {\n [key: string]: Integration;\n};\n\ntype IntegrationWithDefaultInstance = Integration & { isDefaultInstance?: true };\n\n/**\n * Remove duplicates from the given array, preferring the last instance of any duplicate. Not guaranteed to\n * preserve the order of integrations in the array.\n *\n * @private\n */\nfunction filterDuplicates(integrations: Integration[]): Integration[] {\n const integrationsByName: { [key: string]: Integration } = {};\n\n integrations.forEach((currentInstance: IntegrationWithDefaultInstance) => {\n const { name } = currentInstance;\n\n const existingInstance: IntegrationWithDefaultInstance | undefined = integrationsByName[name];\n\n // We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a\n // default instance to overwrite an existing user instance\n if (existingInstance && !existingInstance.isDefaultInstance && currentInstance.isDefaultInstance) {\n return;\n }\n\n integrationsByName[name] = currentInstance;\n });\n\n return Object.values(integrationsByName);\n}\n\n/** Gets integrations to install */\nexport function getIntegrationsToSetup(\n options: Pick<CoreOptions, 'defaultIntegrations' | 'integrations'>,\n): Integration[] {\n const defaultIntegrations = options.defaultIntegrations || [];\n const userIntegrations = options.integrations;\n\n // We flag default instances, so that later we can tell them apart from any user-created instances of the same class\n defaultIntegrations.forEach((integration: IntegrationWithDefaultInstance) => {\n integration.isDefaultInstance = true;\n });\n\n let integrations: Integration[];\n\n if (Array.isArray(userIntegrations)) {\n integrations = [...defaultIntegrations, ...userIntegrations];\n } else if (typeof userIntegrations === 'function') {\n const resolvedUserIntegrations = userIntegrations(defaultIntegrations);\n integrations = Array.isArray(resolvedUserIntegrations) ? resolvedUserIntegrations : [resolvedUserIntegrations];\n } else {\n integrations = defaultIntegrations;\n }\n\n return filterDuplicates(integrations);\n}\n\n/**\n * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default\n * integrations are added unless they were already provided before.\n * @param integrations array of integration instances\n * @param withDefault should enable default integrations\n */\nexport function setupIntegrations(client: Client, integrations: Integration[]): IntegrationIndex {\n const integrationIndex: IntegrationIndex = {};\n\n integrations.forEach((integration: Integration | undefined) => {\n // guard against empty provided integrations\n if (integration) {\n setupIntegration(client, integration, integrationIndex);\n }\n });\n\n return integrationIndex;\n}\n\n/**\n * Execute the `afterAllSetup` hooks of the given integrations.\n */\nexport function afterSetupIntegrations(client: Client, integrations: Integration[]): void {\n for (const integration of integrations) {\n // guard against empty provided integrations\n if (integration?.afterAllSetup) {\n integration.afterAllSetup(client);\n }\n }\n}\n\n/** Setup a single integration. */\nexport function setupIntegration(client: Client, integration: Integration, integrationIndex: IntegrationIndex): void {\n if (integrationIndex[integration.name]) {\n DEBUG_BUILD && debug.log(`Integration skipped because it was already installed: ${integration.name}`);\n return;\n }\n integrationIndex[integration.name] = integration;\n\n // `setupOnce` is only called the first time\n if (!installedIntegrations.includes(integration.name) && typeof integration.setupOnce === 'function') {\n integration.setupOnce();\n installedIntegrations.push(integration.name);\n }\n\n // `setup` is run for each client\n if (integration.setup && typeof integration.setup === 'function') {\n integration.setup(client);\n }\n\n if (typeof integration.preprocessEvent === 'function') {\n const callback = integration.preprocessEvent.bind(integration) as typeof integration.preprocessEvent;\n client.on('preprocessEvent', (event, hint) => callback(event, hint, client));\n }\n\n if (typeof integration.processEvent === 'function') {\n const callback = integration.processEvent.bind(integration) as typeof integration.processEvent;\n\n const processor = Object.assign((event: Event, hint: EventHint) => callback(event, hint, client), {\n id: integration.name,\n });\n\n client.addEventProcessor(processor);\n }\n\n DEBUG_BUILD && debug.log(`Integration installed: ${integration.name}`);\n}\n\n/** Add an integration to the current scope's client. */\nexport function addIntegration(integration: Integration): void {\n const client = getClient();\n\n if (!client) {\n DEBUG_BUILD && debug.warn(`Cannot add integration \"${integration.name}\" because no SDK Client is available.`);\n return;\n }\n\n client.addIntegration(integration);\n}\n\n/**\n * Define an integration function that can be used to create an integration instance.\n * Note that this by design hides the implementation details of the integration, as they are considered internal.\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ACA,IAAA,WAAA,IAAA,KAAA,CAAA,IAAA,CAAA,CAAA,wBAAA,EAAA,WAAA,CAAA,IAAA,CAAA,qCAAA,CAAA,CAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,MAAA,CAAA,cAAA,CAAA,WAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,iBAAA,CAAA,EAAA,EAAA;AACA,EAAA,OAAA,EAAA;AACA;;;;"}
@@ -134,7 +134,7 @@ function _shouldDropEvent(event, options) {
134
134
  }
135
135
  } else if (event.type === 'transaction') {
136
136
  // Filter transactions
137
- // TODO (span-streaming): replace with ignoreSpans defaults (if we have any)
137
+
138
138
  if (_isIgnoredTransaction(event, options.ignoreTransactions)) {
139
139
  DEBUG_BUILD &&
140
140
  debug.warn(
@@ -1 +1 @@
1
- {"version":3,"file":"eventFilters.js","sources":["../../../src/integrations/eventFilters.ts"],"sourcesContent":["import { DEBUG_BUILD } from '../debug-build';\nimport { defineIntegration } from '../integration';\nimport type { Event } from '../types-hoist/event';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport type { StackFrame } from '../types-hoist/stackframe';\nimport { debug } from '../utils/debug-logger';\nimport { getPossibleEventMessages } from '../utils/eventUtils';\nimport { getEventDescription } from '../utils/misc';\nimport { stringMatchesSomePattern } from '../utils/string';\n\n// \"Script error.\" is hard coded into browsers for errors that it can't read.\n// this is the result of a script being pulled in from an external domain and CORS.\nconst DEFAULT_IGNORE_ERRORS = [\n /^Script error\\.?$/,\n /^Javascript error: Script error\\.? on line 0$/,\n /^ResizeObserver loop completed with undelivered notifications.$/, // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.\n /^Cannot redefine property: googletag$/, // This is thrown when google tag manager is used in combination with an ad blocker\n /^Can't find variable: gmo$/, // Error from Google Search App https://issuetracker.google.com/issues/396043331\n /^undefined is not an object \\(evaluating 'a\\.[A-Z]'\\)$/, // Random error that happens but not actionable or noticeable to end-users.\n 'can\\'t redefine non-configurable property \"solana\"', // Probably a browser extension or custom browser (Brave) throwing this error\n \"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)\", // Error thrown by GTM, seemingly not affecting end-users\n \"Can't find variable: _AutofillCallbackHandler\", // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/\n /^Non-Error promise rejection captured with value: Object Not Found Matching Id:\\d+, MethodName:simulateEvent, ParamCount:\\d+$/, // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps\n /^Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)\n];\n\n/** Options for the EventFilters integration */\nexport interface EventFiltersOptions {\n allowUrls: Array<string | RegExp>;\n denyUrls: Array<string | RegExp>;\n ignoreErrors: Array<string | RegExp>;\n ignoreTransactions: Array<string | RegExp>;\n ignoreInternal: boolean;\n disableErrorDefaults: boolean;\n}\n\nconst INTEGRATION_NAME = 'EventFilters';\n\n/**\n * An integration that filters out events (errors and transactions) based on:\n *\n * - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS})\n * - (Errors) A list of error messages or urls/filenames passed in via\n * - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`)\n * - The same options passed to the integration directly via @param options\n * - (Transactions/Spans) A list of root span (transaction) names passed in via\n * - Top level Sentry.init option (`ignoreTransactions`)\n * - The same option passed to the integration directly via @param options\n *\n * Events filtered by this integration will not be sent to Sentry.\n */\nexport const eventFiltersIntegration = defineIntegration((options: Partial<EventFiltersOptions> = {}) => {\n let mergedOptions: Partial<EventFiltersOptions> | undefined;\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const clientOptions = client.getOptions();\n mergedOptions = _mergeOptions(options, clientOptions);\n },\n processEvent(event, _hint, client) {\n if (!mergedOptions) {\n const clientOptions = client.getOptions();\n mergedOptions = _mergeOptions(options, clientOptions);\n }\n return _shouldDropEvent(event, mergedOptions) ? null : event;\n },\n };\n});\n\n/**\n * An integration that filters out events (errors and transactions) based on:\n *\n * - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS})\n * - (Errors) A list of error messages or urls/filenames passed in via\n * - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`)\n * - The same options passed to the integration directly via @param options\n * - (Transactions/Spans) A list of root span (transaction) names passed in via\n * - Top level Sentry.init option (`ignoreTransactions`)\n * - The same option passed to the integration directly via @param options\n *\n * Events filtered by this integration will not be sent to Sentry.\n *\n * @deprecated this integration was renamed and will be removed in a future major version.\n * Use `eventFiltersIntegration` instead.\n */\nexport const inboundFiltersIntegration = defineIntegration(((options: Partial<EventFiltersOptions> = {}) => {\n return {\n ...eventFiltersIntegration(options),\n name: 'InboundFilters',\n };\n}) satisfies IntegrationFn);\n\nfunction _mergeOptions(\n internalOptions: Partial<EventFiltersOptions> = {},\n clientOptions: Partial<EventFiltersOptions> = {},\n): Partial<EventFiltersOptions> {\n return {\n allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],\n denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],\n ignoreErrors: [\n ...(internalOptions.ignoreErrors || []),\n ...(clientOptions.ignoreErrors || []),\n ...(internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS),\n ],\n ignoreTransactions: [...(internalOptions.ignoreTransactions || []), ...(clientOptions.ignoreTransactions || [])],\n };\n}\n\nfunction _shouldDropEvent(event: Event, options: Partial<EventFiltersOptions>): boolean {\n if (!event.type) {\n // Filter errors\n if (_isIgnoredError(event, options.ignoreErrors)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to being matched by \\`ignoreErrors\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n if (_isUselessError(event)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to not having an error message, error type or stacktrace.\\nEvent: ${getEventDescription(\n event,\n )}`,\n );\n return true;\n }\n if (_isDeniedUrl(event, options.denyUrls)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to being matched by \\`denyUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${_getEventFilterUrl(event)}`,\n );\n return true;\n }\n if (!_isAllowedUrl(event, options.allowUrls)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to not being matched by \\`allowUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${_getEventFilterUrl(event)}`,\n );\n return true;\n }\n } else if (event.type === 'transaction') {\n // Filter transactions\n // TODO (span-streaming): replace with ignoreSpans defaults (if we have any)\n if (_isIgnoredTransaction(event, options.ignoreTransactions)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to being matched by \\`ignoreTransactions\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n }\n return false;\n}\n\nfunction _isIgnoredError(event: Event, ignoreErrors?: Array<string | RegExp>): boolean {\n if (!ignoreErrors?.length) {\n return false;\n }\n\n return getPossibleEventMessages(event).some(message => stringMatchesSomePattern(message, ignoreErrors));\n}\n\nfunction _isIgnoredTransaction(event: Event, ignoreTransactions?: Array<string | RegExp>): boolean {\n if (!ignoreTransactions?.length) {\n return false;\n }\n\n const name = event.transaction;\n return name ? stringMatchesSomePattern(name, ignoreTransactions) : false;\n}\n\nfunction _isDeniedUrl(event: Event, denyUrls?: Array<string | RegExp>): boolean {\n if (!denyUrls?.length) {\n return false;\n }\n const url = _getEventFilterUrl(event);\n return !url ? false : stringMatchesSomePattern(url, denyUrls);\n}\n\nfunction _isAllowedUrl(event: Event, allowUrls?: Array<string | RegExp>): boolean {\n if (!allowUrls?.length) {\n return true;\n }\n const url = _getEventFilterUrl(event);\n return !url ? true : stringMatchesSomePattern(url, allowUrls);\n}\n\nfunction _getLastValidUrl(frames: StackFrame[] = []): string | null {\n for (let i = frames.length - 1; i >= 0; i--) {\n const frame = frames[i];\n\n if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {\n return frame.filename || null;\n }\n }\n\n return null;\n}\n\nfunction _getEventFilterUrl(event: Event): string | null {\n try {\n // If there are linked exceptions or exception aggregates we only want to match against the top frame of the \"root\" (the main exception)\n // The root always comes last in linked exceptions\n const rootException = [...(event.exception?.values ?? [])]\n .reverse()\n .find(value => value.mechanism?.parent_id === undefined && value.stacktrace?.frames?.length);\n const frames = rootException?.stacktrace?.frames;\n return frames ? _getLastValidUrl(frames) : null;\n } catch {\n DEBUG_BUILD && debug.error(`Cannot extract url for event ${getEventDescription(event)}`);\n return null;\n }\n}\n\nfunction _isUselessError(event: Event): boolean {\n // We only want to consider events for dropping that actually have recorded exception values.\n if (!event.exception?.values?.length) {\n return false;\n }\n\n return (\n // No top-level message\n !event.message &&\n // There are no exception values that have a stacktrace, a non-generic-Error type or value\n !event.exception.values.some(value => value.stacktrace || (value.type && value.type !== 'Error') || value.value)\n );\n}\n"],"names":[],"mappings":";;;;;;;AAUA;AACA;AACA,MAAM,wBAAwB;AAC9B,EAAE,mBAAmB;AACrB,EAAE,+CAA+C;AACjD,EAAE,iEAAiE;AACnE,EAAE,uCAAuC;AACzC,EAAE,4BAA4B;AAC9B,EAAE,wDAAwD;AAC1D,EAAE,oDAAoD;AACtD,EAAE,+GAA+G;AACjH,EAAE,+CAA+C;AACjD,EAAE,+HAA+H;AACjI,EAAE,sDAAsD;AACxD,CAAC;;AAED;;AAUA,MAAM,gBAAA,GAAmB,cAAc;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,uBAAA,GAA0B,iBAAiB,CAAC,CAAC,OAAO,GAAiC,EAAE,KAAK;AACzG,EAAE,IAAI,aAAa;AACnB,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,aAAA,GAAgB,MAAM,CAAC,UAAU,EAAE;AAC/C,MAAM,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,EAAA;AACA;;AAEA,SAAA,eAAA,CAAA,KAAA,EAAA;AACA;AACA,EAAA,IAAA,CAAA,KAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA;AACA,IAAA,OAAA,KAAA;AACA,EAAA;;AAEA,EAAA;AACA;AACA,IAAA,CAAA,KAAA,CAAA,OAAA;AACA;AACA,IAAA,CAAA,KAAA,CAAA,SAAA,CAAA,MAAA,CAAA,IAAA,CAAA,KAAA,IAAA,KAAA,CAAA,UAAA,KAAA,KAAA,CAAA,IAAA,IAAA,KAAA,CAAA,IAAA,KAAA,OAAA,CAAA,IAAA,KAAA,CAAA,KAAA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"eventFilters.js","sources":["../../../src/integrations/eventFilters.ts"],"sourcesContent":["import { DEBUG_BUILD } from '../debug-build';\nimport { defineIntegration } from '../integration';\nimport type { Event } from '../types-hoist/event';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport type { StackFrame } from '../types-hoist/stackframe';\nimport { debug } from '../utils/debug-logger';\nimport { getPossibleEventMessages } from '../utils/eventUtils';\nimport { getEventDescription } from '../utils/misc';\nimport { stringMatchesSomePattern } from '../utils/string';\n\n// \"Script error.\" is hard coded into browsers for errors that it can't read.\n// this is the result of a script being pulled in from an external domain and CORS.\nconst DEFAULT_IGNORE_ERRORS = [\n /^Script error\\.?$/,\n /^Javascript error: Script error\\.? on line 0$/,\n /^ResizeObserver loop completed with undelivered notifications.$/, // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.\n /^Cannot redefine property: googletag$/, // This is thrown when google tag manager is used in combination with an ad blocker\n /^Can't find variable: gmo$/, // Error from Google Search App https://issuetracker.google.com/issues/396043331\n /^undefined is not an object \\(evaluating 'a\\.[A-Z]'\\)$/, // Random error that happens but not actionable or noticeable to end-users.\n 'can\\'t redefine non-configurable property \"solana\"', // Probably a browser extension or custom browser (Brave) throwing this error\n \"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)\", // Error thrown by GTM, seemingly not affecting end-users\n \"Can't find variable: _AutofillCallbackHandler\", // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/\n /^Non-Error promise rejection captured with value: Object Not Found Matching Id:\\d+, MethodName:simulateEvent, ParamCount:\\d+$/, // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps\n /^Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)\n];\n\n/** Options for the EventFilters integration */\nexport interface EventFiltersOptions {\n allowUrls: Array<string | RegExp>;\n denyUrls: Array<string | RegExp>;\n ignoreErrors: Array<string | RegExp>;\n ignoreTransactions: Array<string | RegExp>;\n ignoreInternal: boolean;\n disableErrorDefaults: boolean;\n}\n\nconst INTEGRATION_NAME = 'EventFilters';\n\n/**\n * An integration that filters out events (errors and transactions) based on:\n *\n * - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS})\n * - (Errors) A list of error messages or urls/filenames passed in via\n * - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`)\n * - The same options passed to the integration directly via @param options\n * - (Transactions/Spans) A list of root span (transaction) names passed in via\n * - Top level Sentry.init option (`ignoreTransactions`)\n * - The same option passed to the integration directly via @param options\n *\n * Events filtered by this integration will not be sent to Sentry.\n */\nexport const eventFiltersIntegration = defineIntegration((options: Partial<EventFiltersOptions> = {}) => {\n let mergedOptions: Partial<EventFiltersOptions> | undefined;\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const clientOptions = client.getOptions();\n mergedOptions = _mergeOptions(options, clientOptions);\n },\n processEvent(event, _hint, client) {\n if (!mergedOptions) {\n const clientOptions = client.getOptions();\n mergedOptions = _mergeOptions(options, clientOptions);\n }\n return _shouldDropEvent(event, mergedOptions) ? null : event;\n },\n };\n});\n\n/**\n * An integration that filters out events (errors and transactions) based on:\n *\n * - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS})\n * - (Errors) A list of error messages or urls/filenames passed in via\n * - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`)\n * - The same options passed to the integration directly via @param options\n * - (Transactions/Spans) A list of root span (transaction) names passed in via\n * - Top level Sentry.init option (`ignoreTransactions`)\n * - The same option passed to the integration directly via @param options\n *\n * Events filtered by this integration will not be sent to Sentry.\n *\n * @deprecated this integration was renamed and will be removed in a future major version.\n * Use `eventFiltersIntegration` instead.\n */\nexport const inboundFiltersIntegration = defineIntegration(((options: Partial<EventFiltersOptions> = {}) => {\n return {\n ...eventFiltersIntegration(options),\n name: 'InboundFilters',\n };\n}) satisfies IntegrationFn);\n\nfunction _mergeOptions(\n internalOptions: Partial<EventFiltersOptions> = {},\n clientOptions: Partial<EventFiltersOptions> = {},\n): Partial<EventFiltersOptions> {\n return {\n allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],\n denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],\n ignoreErrors: [\n ...(internalOptions.ignoreErrors || []),\n ...(clientOptions.ignoreErrors || []),\n ...(internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS),\n ],\n ignoreTransactions: [...(internalOptions.ignoreTransactions || []), ...(clientOptions.ignoreTransactions || [])],\n };\n}\n\nfunction _shouldDropEvent(event: Event, options: Partial<EventFiltersOptions>): boolean {\n if (!event.type) {\n // Filter errors\n if (_isIgnoredError(event, options.ignoreErrors)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to being matched by \\`ignoreErrors\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n if (_isUselessError(event)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to not having an error message, error type or stacktrace.\\nEvent: ${getEventDescription(\n event,\n )}`,\n );\n return true;\n }\n if (_isDeniedUrl(event, options.denyUrls)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to being matched by \\`denyUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${_getEventFilterUrl(event)}`,\n );\n return true;\n }\n if (!_isAllowedUrl(event, options.allowUrls)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to not being matched by \\`allowUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${_getEventFilterUrl(event)}`,\n );\n return true;\n }\n } else if (event.type === 'transaction') {\n // Filter transactions\n\n if (_isIgnoredTransaction(event, options.ignoreTransactions)) {\n DEBUG_BUILD &&\n debug.warn(\n `Event dropped due to being matched by \\`ignoreTransactions\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n }\n return false;\n}\n\nfunction _isIgnoredError(event: Event, ignoreErrors?: Array<string | RegExp>): boolean {\n if (!ignoreErrors?.length) {\n return false;\n }\n\n return getPossibleEventMessages(event).some(message => stringMatchesSomePattern(message, ignoreErrors));\n}\n\nfunction _isIgnoredTransaction(event: Event, ignoreTransactions?: Array<string | RegExp>): boolean {\n if (!ignoreTransactions?.length) {\n return false;\n }\n\n const name = event.transaction;\n return name ? stringMatchesSomePattern(name, ignoreTransactions) : false;\n}\n\nfunction _isDeniedUrl(event: Event, denyUrls?: Array<string | RegExp>): boolean {\n if (!denyUrls?.length) {\n return false;\n }\n const url = _getEventFilterUrl(event);\n return !url ? false : stringMatchesSomePattern(url, denyUrls);\n}\n\nfunction _isAllowedUrl(event: Event, allowUrls?: Array<string | RegExp>): boolean {\n if (!allowUrls?.length) {\n return true;\n }\n const url = _getEventFilterUrl(event);\n return !url ? true : stringMatchesSomePattern(url, allowUrls);\n}\n\nfunction _getLastValidUrl(frames: StackFrame[] = []): string | null {\n for (let i = frames.length - 1; i >= 0; i--) {\n const frame = frames[i];\n\n if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {\n return frame.filename || null;\n }\n }\n\n return null;\n}\n\nfunction _getEventFilterUrl(event: Event): string | null {\n try {\n // If there are linked exceptions or exception aggregates we only want to match against the top frame of the \"root\" (the main exception)\n // The root always comes last in linked exceptions\n const rootException = [...(event.exception?.values ?? [])]\n .reverse()\n .find(value => value.mechanism?.parent_id === undefined && value.stacktrace?.frames?.length);\n const frames = rootException?.stacktrace?.frames;\n return frames ? _getLastValidUrl(frames) : null;\n } catch {\n DEBUG_BUILD && debug.error(`Cannot extract url for event ${getEventDescription(event)}`);\n return null;\n }\n}\n\nfunction _isUselessError(event: Event): boolean {\n // We only want to consider events for dropping that actually have recorded exception values.\n if (!event.exception?.values?.length) {\n return false;\n }\n\n return (\n // No top-level message\n !event.message &&\n // There are no exception values that have a stacktrace, a non-generic-Error type or value\n !event.exception.values.some(value => value.stacktrace || (value.type && value.type !== 'Error') || value.value)\n );\n}\n"],"names":[],"mappings":";;;;;;;AAUA;AACA;AACA,MAAM,wBAAwB;AAC9B,EAAE,mBAAmB;AACrB,EAAE,+CAA+C;AACjD,EAAE,iEAAiE;AACnE,EAAE,uCAAuC;AACzC,EAAE,4BAA4B;AAC9B,EAAE,wDAAwD;AAC1D,EAAE,oDAAoD;AACtD,EAAE,+GAA+G;AACjH,EAAE,+CAA+C;AACjD,EAAE,+HAA+H;AACjI,EAAE,sDAAsD;AACxD,CAAC;;AAED;;AAUA,MAAM,gBAAA,GAAmB,cAAc;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,uBAAA,GAA0B,iBAAiB,CAAC,CAAC,OAAO,GAAiC,EAAE,KAAK;AACzG,EAAE,IAAI,aAAa;AACnB,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,aAAA,GAAgB,MAAM,CAAC,UAAU,EAAE;AAC/C,MAAM,gBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC;AAC3D,IAAI,CAAC;AACL,IAAI,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAA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A;AACA,IAAA,OAAA,KAAA;AACA,EAAA;;AAEA,EAAA;AACA;AACA,IAAA,CAAA,KAAA,CAAA,OAAA;AACA;AACA,IAAA,CAAA,KAAA,CAAA,SAAA,CAAA,MAAA,CAAA,IAAA,CAAA,KAAA,IAAA,KAAA,CAAA,UAAA,KAAA,KAAA,CAAA,IAAA,IAAA,KAAA,CAAA,IAAA,KAAA,OAAA,CAAA,IAAA,KAAA,CAAA,KAAA;AACA;AACA;;;;"}
@@ -1,8 +1,5 @@
1
1
  import { defineIntegration } from '../integration.js';
2
- import { SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS, SEMANTIC_ATTRIBUTE_URL_QUERY, SEMANTIC_ATTRIBUTE_URL_FULL, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD } from '../semanticAttributes.js';
3
- import { safeSetSpanJSONAttributes } from '../spans/spanFirstUtils.js';
4
2
  import { parseCookie } from '../utils/cookie.js';
5
- import { httpHeadersToSpanAttributes } from '../utils/request.js';
6
3
  import { getClientIPAddress, ipHeaderNames } from '../vendor/getIpAddress.js';
7
4
 
8
5
  // TODO(v11): Change defaults based on `sendDefaultPii`
@@ -24,67 +21,14 @@ const _requestDataIntegration = ((options = {}) => {
24
21
 
25
22
  return {
26
23
  name: INTEGRATION_NAME,
27
- setup(client) {
28
- client.on('processSegmentSpan', (spanJSON, { scopeData }) => {
29
- const { sdkProcessingMetadata = {} } = scopeData;
30
- const { normalizedRequest, ipAddress } = sdkProcessingMetadata;
31
-
32
- if (!normalizedRequest) {
33
- return;
34
- }
35
-
36
- const includeWithDefaultPiiApplied = getIncludeWithDefaultPiiApplied(
37
- include,
38
- client,
39
- );
40
-
41
- // no need to check for include after calling `extractNormalizedRequestData`
42
- // because it already internally only return what's permitted by `include`
43
- const { method, url, query_string, headers, data, env } = extractNormalizedRequestData(
44
- normalizedRequest,
45
- includeWithDefaultPiiApplied,
46
- );
47
-
48
- safeSetSpanJSONAttributes(spanJSON, {
49
- ...(method ? { [SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: method } : {}),
50
- ...(url ? { [SEMANTIC_ATTRIBUTE_URL_FULL]: url } : {}),
51
- ...(query_string ? { [SEMANTIC_ATTRIBUTE_URL_QUERY]: query_string } : {}),
52
- ...(headers ? httpHeadersToSpanAttributes(headers, client.getOptions().sendDefaultPii) : {}),
53
- // TODO: Apparently, Relay still needs Pii rule updates, so I'm leaving this out for now
54
- // ...(cookies
55
- // ? Object.keys(cookies).reduce(
56
- // (acc, cookieName) => ({
57
- // ...acc,
58
- // [`http.request.header.cookie.${cookieName}`]: cookies[cookieName] ?? '',
59
- // }),
60
- // {} as Record<string, string>,
61
- // )
62
- // : {}),
63
- ...(include.ip
64
- ? {
65
- [SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS]:
66
- (normalizedRequest.headers && getClientIPAddress(normalizedRequest.headers)) || ipAddress,
67
- }
68
- : {}),
69
- ...(data ? { 'http.request.body.content': data } : {}),
70
- ...(env
71
- ? {
72
- 'http.request.env': Object.keys(env).reduce(
73
- (acc, key) => ({ ...acc, [key]: env[key] ?? '' }),
74
- {} ,
75
- ),
76
- }
77
- : {}),
78
- });
79
- });
80
- },
81
- // TODO (span-streaming): probably fine to leave as-is for errors.
82
- // For spans, we go through global context -> attribute conversion or omit this completely (TBD)
83
24
  processEvent(event, _hint, client) {
84
25
  const { sdkProcessingMetadata = {} } = event;
85
26
  const { normalizedRequest, ipAddress } = sdkProcessingMetadata;
86
27
 
87
- const includeWithDefaultPiiApplied = getIncludeWithDefaultPiiApplied(include, client);
28
+ const includeWithDefaultPiiApplied = {
29
+ ...include,
30
+ ip: include.ip ?? client.getOptions().sendDefaultPii,
31
+ };
88
32
 
89
33
  if (normalizedRequest) {
90
34
  addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, includeWithDefaultPiiApplied);
@@ -101,16 +45,6 @@ const _requestDataIntegration = ((options = {}) => {
101
45
  */
102
46
  const requestDataIntegration = defineIntegration(_requestDataIntegration);
103
47
 
104
- const getIncludeWithDefaultPiiApplied = (
105
- include
106
-
107
- ,
108
- client,
109
- ) => ({
110
- ...include,
111
- ip: include.ip ?? client.getOptions().sendDefaultPii,
112
- });
113
-
114
48
  /**
115
49
  * Add already normalized request data to an event.
116
50
  * This mutates the passed in event.
@@ -150,14 +84,14 @@ function extractNormalizedRequestData(
150
84
 
151
85
  // Remove the Cookie header in case cookie data should not be included in the event
152
86
  if (!include.cookies) {
153
- delete headers.cookie;
87
+ delete (headers ).cookie;
154
88
  }
155
89
 
156
90
  // Remove IP headers in case IP data should not be included in the event
157
91
  if (!include.ip) {
158
92
  ipHeaderNames.forEach(ipHeaderName => {
159
93
  // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
160
- delete headers[ipHeaderName];
94
+ delete (headers )[ipHeaderName];
161
95
  });
162
96
  }
163
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"requestdata.js","sources":["../../../src/integrations/requestdata.ts"],"sourcesContent":["import type { Client } from '../client';\nimport { defineIntegration } from '../integration';\nimport {\n SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n SEMANTIC_ATTRIBUTE_URL_QUERY,\n SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS,\n} from '../semanticAttributes';\nimport { safeSetSpanJSONAttributes } from '../spans/spanFirstUtils';\nimport type { Event } from '../types-hoist/event';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport type { ClientOptions } from '../types-hoist/options';\nimport type { RequestEventData } from '../types-hoist/request';\nimport type { BaseTransportOptions } from '../types-hoist/transport';\nimport { parseCookie } from '../utils/cookie';\nimport { httpHeadersToSpanAttributes } from '../utils/request';\nimport { getClientIPAddress, ipHeaderNames } from '../vendor/getIpAddress';\n\ninterface RequestDataIncludeOptions {\n cookies?: boolean;\n data?: boolean;\n headers?: boolean;\n ip?: boolean;\n query_string?: boolean;\n url?: boolean;\n}\n\ntype RequestDataIntegrationOptions = {\n /**\n * Controls what data is pulled from the request and added to the event.\n */\n include?: RequestDataIncludeOptions;\n};\n\n// TODO(v11): Change defaults based on `sendDefaultPii`\nconst DEFAULT_INCLUDE: RequestDataIncludeOptions = {\n cookies: true,\n data: true,\n headers: true,\n query_string: true,\n url: true,\n};\n\nconst INTEGRATION_NAME = 'RequestData';\n\nconst _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) => {\n const include = {\n ...DEFAULT_INCLUDE,\n ...options.include,\n };\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n client.on('processSegmentSpan', (spanJSON, { scopeData }) => {\n const { sdkProcessingMetadata = {} } = scopeData;\n const { normalizedRequest, ipAddress } = sdkProcessingMetadata;\n\n if (!normalizedRequest) {\n return;\n }\n\n const includeWithDefaultPiiApplied: RequestDataIncludeOptions = getIncludeWithDefaultPiiApplied(\n include,\n client,\n );\n\n // no need to check for include after calling `extractNormalizedRequestData`\n // because it already internally only return what's permitted by `include`\n const { method, url, query_string, headers, data, env } = extractNormalizedRequestData(\n normalizedRequest,\n includeWithDefaultPiiApplied,\n );\n\n safeSetSpanJSONAttributes(spanJSON, {\n ...(method ? { [SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: method } : {}),\n ...(url ? { [SEMANTIC_ATTRIBUTE_URL_FULL]: url } : {}),\n ...(query_string ? { [SEMANTIC_ATTRIBUTE_URL_QUERY]: query_string } : {}),\n ...(headers ? httpHeadersToSpanAttributes(headers, client.getOptions().sendDefaultPii) : {}),\n // TODO: Apparently, Relay still needs Pii rule updates, so I'm leaving this out for now\n // ...(cookies\n // ? Object.keys(cookies).reduce(\n // (acc, cookieName) => ({\n // ...acc,\n // [`http.request.header.cookie.${cookieName}`]: cookies[cookieName] ?? '',\n // }),\n // {} as Record<string, string>,\n // )\n // : {}),\n ...(include.ip\n ? {\n [SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS]:\n (normalizedRequest.headers && getClientIPAddress(normalizedRequest.headers)) || ipAddress,\n }\n : {}),\n ...(data ? { 'http.request.body.content': data } : {}),\n ...(env\n ? {\n 'http.request.env': Object.keys(env).reduce(\n (acc, key) => ({ ...acc, [key]: env[key] ?? '' }),\n {} as Record<string, string>,\n ),\n }\n : {}),\n });\n });\n },\n // TODO (span-streaming): probably fine to leave as-is for errors.\n // For spans, we go through global context -> attribute conversion or omit this completely (TBD)\n processEvent(event, _hint, client) {\n const { sdkProcessingMetadata = {} } = event;\n const { normalizedRequest, ipAddress } = sdkProcessingMetadata;\n\n const includeWithDefaultPiiApplied: RequestDataIncludeOptions = getIncludeWithDefaultPiiApplied(include, client);\n\n if (normalizedRequest) {\n addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, includeWithDefaultPiiApplied);\n }\n\n return event;\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/core`\n * so it can be used in cross-platform SDKs like `@sentry/nextjs`.\n */\nexport const requestDataIntegration = defineIntegration(_requestDataIntegration);\n\nconst getIncludeWithDefaultPiiApplied = (\n include: {\n cookies?: boolean;\n data?: boolean;\n headers?: boolean;\n ip?: boolean;\n query_string?: boolean;\n url?: boolean;\n },\n client: Client<ClientOptions<BaseTransportOptions>>,\n): RequestDataIncludeOptions => ({\n ...include,\n ip: include.ip ?? client.getOptions().sendDefaultPii,\n});\n\n/**\n * Add already normalized request data to an event.\n * This mutates the passed in event.\n */\nfunction addNormalizedRequestDataToEvent(\n event: Event,\n req: RequestEventData,\n // Data that should not go into `event.request` but is somehow related to requests\n additionalData: { ipAddress?: string },\n include: RequestDataIncludeOptions,\n): void {\n event.request = {\n ...event.request,\n ...extractNormalizedRequestData(req, include),\n };\n\n if (include.ip) {\n const ip = (req.headers && getClientIPAddress(req.headers)) || additionalData.ipAddress;\n if (ip) {\n event.user = {\n ...event.user,\n ip_address: ip,\n };\n }\n }\n}\n\nfunction extractNormalizedRequestData(\n normalizedRequest: RequestEventData,\n include: RequestDataIncludeOptions,\n): RequestEventData {\n const requestData: RequestEventData = {};\n const headers = { ...normalizedRequest.headers };\n\n if (include.headers) {\n requestData.headers = headers;\n\n // Remove the Cookie header in case cookie data should not be included in the event\n if (!include.cookies) {\n delete headers.cookie;\n }\n\n // Remove IP headers in case IP data should not be included in the event\n if (!include.ip) {\n ipHeaderNames.forEach(ipHeaderName => {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete headers[ipHeaderName];\n });\n }\n }\n\n requestData.method = normalizedRequest.method;\n\n if (include.url) {\n requestData.url = normalizedRequest.url;\n }\n\n if (include.cookies) {\n const cookies = normalizedRequest.cookies || (headers?.cookie ? parseCookie(headers.cookie) : undefined);\n requestData.cookies = cookies || {};\n }\n\n if (include.query_string) {\n requestData.query_string = normalizedRequest.query_string;\n }\n\n if (include.data) {\n requestData.data = normalizedRequest.data;\n }\n\n return requestData;\n}\n"],"names":[],"mappings":";;;;;;;AAkCA;AACA,MAAM,eAAe,GAA8B;AACnD,EAAE,OAAO,EAAE,IAAI;AACf,EAAE,IAAI,EAAE,IAAI;AACZ,EAAE,OAAO,EAAE,IAAI;AACf,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,GAAG,EAAE,IAAI;AACX,CAAC;;AAED,MAAM,gBAAA,GAAmB,aAAa;;AAEtC,MAAM,uBAAA,IAA2B,CAAC,OAAO,GAAkC,EAAE,KAAK;AAClF,EAAE,MAAM,UAAU;AAClB,IAAI,GAAG,eAAe;AACtB,IAAI,GAAG,OAAO,CAAC,OAAO;AACtB,GAAG;;AAEH,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAA,EAAW,KAAK;AACnE,QAAQ,MAAM,EAAE,qBAAA,GAAwB,EAAC,EAAE,GAAI,SAAS;AACxD,QAAQ,MAAM,EAAE,iBAAiB,EAAE,SAAA,EAAU,GA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IAAI,WAAW,CAAC,OAAA,GAAU,OAAA,IAAW,EAAE;AACvC,EAAE;;AAEF,EAAE,IAAI,OAAO,CAAC,YAAY,EAAE;AAC5B,IAAI,WAAW,CAAC,YAAA,GAAe,iBAAiB,CAAC,YAAY;AAC7D,EAAE;;AAEF,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE;AACpB,IAAI,WAAW,CAAC,IAAA,GAAO,iBAAiB,CAAC,IAAI;AAC7C,EAAE;;AAEF,EAAE,OAAO,WAAW;AACpB;;;;"}
1
+ {"version":3,"file":"requestdata.js","sources":["../../../src/integrations/requestdata.ts"],"sourcesContent":["import { defineIntegration } from '../integration';\nimport type { Event } from '../types-hoist/event';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport type { RequestEventData } from '../types-hoist/request';\nimport { parseCookie } from '../utils/cookie';\nimport { getClientIPAddress, ipHeaderNames } from '../vendor/getIpAddress';\n\ninterface RequestDataIncludeOptions {\n cookies?: boolean;\n data?: boolean;\n headers?: boolean;\n ip?: boolean;\n query_string?: boolean;\n url?: boolean;\n}\n\ntype RequestDataIntegrationOptions = {\n /**\n * Controls what data is pulled from the request and added to the event.\n */\n include?: RequestDataIncludeOptions;\n};\n\n// TODO(v11): Change defaults based on `sendDefaultPii`\nconst DEFAULT_INCLUDE: RequestDataIncludeOptions = {\n cookies: true,\n data: true,\n headers: true,\n query_string: true,\n url: true,\n};\n\nconst INTEGRATION_NAME = 'RequestData';\n\nconst _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) => {\n const include = {\n ...DEFAULT_INCLUDE,\n ...options.include,\n };\n\n return {\n name: INTEGRATION_NAME,\n processEvent(event, _hint, client) {\n const { sdkProcessingMetadata = {} } = event;\n const { normalizedRequest, ipAddress } = sdkProcessingMetadata;\n\n const includeWithDefaultPiiApplied: RequestDataIncludeOptions = {\n ...include,\n ip: include.ip ?? client.getOptions().sendDefaultPii,\n };\n\n if (normalizedRequest) {\n addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, includeWithDefaultPiiApplied);\n }\n\n return event;\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/core`\n * so it can be used in cross-platform SDKs like `@sentry/nextjs`.\n */\nexport const requestDataIntegration = defineIntegration(_requestDataIntegration);\n\n/**\n * Add already normalized request data to an event.\n * This mutates the passed in event.\n */\nfunction addNormalizedRequestDataToEvent(\n event: Event,\n req: RequestEventData,\n // Data that should not go into `event.request` but is somehow related to requests\n additionalData: { ipAddress?: string },\n include: RequestDataIncludeOptions,\n): void {\n event.request = {\n ...event.request,\n ...extractNormalizedRequestData(req, include),\n };\n\n if (include.ip) {\n const ip = (req.headers && getClientIPAddress(req.headers)) || additionalData.ipAddress;\n if (ip) {\n event.user = {\n ...event.user,\n ip_address: ip,\n };\n }\n }\n}\n\nfunction extractNormalizedRequestData(\n normalizedRequest: RequestEventData,\n include: RequestDataIncludeOptions,\n): RequestEventData {\n const requestData: RequestEventData = {};\n const headers = { ...normalizedRequest.headers };\n\n if (include.headers) {\n requestData.headers = headers;\n\n // Remove the Cookie header in case cookie data should not be included in the event\n if (!include.cookies) {\n delete (headers as { cookie?: string }).cookie;\n }\n\n // Remove IP headers in case IP data should not be included in the event\n if (!include.ip) {\n ipHeaderNames.forEach(ipHeaderName => {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete (headers as Record<string, unknown>)[ipHeaderName];\n });\n }\n }\n\n requestData.method = normalizedRequest.method;\n\n if (include.url) {\n requestData.url = normalizedRequest.url;\n }\n\n if (include.cookies) {\n const cookies = normalizedRequest.cookies || (headers?.cookie ? parseCookie(headers.cookie) : undefined);\n requestData.cookies = cookies || {};\n }\n\n if (include.query_string) {\n requestData.query_string = normalizedRequest.query_string;\n }\n\n if (include.data) {\n requestData.data = normalizedRequest.data;\n }\n\n return requestData;\n}\n"],"names":[],"mappings":";;;;AAuBA;AACA,MAAM,eAAe,GAA8B;AACnD,EAAE,OAAO,EAA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AC,OAAO,CAAC,MAAM,CAAA,GAAI,SAAS,CAAC;AAC5G,IAAI,WAAW,CAAC,OAAA,GAAU,OAAA,IAAW,EAAE;AACvC,EAAE;;AAEF,EAAE,IAAI,OAAO,CAAC,YAAY,EAAE;AAC5B,IAAI,WAAW,CAAC,YAAA,GAAe,iBAAiB,CAAC,YAAY;AAC7D,EAAE;;AAEF,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE;AACpB,IAAI,WAAW,CAAC,IAAA,GAAO,iBAAiB,CAAC,IAAI;AAC7C,EAAE;;AAEF,EAAE,OAAO,WAAW;AACpB;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.39.0-alpha.0","sideEffects":false}
1
+ {"type":"module","version":"10.39.0","sideEffects":false}
@@ -4,7 +4,6 @@
4
4
  *
5
5
  */
6
6
  const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = 'sentry.source';
7
- const SEMANTIC_ATTRIBUTE_SENTRY_SPAN_SOURCE = 'sentry.span.source';
8
7
 
9
8
  /**
10
9
  * Attributes that holds the sample rate that was locally applied to a span.
@@ -65,9 +64,7 @@ const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = 'cache.item_size';
65
64
 
66
65
  /** TODO: Remove these once we update to latest semantic conventions */
67
66
  const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = 'http.request.method';
68
- const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_TIME_TO_FIRST_BYTE = 'http.request.time_to_first_byte';
69
67
  const SEMANTIC_ATTRIBUTE_URL_FULL = 'url.full';
70
- const SEMANTIC_ATTRIBUTE_URL_QUERY = 'url.query';
71
68
 
72
69
  /**
73
70
  * A span link attribute to mark the link as a special span link.
@@ -96,58 +93,5 @@ const SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = 'sentry.link.type';
96
93
  */
97
94
  const GEN_AI_CONVERSATION_ID_ATTRIBUTE = 'gen_ai.conversation.id';
98
95
 
99
- // some attributes for span streaming, put onto every v2 span:
100
- // @see https://develop.sentry.dev/sdk/telemetry/spans/span-protocol/#common-attribute-keys
101
-
102
- /** The release version of the application */
103
- const SEMANTIC_ATTRIBUTE_SENTRY_RELEASE = 'sentry.release';
104
- /** The environment name (e.g., "production", "staging", "development") */
105
- const SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT = 'sentry.environment';
106
- /** The segment name (e.g., "GET /users") */
107
- const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME = 'sentry.segment.name';
108
- /** The id of the segment that this span belongs to. */
109
- const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID = 'sentry.segment.id';
110
- /** The user ID (gated by sendDefaultPii) */
111
- const SEMANTIC_ATTRIBUTE_USER_ID = 'user.id';
112
- /** The user email (gated by sendDefaultPii) */
113
- const SEMANTIC_ATTRIBUTE_USER_EMAIL = 'user.email';
114
- /** The user IP address (gated by sendDefaultPii) */
115
- const SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS = 'user.ip_address';
116
- /** The user username (gated by sendDefaultPii) */
117
- const SEMANTIC_ATTRIBUTE_USER_USERNAME = 'user.name';
118
- /** The name of the Sentry SDK (e.g., "sentry.php", "sentry.javascript") */
119
- const SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME = 'sentry.sdk.name';
120
- /** The version of the Sentry SDK */
121
- const SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION = 'sentry.sdk.version';
122
-
123
- // Web vital attributes
124
-
125
- // LCP
126
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_VALUE = 'browser.web_vital.lcp.value';
127
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ELEMENT = 'browser.web_vital.lcp.element';
128
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ID = 'browser.web_vital.lcp.id';
129
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_URL = 'browser.web_vital.lcp.url';
130
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_LOAD_TIME = 'browser.web_vital.lcp.load_time';
131
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_RENDER_TIME = 'browser.web_vital.lcp.render_time';
132
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_SIZE = 'browser.web_vital.lcp.size';
133
-
134
- // CLS
135
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_VALUE = 'browser.web_vital.cls.value';
136
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_SOURCES = 'browser.web_vital.cls.source';
137
-
138
- // INP
139
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_INP_VALUE = 'browser.web_vital.inp.value';
140
-
141
- // TTFB
142
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_VALUE = 'browser.web_vital.ttfb.value';
143
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_REQUEST_TIME = 'browser.web_vital.ttfb.request_time';
144
-
145
- // FP/FCP
146
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_FP_VALUE = 'browser.web_vital.fp.value';
147
- const SEMANTIC_ATTRIBUTE_WEB_VITAL_FCP_VALUE = 'browser.web_vital.fcp.value';
148
-
149
- // Browser connection information
150
- const SEMANTIC_ATTRIBUTE_BROWSER_CONNECTION_RTT = 'browser.connection.rtt';
151
-
152
- export { GEN_AI_CONVERSATION_ID_ATTRIBUTE, SEMANTIC_ATTRIBUTE_BROWSER_CONNECTION_RTT, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_TIME_TO_FIRST_BYTE, SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID, SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SPAN_SOURCE, SEMANTIC_ATTRIBUTE_URL_FULL, SEMANTIC_ATTRIBUTE_URL_QUERY, SEMANTIC_ATTRIBUTE_USER_EMAIL, SEMANTIC_ATTRIBUTE_USER_ID, SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS, SEMANTIC_ATTRIBUTE_USER_USERNAME, SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_SOURCES, SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_FCP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_FP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_INP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ELEMENT, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ID, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_LOAD_TIME, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_RENDER_TIME, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_SIZE, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_URL, SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_VALUE, SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_REQUEST_TIME, SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_VALUE, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE };
96
+ export { GEN_AI_CONVERSATION_ID_ATTRIBUTE, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_URL_FULL, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE };
153
97
  //# sourceMappingURL=semanticAttributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semanticAttributes.js","sources":["../../src/semanticAttributes.ts"],"sourcesContent":["/**\n * Use this attribute to represent the source of a span.\n * Should be one of: custom, url, route, view, component, task, unknown\n *\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = 'sentry.source';\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SPAN_SOURCE = 'sentry.span.source';\n\n/**\n * Attributes that holds the sample rate that was locally applied to a span.\n * If this attribute is not defined, it means that the span inherited a sampling decision.\n *\n * NOTE: Is only defined on root spans.\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = 'sentry.sample_rate';\n\n/**\n * Attribute holding the sample rate of the previous trace.\n * This is used to sample consistently across subsequent traces in the browser SDK.\n *\n * Note: Only defined on root spans, if opted into consistent sampling\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE = 'sentry.previous_trace_sample_rate';\n\n/**\n * Use this attribute to represent the operation of a span.\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_OP = 'sentry.op';\n\n/**\n * Use this attribute to represent the origin of a span.\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = 'sentry.origin';\n\n/** The reason why an idle span finished. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = 'sentry.idle_span_finish_reason';\n\n/** The unit of a measurement, which may be stored as a TimedEvent. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = 'sentry.measurement_unit';\n\n/** The value of a measurement, which may be stored as a TimedEvent. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = 'sentry.measurement_value';\n\n/**\n * A custom span name set by users guaranteed to be taken over any automatically\n * inferred name. This attribute is removed before the span is sent.\n *\n * @internal only meant for internal SDK usage\n * @hidden\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = 'sentry.custom_span_name';\n\n/**\n * The id of the profile that this span occurred in.\n */\nexport const SEMANTIC_ATTRIBUTE_PROFILE_ID = 'sentry.profile_id';\n\nexport const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = 'sentry.exclusive_time';\n\nexport const SEMANTIC_ATTRIBUTE_CACHE_HIT = 'cache.hit';\n\nexport const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key';\n\nexport const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = 'cache.item_size';\n\n/** TODO: Remove these once we update to latest semantic conventions */\nexport const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = 'http.request.method';\nexport const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_TIME_TO_FIRST_BYTE = 'http.request.time_to_first_byte';\nexport const SEMANTIC_ATTRIBUTE_URL_FULL = 'url.full';\nexport const SEMANTIC_ATTRIBUTE_URL_QUERY = 'url.query';\n\n/**\n * A span link attribute to mark the link as a special span link.\n *\n * Known values:\n * - `previous_trace`: The span links to the frontend root span of the previous trace.\n * - `next_trace`: The span links to the frontend root span of the next trace. (Not set by the SDK)\n *\n * Other values may be set as appropriate.\n * @see https://develop.sentry.dev/sdk/telemetry/traces/span-links/#link-types\n */\nexport const SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = 'sentry.link.type';\n\n/**\n * =============================================================================\n * GEN AI ATTRIBUTES\n * Based on OpenTelemetry Semantic Conventions for Generative AI\n * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/\n * =============================================================================\n */\n\n/**\n * The conversation ID for linking messages across API calls.\n * For OpenAI Assistants API: thread_id\n * For LangGraph: configurable.thread_id\n */\nexport const GEN_AI_CONVERSATION_ID_ATTRIBUTE = 'gen_ai.conversation.id';\n\n// some attributes for span streaming, put onto every v2 span:\n// @see https://develop.sentry.dev/sdk/telemetry/spans/span-protocol/#common-attribute-keys\n\n/** The release version of the application */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_RELEASE = 'sentry.release';\n/** The environment name (e.g., \"production\", \"staging\", \"development\") */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT = 'sentry.environment';\n/** The segment name (e.g., \"GET /users\") */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_NAME = 'sentry.segment.name';\n/** The id of the segment that this span belongs to. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SEGMENT_ID = 'sentry.segment.id';\n/** The user ID (gated by sendDefaultPii) */\nexport const SEMANTIC_ATTRIBUTE_USER_ID = 'user.id';\n/** The user email (gated by sendDefaultPii) */\nexport const SEMANTIC_ATTRIBUTE_USER_EMAIL = 'user.email';\n/** The user IP address (gated by sendDefaultPii) */\nexport const SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS = 'user.ip_address';\n/** The user username (gated by sendDefaultPii) */\nexport const SEMANTIC_ATTRIBUTE_USER_USERNAME = 'user.name';\n/** The name of the Sentry SDK (e.g., \"sentry.php\", \"sentry.javascript\") */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME = 'sentry.sdk.name';\n/** The version of the Sentry SDK */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION = 'sentry.sdk.version';\n\n// Web vital attributes\n\n// LCP\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_VALUE = 'browser.web_vital.lcp.value';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ELEMENT = 'browser.web_vital.lcp.element';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_ID = 'browser.web_vital.lcp.id';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_URL = 'browser.web_vital.lcp.url';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_LOAD_TIME = 'browser.web_vital.lcp.load_time';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_RENDER_TIME = 'browser.web_vital.lcp.render_time';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_LCP_SIZE = 'browser.web_vital.lcp.size';\n\n// CLS\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_VALUE = 'browser.web_vital.cls.value';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_CLS_SOURCES = 'browser.web_vital.cls.source';\n\n// INP\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_INP_VALUE = 'browser.web_vital.inp.value';\n\n// TTFB\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_VALUE = 'browser.web_vital.ttfb.value';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_TTFB_REQUEST_TIME = 'browser.web_vital.ttfb.request_time';\n\n// FP/FCP\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_FP_VALUE = 'browser.web_vital.fp.value';\nexport const SEMANTIC_ATTRIBUTE_WEB_VITAL_FCP_VALUE = 'browser.web_vital.fcp.value';\n\n// Browser connection information\nexport const SEMANTIC_ATTRIBUTE_BROWSER_CONNECTION_RTT = 'browser.connection.rtt';\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACO,MAAM,gCAAA,GAAmC;AACzC,MAAM,qCAAA,GAAwC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,qCAAA,GAAwC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oDAAA,GAAuD;;AAEpE;AACA;AACA;AACO,MAAM,4BAAA,GAA+B;;AAE5C;AACA;AACA;AACO,MAAM,gCAAA,GAAmC;;AAEhD;AACO,MAAM,iDAAA,GAAoD;;AAEjE;AACO,MAAM,0CAAA,GAA6C;;AAE1D;AACO,MAAM,2CAAA,GAA8C;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,0CAAA,GAA6C;;AAE1D;AACA;AACA;AACO,MAAM,6BAAA,GAAgC;;AAEtC,MAAM,iCAAA,GAAoC;;AAE1C,MAAM,4BAAA,GAA+B;;AAErC,MAAM,4BAAA,GAA+B;;AAErC,MAAM,kCAAA,GAAqC;;AAElD;AACO,MAAM,sCAAA,GAAyC;AAC/C,MAAM,kDAAA,GAAqD;AAC3D,MAAM,2BAAA,GAA8B;AACpC,MAAM,4BAAA,GAA+B;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,iCAAA,GAAoC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,gCAAA,GAAmC;;AAEhD;AACA;;AAEA;AACO,MAAM,iCAAA,GAAoC;AACjD;AACO,MAAM,qCAAA,GAAwC;AACrD;AACO,MAAM,sCAAA,GAAyC;AACtD;AACO,MAAM,oCAAA,GAAuC;AACpD;AACO,MAAM,0BAAA,GAA6B;AAC1C;AACO,MAAM,6BAAA,GAAgC;AAC7C;AACO,MAAM,kCAAA,GAAqC;AAClD;AACO,MAAM,gCAAA,GAAmC;AAChD;AACO,MAAM,kCAAA,GAAqC;AAClD;AACO,MAAM,qCAAA,GAAwC;;AAErD;;AAEA;AACO,MAAM,sCAAA,GAAyC;AAC/C,MAAM,wCAAA,GAA2C;AACjD,MAAM,mCAAA,GAAsC;AAC5C,MAAM,oCAAA,GAAuC;AAC7C,MAAM,0CAAA,GAA6C;AACnD,MAAM,4CAAA,GAA+C;AACrD,MAAM,qCAAA,GAAwC;;AAErD;AACO,MAAM,sCAAA,GAAyC;AAC/C,MAAM,wCAAA,GAA2C;;AAExD;AACO,MAAM,sCAAA,GAAyC;;AAEtD;AACO,MAAM,uCAAA,GAA0C;AAChD,MAAM,8CAAA,GAAiD;;AAE9D;AACO,MAAM,qCAAA,GAAwC;AAC9C,MAAM,sCAAA,GAAyC;;AAEtD;AACO,MAAM,yCAAA,GAA4C;;;;"}
1
+ {"version":3,"file":"semanticAttributes.js","sources":["../../src/semanticAttributes.ts"],"sourcesContent":["/**\n * Use this attribute to represent the source of a span.\n * Should be one of: custom, url, route, view, component, task, unknown\n *\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = 'sentry.source';\n\n/**\n * Attributes that holds the sample rate that was locally applied to a span.\n * If this attribute is not defined, it means that the span inherited a sampling decision.\n *\n * NOTE: Is only defined on root spans.\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = 'sentry.sample_rate';\n\n/**\n * Attribute holding the sample rate of the previous trace.\n * This is used to sample consistently across subsequent traces in the browser SDK.\n *\n * Note: Only defined on root spans, if opted into consistent sampling\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE = 'sentry.previous_trace_sample_rate';\n\n/**\n * Use this attribute to represent the operation of a span.\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_OP = 'sentry.op';\n\n/**\n * Use this attribute to represent the origin of a span.\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = 'sentry.origin';\n\n/** The reason why an idle span finished. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = 'sentry.idle_span_finish_reason';\n\n/** The unit of a measurement, which may be stored as a TimedEvent. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = 'sentry.measurement_unit';\n\n/** The value of a measurement, which may be stored as a TimedEvent. */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = 'sentry.measurement_value';\n\n/**\n * A custom span name set by users guaranteed to be taken over any automatically\n * inferred name. This attribute is removed before the span is sent.\n *\n * @internal only meant for internal SDK usage\n * @hidden\n */\nexport const SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = 'sentry.custom_span_name';\n\n/**\n * The id of the profile that this span occurred in.\n */\nexport const SEMANTIC_ATTRIBUTE_PROFILE_ID = 'sentry.profile_id';\n\nexport const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = 'sentry.exclusive_time';\n\nexport const SEMANTIC_ATTRIBUTE_CACHE_HIT = 'cache.hit';\n\nexport const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key';\n\nexport const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = 'cache.item_size';\n\n/** TODO: Remove these once we update to latest semantic conventions */\nexport const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = 'http.request.method';\nexport const SEMANTIC_ATTRIBUTE_URL_FULL = 'url.full';\n\n/**\n * A span link attribute to mark the link as a special span link.\n *\n * Known values:\n * - `previous_trace`: The span links to the frontend root span of the previous trace.\n * - `next_trace`: The span links to the frontend root span of the next trace. (Not set by the SDK)\n *\n * Other values may be set as appropriate.\n * @see https://develop.sentry.dev/sdk/telemetry/traces/span-links/#link-types\n */\nexport const SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = 'sentry.link.type';\n\n/**\n * =============================================================================\n * GEN AI ATTRIBUTES\n * Based on OpenTelemetry Semantic Conventions for Generative AI\n * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/\n * =============================================================================\n */\n\n/**\n * The conversation ID for linking messages across API calls.\n * For OpenAI Assistants API: thread_id\n * For LangGraph: configurable.thread_id\n */\nexport const GEN_AI_CONVERSATION_ID_ATTRIBUTE = 'gen_ai.conversation.id';\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACO,MAAM,gCAAA,GAAmC;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,qCAAA,GAAwC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oDAAA,GAAuD;;AAEpE;AACA;AACA;AACO,MAAM,4BAAA,GAA+B;;AAE5C;AACA;AACA;AACO,MAAM,gCAAA,GAAmC;;AAEhD;AACO,MAAM,iDAAA,GAAoD;;AAEjE;AACO,MAAM,0CAAA,GAA6C;;AAE1D;AACO,MAAM,2CAAA,GAA8C;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,0CAAA,GAA6C;;AAE1D;AACA;AACA;AACO,MAAM,6BAAA,GAAgC;;AAEtC,MAAM,iCAAA,GAAoC;;AAE1C,MAAM,4BAAA,GAA+B;;AAErC,MAAM,4BAAA,GAA+B;;AAErC,MAAM,kCAAA,GAAqC;;AAElD;AACO,MAAM,sCAAA,GAAyC;AAC/C,MAAM,2BAAA,GAA8B;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,iCAAA,GAAoC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,gCAAA,GAAmC;;;;"}
@@ -1,19 +1,16 @@
1
- import { serializeAttributes } from '../attributes.js';
2
1
  import { getClient, getCurrentScope } from '../currentScopes.js';
3
2
  import { DEBUG_BUILD } from '../debug-build.js';
4
3
  import { createSpanEnvelope } from '../envelope.js';
5
4
  import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '../semanticAttributes.js';
6
5
  import { debug } from '../utils/debug-logger.js';
7
6
  import { generateTraceId, generateSpanId } from '../utils/propagationContext.js';
8
- import { TRACE_FLAG_SAMPLED, TRACE_FLAG_NONE, spanTimeInputToSeconds, convertSpanLinksForEnvelope, getRootSpan, getStatusMessage, getV2SpanLinks, getV2StatusMessage, spanToJSON, getSpanDescendants, spanToTransactionTraceContext } from '../utils/spanUtils.js';
7
+ import { TRACE_FLAG_SAMPLED, TRACE_FLAG_NONE, spanTimeInputToSeconds, convertSpanLinksForEnvelope, getRootSpan, getStatusMessage, spanToJSON, getSpanDescendants, spanToTransactionTraceContext } from '../utils/spanUtils.js';
9
8
  import { timestampInSeconds } from '../utils/time.js';
10
9
  import { getDynamicSamplingContextFromSpan } from './dynamicSamplingContext.js';
11
10
  import { logSpanEnd } from './logSpans.js';
12
11
  import { timedEventsToMeasurements } from './measurement.js';
13
12
  import { getCapturedScopesOnSpan } from './utils.js';
14
13
 
15
- /* eslint-disable max-lines */
16
-
17
14
  const MAX_SPAN_COUNT = 1000;
18
15
 
19
16
  /**
@@ -204,30 +201,6 @@ class SentrySpan {
204
201
  };
205
202
  }
206
203
 
207
- /**
208
- * Get SpanV2JSON representation of this span.
209
- *
210
- * @hidden
211
- * @internal This method is purely for internal purposes and should not be used outside
212
- * of SDK code. If you need to get a JSON representation of a span,
213
- * use `spanToV2JSON(span)` instead.
214
- */
215
- getSpanV2JSON() {
216
- return {
217
- name: this._name ?? '',
218
- span_id: this._spanId,
219
- trace_id: this._traceId,
220
- parent_span_id: this._parentSpanId,
221
- start_timestamp: this._startTime,
222
- // just in case _endTime is not set, we use the start time (i.e. duration 0)
223
- end_timestamp: this._endTime ?? this._startTime,
224
- is_segment: this._isStandaloneSpan || this === getRootSpan(this),
225
- status: getV2StatusMessage(this._status),
226
- attributes: serializeAttributes(this._attributes),
227
- links: getV2SpanLinks(this._links),
228
- };
229
- }
230
-
231
204
  /** @inheritdoc */
232
205
  isRecording() {
233
206
  return !this._endTime && !!this._sampled;
@@ -274,7 +247,6 @@ class SentrySpan {
274
247
  const client = getClient();
275
248
  if (client) {
276
249
  client.emit('spanEnd', this);
277
- client.emit('afterSpanEnd', this);
278
250
  }
279
251
 
280
252
  // A segment span is basically the root span of a local span tree.
@@ -298,10 +270,6 @@ class SentrySpan {
298
270
  }
299
271
  }
300
272
  return;
301
- } else if (client?.getOptions().traceLifecycle === 'stream') {
302
- // TODO (spans): Remove standalone span custom logic in favor of sending simple v2 web vital spans
303
- client?.emit('afterSegmentSpanEnd', this);
304
- return;
305
273
  }
306
274
 
307
275
  const transactionEvent = this._convertSpanToTransaction();