@sentry/opentelemetry 8.0.0-alpha.2 → 8.0.0-alpha.3

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 (176) hide show
  1. package/README.md +2 -1
  2. package/cjs/index.js +2120 -55
  3. package/cjs/index.js.map +1 -1
  4. package/esm/index.js +2091 -23
  5. package/esm/index.js.map +1 -1
  6. package/esm/package.json +1 -0
  7. package/package.json +18 -5
  8. package/types/asyncContextStrategy.d.ts.map +1 -1
  9. package/types/constants.d.ts +2 -3
  10. package/types/constants.d.ts.map +1 -1
  11. package/types/contextManager.d.ts.map +1 -1
  12. package/types/custom/getCurrentHub.d.ts.map +1 -1
  13. package/types/index.d.ts +4 -6
  14. package/types/index.d.ts.map +1 -1
  15. package/types/propagator.d.ts +16 -1
  16. package/types/propagator.d.ts.map +1 -1
  17. package/types/sampler.d.ts.map +1 -1
  18. package/types/semanticAttributes.d.ts +2 -7
  19. package/types/semanticAttributes.d.ts.map +1 -1
  20. package/types/setupEventContextTrace.d.ts.map +1 -1
  21. package/types/spanExporter.d.ts.map +1 -1
  22. package/types/spanProcessor.d.ts.map +1 -1
  23. package/types/trace.d.ts +14 -1
  24. package/types/trace.d.ts.map +1 -1
  25. package/types/types.d.ts +3 -4
  26. package/types/types.d.ts.map +1 -1
  27. package/types/utils/captureExceptionForTimedEvent.d.ts +1 -2
  28. package/types/utils/captureExceptionForTimedEvent.d.ts.map +1 -1
  29. package/types/utils/contextData.d.ts +1 -11
  30. package/types/utils/contextData.d.ts.map +1 -1
  31. package/types/utils/dynamicSamplingContext.d.ts.map +1 -1
  32. package/types/utils/getActiveSpan.d.ts +0 -5
  33. package/types/utils/getActiveSpan.d.ts.map +1 -1
  34. package/types/utils/groupSpansWithParents.d.ts.map +1 -1
  35. package/types/utils/spanData.d.ts +1 -14
  36. package/types/utils/spanData.d.ts.map +1 -1
  37. package/types-ts3.8/constants.d.ts +2 -3
  38. package/types-ts3.8/index.d.ts +4 -6
  39. package/types-ts3.8/propagator.d.ts +16 -1
  40. package/types-ts3.8/semanticAttributes.d.ts +2 -7
  41. package/types-ts3.8/trace.d.ts +14 -1
  42. package/types-ts3.8/types.d.ts +3 -4
  43. package/types-ts3.8/utils/captureExceptionForTimedEvent.d.ts +1 -2
  44. package/types-ts3.8/utils/contextData.d.ts +1 -11
  45. package/types-ts3.8/utils/getActiveSpan.d.ts +0 -5
  46. package/types-ts3.8/utils/spanData.d.ts +1 -14
  47. package/cjs/asyncContextStrategy.js +0 -114
  48. package/cjs/asyncContextStrategy.js.map +0 -1
  49. package/cjs/constants.js +0 -30
  50. package/cjs/constants.js.map +0 -1
  51. package/cjs/contextManager.js +0 -87
  52. package/cjs/contextManager.js.map +0 -1
  53. package/cjs/custom/client.js +0 -64
  54. package/cjs/custom/client.js.map +0 -1
  55. package/cjs/custom/getCurrentHub.js +0 -106
  56. package/cjs/custom/getCurrentHub.js.map +0 -1
  57. package/cjs/custom/hub.js +0 -13
  58. package/cjs/custom/hub.js.map +0 -1
  59. package/cjs/custom/hubextensions.js +0 -37
  60. package/cjs/custom/hubextensions.js.map +0 -1
  61. package/cjs/custom/transaction.js +0 -26
  62. package/cjs/custom/transaction.js.map +0 -1
  63. package/cjs/debug-build.js +0 -11
  64. package/cjs/debug-build.js.map +0 -1
  65. package/cjs/propagator.js +0 -217
  66. package/cjs/propagator.js.map +0 -1
  67. package/cjs/sampler.js +0 -188
  68. package/cjs/sampler.js.map +0 -1
  69. package/cjs/semanticAttributes.js +0 -12
  70. package/cjs/semanticAttributes.js.map +0 -1
  71. package/cjs/setupEventContextTrace.js +0 -40
  72. package/cjs/setupEventContextTrace.js.map +0 -1
  73. package/cjs/spanExporter.js +0 -307
  74. package/cjs/spanExporter.js.map +0 -1
  75. package/cjs/spanProcessor.js +0 -98
  76. package/cjs/spanProcessor.js.map +0 -1
  77. package/cjs/trace.js +0 -222
  78. package/cjs/trace.js.map +0 -1
  79. package/cjs/utils/addOriginToSpan.js +0 -11
  80. package/cjs/utils/addOriginToSpan.js.map +0 -1
  81. package/cjs/utils/captureExceptionForTimedEvent.js +0 -59
  82. package/cjs/utils/captureExceptionForTimedEvent.js.map +0 -1
  83. package/cjs/utils/contextData.js +0 -61
  84. package/cjs/utils/contextData.js.map +0 -1
  85. package/cjs/utils/convertOtelTimeToSeconds.js +0 -9
  86. package/cjs/utils/convertOtelTimeToSeconds.js.map +0 -1
  87. package/cjs/utils/dynamicSamplingContext.js +0 -64
  88. package/cjs/utils/dynamicSamplingContext.js.map +0 -1
  89. package/cjs/utils/getActiveSpan.js +0 -29
  90. package/cjs/utils/getActiveSpan.js.map +0 -1
  91. package/cjs/utils/getRequestSpanData.js +0 -48
  92. package/cjs/utils/getRequestSpanData.js.map +0 -1
  93. package/cjs/utils/getSpanKind.js +0 -21
  94. package/cjs/utils/getSpanKind.js.map +0 -1
  95. package/cjs/utils/groupSpansWithParents.js +0 -74
  96. package/cjs/utils/groupSpansWithParents.js.map +0 -1
  97. package/cjs/utils/isSentryRequest.js +0 -29
  98. package/cjs/utils/isSentryRequest.js.map +0 -1
  99. package/cjs/utils/mapStatus.js +0 -77
  100. package/cjs/utils/mapStatus.js.map +0 -1
  101. package/cjs/utils/parseSpanDescription.js +0 -158
  102. package/cjs/utils/parseSpanDescription.js.map +0 -1
  103. package/cjs/utils/setupCheck.js +0 -17
  104. package/cjs/utils/setupCheck.js.map +0 -1
  105. package/cjs/utils/spanData.js +0 -72
  106. package/cjs/utils/spanData.js.map +0 -1
  107. package/cjs/utils/spanTypes.js +0 -77
  108. package/cjs/utils/spanTypes.js.map +0 -1
  109. package/esm/asyncContextStrategy.js +0 -112
  110. package/esm/asyncContextStrategy.js.map +0 -1
  111. package/esm/constants.js +0 -20
  112. package/esm/constants.js.map +0 -1
  113. package/esm/contextManager.js +0 -82
  114. package/esm/contextManager.js.map +0 -1
  115. package/esm/custom/client.js +0 -59
  116. package/esm/custom/client.js.map +0 -1
  117. package/esm/custom/getCurrentHub.js +0 -101
  118. package/esm/custom/getCurrentHub.js.map +0 -1
  119. package/esm/custom/hub.js +0 -11
  120. package/esm/custom/hub.js.map +0 -1
  121. package/esm/custom/hubextensions.js +0 -35
  122. package/esm/custom/hubextensions.js.map +0 -1
  123. package/esm/custom/transaction.js +0 -24
  124. package/esm/custom/transaction.js.map +0 -1
  125. package/esm/debug-build.js +0 -9
  126. package/esm/debug-build.js.map +0 -1
  127. package/esm/propagator.js +0 -210
  128. package/esm/propagator.js.map +0 -1
  129. package/esm/sampler.js +0 -186
  130. package/esm/sampler.js.map +0 -1
  131. package/esm/semanticAttributes.js +0 -10
  132. package/esm/semanticAttributes.js.map +0 -1
  133. package/esm/setupEventContextTrace.js +0 -38
  134. package/esm/setupEventContextTrace.js.map +0 -1
  135. package/esm/spanExporter.js +0 -305
  136. package/esm/spanExporter.js.map +0 -1
  137. package/esm/spanProcessor.js +0 -96
  138. package/esm/spanProcessor.js.map +0 -1
  139. package/esm/trace.js +0 -217
  140. package/esm/trace.js.map +0 -1
  141. package/esm/utils/addOriginToSpan.js +0 -9
  142. package/esm/utils/addOriginToSpan.js.map +0 -1
  143. package/esm/utils/captureExceptionForTimedEvent.js +0 -57
  144. package/esm/utils/captureExceptionForTimedEvent.js.map +0 -1
  145. package/esm/utils/contextData.js +0 -54
  146. package/esm/utils/contextData.js.map +0 -1
  147. package/esm/utils/convertOtelTimeToSeconds.js +0 -7
  148. package/esm/utils/convertOtelTimeToSeconds.js.map +0 -1
  149. package/esm/utils/dynamicSamplingContext.js +0 -59
  150. package/esm/utils/dynamicSamplingContext.js.map +0 -1
  151. package/esm/utils/getActiveSpan.js +0 -26
  152. package/esm/utils/getActiveSpan.js.map +0 -1
  153. package/esm/utils/getRequestSpanData.js +0 -46
  154. package/esm/utils/getRequestSpanData.js.map +0 -1
  155. package/esm/utils/getSpanKind.js +0 -19
  156. package/esm/utils/getSpanKind.js.map +0 -1
  157. package/esm/utils/groupSpansWithParents.js +0 -72
  158. package/esm/utils/groupSpansWithParents.js.map +0 -1
  159. package/esm/utils/isSentryRequest.js +0 -27
  160. package/esm/utils/isSentryRequest.js.map +0 -1
  161. package/esm/utils/mapStatus.js +0 -75
  162. package/esm/utils/mapStatus.js.map +0 -1
  163. package/esm/utils/parseSpanDescription.js +0 -154
  164. package/esm/utils/parseSpanDescription.js.map +0 -1
  165. package/esm/utils/setupCheck.js +0 -14
  166. package/esm/utils/setupCheck.js.map +0 -1
  167. package/esm/utils/spanData.js +0 -63
  168. package/esm/utils/spanData.js.map +0 -1
  169. package/esm/utils/spanTypes.js +0 -70
  170. package/esm/utils/spanTypes.js.map +0 -1
  171. package/types/custom/hubextensions.d.ts +0 -5
  172. package/types/custom/hubextensions.d.ts.map +0 -1
  173. package/types/custom/transaction.d.ts +0 -8
  174. package/types/custom/transaction.d.ts.map +0 -1
  175. package/types-ts3.8/custom/hubextensions.d.ts +0 -5
  176. package/types-ts3.8/custom/transaction.d.ts +0 -8
@@ -1,46 +0,0 @@
1
- import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
2
- import { parseUrl, getSanitizedUrlString } from '@sentry/utils';
3
- import { spanHasAttributes } from './spanTypes.js';
4
-
5
- /**
6
- * Get sanitizied request data from an OTEL span.
7
- */
8
- function getRequestSpanData(span) {
9
- // The base `Span` type has no `attributes`, so we need to guard here against that
10
- if (!spanHasAttributes(span)) {
11
- return {};
12
- }
13
-
14
- const data = {
15
- url: span.attributes[SemanticAttributes.HTTP_URL] ,
16
- 'http.method': span.attributes[SemanticAttributes.HTTP_METHOD] ,
17
- };
18
-
19
- // Default to GET if URL is set but method is not
20
- if (!data['http.method'] && data.url) {
21
- data['http.method'] = 'GET';
22
- }
23
-
24
- try {
25
- const urlStr = span.attributes[SemanticAttributes.HTTP_URL];
26
- if (typeof urlStr === 'string') {
27
- const url = parseUrl(urlStr);
28
-
29
- data.url = getSanitizedUrlString(url);
30
-
31
- if (url.search) {
32
- data['http.query'] = url.search;
33
- }
34
- if (url.hash) {
35
- data['http.fragment'] = url.hash;
36
- }
37
- }
38
- } catch (e) {
39
- // ignore
40
- }
41
-
42
- return data;
43
- }
44
-
45
- export { getRequestSpanData };
46
- //# sourceMappingURL=getRequestSpanData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRequestSpanData.js","sources":["../../../src/utils/getRequestSpanData.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type { SanitizedRequestData } from '@sentry/types';\nimport { getSanitizedUrlString, parseUrl } from '@sentry/utils';\n\nimport { spanHasAttributes } from './spanTypes';\n\n/**\n * Get sanitizied request data from an OTEL span.\n */\nexport function getRequestSpanData(span: Span | ReadableSpan): Partial<SanitizedRequestData> {\n // The base `Span` type has no `attributes`, so we need to guard here against that\n if (!spanHasAttributes(span)) {\n return {};\n }\n\n const data: Partial<SanitizedRequestData> = {\n url: span.attributes[SemanticAttributes.HTTP_URL] as string | undefined,\n 'http.method': span.attributes[SemanticAttributes.HTTP_METHOD] as string | undefined,\n };\n\n // Default to GET if URL is set but method is not\n if (!data['http.method'] && data.url) {\n data['http.method'] = 'GET';\n }\n\n try {\n const urlStr = span.attributes[SemanticAttributes.HTTP_URL];\n if (typeof urlStr === 'string') {\n const url = parseUrl(urlStr);\n\n data.url = getSanitizedUrlString(url);\n\n if (url.search) {\n data['http.query'] = url.search;\n }\n if (url.hash) {\n data['http.fragment'] = url.hash;\n }\n }\n } catch {\n // ignore\n }\n\n return data;\n}\n"],"names":[],"mappings":";;;;AAQA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,IAAI,EAAsD;AAC7F;AACA,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;AAChC,IAAI,OAAO,EAAE,CAAA;AACb,GAAE;AACF;AACA,EAAE,MAAM,IAAI,GAAkC;AAC9C,IAAI,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAE;AACtD,IAAI,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAE;AACnE,GAAG,CAAA;AACH;AACA;AACA,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAA,IAAK,IAAI,CAAC,GAAG,EAAE;AACxC,IAAI,IAAI,CAAC,aAAa,CAAA,GAAI,KAAK,CAAA;AAC/B,GAAE;AACF;AACA,EAAE,IAAI;AACN,IAAI,MAAM,MAAO,GAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AAC/D,IAAI,IAAI,OAAO,MAAO,KAAI,QAAQ,EAAE;AACpC,MAAM,MAAM,GAAI,GAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;AAClC;AACA,MAAM,IAAI,CAAC,GAAA,GAAM,qBAAqB,CAAC,GAAG,CAAC,CAAA;AAC3C;AACA,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE;AACtB,QAAQ,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC,MAAM,CAAA;AACvC,OAAM;AACN,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE;AACpB,QAAQ,IAAI,CAAC,eAAe,IAAI,GAAG,CAAC,IAAI,CAAA;AACxC,OAAM;AACN,KAAI;AACJ,IAAI,OAAM,CAAA,EAAA;AACV;AACA,GAAE;AACF;AACA,EAAE,OAAO,IAAI,CAAA;AACb;;;;"}
@@ -1,19 +0,0 @@
1
- import { SpanKind } from '@opentelemetry/api';
2
- import { spanHasKind } from './spanTypes.js';
3
-
4
- /**
5
- * Get the span kind from a span.
6
- * For whatever reason, this is not public API on the generic "Span" type,
7
- * so we need to check if we actually have a `SDKTraceBaseSpan` where we can fetch this from.
8
- * Otherwise, we fall back to `SpanKind.INTERNAL`.
9
- */
10
- function getSpanKind(span) {
11
- if (spanHasKind(span)) {
12
- return span.kind;
13
- }
14
-
15
- return SpanKind.INTERNAL;
16
- }
17
-
18
- export { getSpanKind };
19
- //# sourceMappingURL=getSpanKind.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getSpanKind.js","sources":["../../../src/utils/getSpanKind.ts"],"sourcesContent":["import { SpanKind } from '@opentelemetry/api';\n\nimport type { AbstractSpan } from '../types';\nimport { spanHasKind } from './spanTypes';\n\n/**\n * Get the span kind from a span.\n * For whatever reason, this is not public API on the generic \"Span\" type,\n * so we need to check if we actually have a `SDKTraceBaseSpan` where we can fetch this from.\n * Otherwise, we fall back to `SpanKind.INTERNAL`.\n */\nexport function getSpanKind(span: AbstractSpan): SpanKind {\n if (spanHasKind(span)) {\n return span.kind;\n }\n\n return SpanKind.INTERNAL;\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,IAAI,EAA0B;AAC1D,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;AACzB,IAAI,OAAO,IAAI,CAAC,IAAI,CAAA;AACpB,GAAE;AACF;AACA,EAAE,OAAO,QAAQ,CAAC,QAAQ,CAAA;AAC1B;;;;"}
@@ -1,72 +0,0 @@
1
- import { getSpanParent } from './spanData.js';
2
-
3
- /**
4
- * This function runs through a list of OTEL Spans, and wraps them in an `SpanNode`
5
- * where each node holds a reference to their parent node.
6
- */
7
- function groupSpansWithParents(spans) {
8
- const nodeMap = new Map();
9
-
10
- for (const span of spans) {
11
- createOrUpdateSpanNodeAndRefs(nodeMap, span);
12
- }
13
-
14
- return Array.from(nodeMap, function ([_id, spanNode]) {
15
- return spanNode;
16
- });
17
- }
18
-
19
- function createOrUpdateSpanNodeAndRefs(nodeMap, span) {
20
- const parentSpan = getSpanParent(span);
21
- const parentIsRemote = parentSpan ? !!parentSpan.spanContext().isRemote : false;
22
-
23
- const id = span.spanContext().spanId;
24
-
25
- // If the parentId is the trace parent ID, we pretend it's undefined
26
- // As this means the parent exists somewhere else
27
- const parentId = !parentIsRemote ? span.parentSpanId : undefined;
28
-
29
- if (!parentId) {
30
- createOrUpdateNode(nodeMap, { id, span, children: [] });
31
- return;
32
- }
33
-
34
- // Else make sure to create parent node as well
35
- // Note that the parent may not know it's parent _yet_, this may be updated in a later pass
36
- const parentNode = createOrGetParentNode(nodeMap, parentId);
37
- const node = createOrUpdateNode(nodeMap, { id, span, parentNode, children: [] });
38
- parentNode.children.push(node);
39
- }
40
-
41
- function createOrGetParentNode(nodeMap, id) {
42
- const existing = nodeMap.get(id);
43
-
44
- if (existing) {
45
- return existing;
46
- }
47
-
48
- return createOrUpdateNode(nodeMap, { id, children: [] });
49
- }
50
-
51
- function createOrUpdateNode(nodeMap, spanNode) {
52
- const existing = nodeMap.get(spanNode.id);
53
-
54
- // If span is already set, nothing to do here
55
- if (existing && existing.span) {
56
- return existing;
57
- }
58
-
59
- // If it exists but span is not set yet, we update it
60
- if (existing && !existing.span) {
61
- existing.span = spanNode.span;
62
- existing.parentNode = spanNode.parentNode;
63
- return existing;
64
- }
65
-
66
- // Else, we create a new one...
67
- nodeMap.set(spanNode.id, spanNode);
68
- return spanNode;
69
- }
70
-
71
- export { groupSpansWithParents };
72
- //# sourceMappingURL=groupSpansWithParents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupSpansWithParents.js","sources":["../../../src/utils/groupSpansWithParents.ts"],"sourcesContent":["import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\n\nimport { getSpanParent } from './spanData';\n\nexport interface SpanNode {\n id: string;\n span?: ReadableSpan;\n parentNode?: SpanNode | undefined;\n children: SpanNode[];\n}\n\ntype SpanMap = Map<string, SpanNode>;\n\n/**\n * This function runs through a list of OTEL Spans, and wraps them in an `SpanNode`\n * where each node holds a reference to their parent node.\n */\nexport function groupSpansWithParents(spans: ReadableSpan[]): SpanNode[] {\n const nodeMap: SpanMap = new Map<string, SpanNode>();\n\n for (const span of spans) {\n createOrUpdateSpanNodeAndRefs(nodeMap, span);\n }\n\n return Array.from(nodeMap, function ([_id, spanNode]) {\n return spanNode;\n });\n}\n\nfunction createOrUpdateSpanNodeAndRefs(nodeMap: SpanMap, span: ReadableSpan): void {\n const parentSpan = getSpanParent(span);\n const parentIsRemote = parentSpan ? !!parentSpan.spanContext().isRemote : false;\n\n const id = span.spanContext().spanId;\n\n // If the parentId is the trace parent ID, we pretend it's undefined\n // As this means the parent exists somewhere else\n const parentId = !parentIsRemote ? span.parentSpanId : undefined;\n\n if (!parentId) {\n createOrUpdateNode(nodeMap, { id, span, children: [] });\n return;\n }\n\n // Else make sure to create parent node as well\n // Note that the parent may not know it's parent _yet_, this may be updated in a later pass\n const parentNode = createOrGetParentNode(nodeMap, parentId);\n const node = createOrUpdateNode(nodeMap, { id, span, parentNode, children: [] });\n parentNode.children.push(node);\n}\n\nfunction createOrGetParentNode(nodeMap: SpanMap, id: string): SpanNode {\n const existing = nodeMap.get(id);\n\n if (existing) {\n return existing;\n }\n\n return createOrUpdateNode(nodeMap, { id, children: [] });\n}\n\nfunction createOrUpdateNode(nodeMap: SpanMap, spanNode: SpanNode): SpanNode {\n const existing = nodeMap.get(spanNode.id);\n\n // If span is already set, nothing to do here\n if (existing && existing.span) {\n return existing;\n }\n\n // If it exists but span is not set yet, we update it\n if (existing && !existing.span) {\n existing.span = spanNode.span;\n existing.parentNode = spanNode.parentNode;\n return existing;\n }\n\n // Else, we create a new one...\n nodeMap.set(spanNode.id, spanNode);\n return spanNode;\n}\n"],"names":[],"mappings":";;AAaA;AACA;AACA;AACA;AACO,SAAS,qBAAqB,CAAC,KAAK,EAA8B;AACzE,EAAE,MAAM,OAAO,GAAY,IAAI,GAAG,EAAoB,CAAA;AACtD;AACA,EAAE,KAAK,MAAM,IAAK,IAAG,KAAK,EAAE;AAC5B,IAAI,6BAA6B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAChD,GAAE;AACF;AACA,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;AACxD,IAAI,OAAO,QAAQ,CAAA;AACnB,GAAG,CAA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kB,CAAC,OAAO,EAAW,QAAQ,EAAsB;AAC5E,EAAE,MAAM,QAAS,GAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;AAC3C;AACA;AACA,EAAE,IAAI,QAAA,IAAY,QAAQ,CAAC,IAAI,EAAE;AACjC,IAAI,OAAO,QAAQ,CAAA;AACnB,GAAE;AACF;AACA;AACA,EAAE,IAAI,QAAS,IAAG,CAAC,QAAQ,CAAC,IAAI,EAAE;AAClC,IAAI,QAAQ,CAAC,IAAA,GAAO,QAAQ,CAAC,IAAI,CAAA;AACjC,IAAI,QAAQ,CAAC,UAAA,GAAa,QAAQ,CAAC,UAAU,CAAA;AAC7C,IAAI,OAAO,QAAQ,CAAA;AACnB,GAAE;AACF;AACA;AACA,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;AACpC,EAAE,OAAO,QAAQ,CAAA;AACjB;;;;"}
@@ -1,27 +0,0 @@
1
- import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
2
- import { isSentryRequestUrl, getClient } from '@sentry/core';
3
- import { spanHasAttributes } from './spanTypes.js';
4
-
5
- /**
6
- *
7
- * @param otelSpan Checks wheter a given OTEL Span is an http request to sentry.
8
- * @returns boolean
9
- */
10
- function isSentryRequestSpan(span) {
11
- if (!spanHasAttributes(span)) {
12
- return false;
13
- }
14
-
15
- const { attributes } = span;
16
-
17
- const httpUrl = attributes[SemanticAttributes.HTTP_URL];
18
-
19
- if (!httpUrl) {
20
- return false;
21
- }
22
-
23
- return isSentryRequestUrl(httpUrl.toString(), getClient());
24
- }
25
-
26
- export { isSentryRequestSpan };
27
- //# sourceMappingURL=isSentryRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isSentryRequest.js","sources":["../../../src/utils/isSentryRequest.ts"],"sourcesContent":["import { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport { getClient, isSentryRequestUrl } from '@sentry/core';\n\nimport type { AbstractSpan } from '../types';\nimport { spanHasAttributes } from './spanTypes';\n\n/**\n *\n * @param otelSpan Checks wheter a given OTEL Span is an http request to sentry.\n * @returns boolean\n */\nexport function isSentryRequestSpan(span: AbstractSpan): boolean {\n if (!spanHasAttributes(span)) {\n return false;\n }\n\n const { attributes } = span;\n\n const httpUrl = attributes[SemanticAttributes.HTTP_URL];\n\n if (!httpUrl) {\n return false;\n }\n\n return isSentryRequestUrl(httpUrl.toString(), getClient());\n}\n"],"names":[],"mappings":";;;;AAMA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,IAAI,EAAyB;AACjE,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;AAChC,IAAI,OAAO,KAAK,CAAA;AAChB,GAAE;AACF;AACA,EAAE,MAAM,EAAE,UAAW,EAAA,GAAI,IAAI,CAAA;AAC7B;AACA,EAAE,MAAM,UAAU,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AACzD;AACA,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,OAAO,KAAK,CAAA;AAChB,GAAE;AACF;AACA,EAAE,OAAO,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;AAC5D;;;;"}
@@ -1,75 +0,0 @@
1
- import { SpanStatusCode } from '@opentelemetry/api';
2
- import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
3
- import { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';
4
- import { spanHasAttributes, spanHasStatus } from './spanTypes.js';
5
-
6
- // canonicalCodesHTTPMap maps some HTTP codes to Sentry's span statuses. See possible mapping in https://develop.sentry.dev/sdk/event-payloads/span/
7
- const canonicalCodesHTTPMap = {
8
- '400': 'failed_precondition',
9
- '401': 'unauthenticated',
10
- '403': 'permission_denied',
11
- '404': 'not_found',
12
- '409': 'aborted',
13
- '429': 'resource_exhausted',
14
- '499': 'cancelled',
15
- '500': 'internal_error',
16
- '501': 'unimplemented',
17
- '503': 'unavailable',
18
- '504': 'deadline_exceeded',
19
- } ;
20
-
21
- // canonicalCodesGrpcMap maps some GRPC codes to Sentry's span statuses. See description in grpc documentation.
22
- const canonicalCodesGrpcMap = {
23
- '1': 'cancelled',
24
- '2': 'unknown_error',
25
- '3': 'invalid_argument',
26
- '4': 'deadline_exceeded',
27
- '5': 'not_found',
28
- '6': 'already_exists',
29
- '7': 'permission_denied',
30
- '8': 'resource_exhausted',
31
- '9': 'failed_precondition',
32
- '10': 'aborted',
33
- '11': 'out_of_range',
34
- '12': 'unimplemented',
35
- '13': 'internal_error',
36
- '14': 'unavailable',
37
- '15': 'data_loss',
38
- '16': 'unauthenticated',
39
- } ;
40
-
41
- /**
42
- * Get a Sentry span status from an otel span.
43
- */
44
- function mapStatus(span) {
45
- const attributes = spanHasAttributes(span) ? span.attributes : {};
46
- const status = spanHasStatus(span) ? span.status : undefined;
47
-
48
- const httpCode = attributes[SemanticAttributes.HTTP_STATUS_CODE];
49
- const grpcCode = attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE];
50
-
51
- const code = typeof httpCode === 'string' ? httpCode : typeof httpCode === 'number' ? httpCode.toString() : undefined;
52
- if (code) {
53
- const sentryStatus = canonicalCodesHTTPMap[code];
54
- if (sentryStatus) {
55
- return { code: SPAN_STATUS_ERROR, message: sentryStatus };
56
- }
57
- }
58
-
59
- if (typeof grpcCode === 'string') {
60
- const sentryStatus = canonicalCodesGrpcMap[grpcCode];
61
- if (sentryStatus) {
62
- return { code: SPAN_STATUS_ERROR, message: sentryStatus };
63
- }
64
- }
65
-
66
- const statusCode = status && status.code;
67
- if (statusCode === SpanStatusCode.OK || statusCode === SpanStatusCode.UNSET) {
68
- return { code: SPAN_STATUS_OK };
69
- }
70
-
71
- return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
72
- }
73
-
74
- export { mapStatus };
75
- //# sourceMappingURL=mapStatus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapStatus.js","sources":["../../../src/utils/mapStatus.ts"],"sourcesContent":["import { SpanStatusCode } from '@opentelemetry/api';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';\nimport type { SpanStatus } from '@sentry/types';\n\nimport type { AbstractSpan } from '../types';\nimport { spanHasAttributes, spanHasStatus } from './spanTypes';\n\n// canonicalCodesHTTPMap maps some HTTP codes to Sentry's span statuses. See possible mapping in https://develop.sentry.dev/sdk/event-payloads/span/\nconst canonicalCodesHTTPMap: Record<string, SpanStatus['message']> = {\n '400': 'failed_precondition',\n '401': 'unauthenticated',\n '403': 'permission_denied',\n '404': 'not_found',\n '409': 'aborted',\n '429': 'resource_exhausted',\n '499': 'cancelled',\n '500': 'internal_error',\n '501': 'unimplemented',\n '503': 'unavailable',\n '504': 'deadline_exceeded',\n} as const;\n\n// canonicalCodesGrpcMap maps some GRPC codes to Sentry's span statuses. See description in grpc documentation.\nconst canonicalCodesGrpcMap: Record<string, SpanStatus['message']> = {\n '1': 'cancelled',\n '2': 'unknown_error',\n '3': 'invalid_argument',\n '4': 'deadline_exceeded',\n '5': 'not_found',\n '6': 'already_exists',\n '7': 'permission_denied',\n '8': 'resource_exhausted',\n '9': 'failed_precondition',\n '10': 'aborted',\n '11': 'out_of_range',\n '12': 'unimplemented',\n '13': 'internal_error',\n '14': 'unavailable',\n '15': 'data_loss',\n '16': 'unauthenticated',\n} as const;\n\n/**\n * Get a Sentry span status from an otel span.\n */\nexport function mapStatus(span: AbstractSpan): SpanStatus {\n const attributes = spanHasAttributes(span) ? span.attributes : {};\n const status = spanHasStatus(span) ? span.status : undefined;\n\n const httpCode = attributes[SemanticAttributes.HTTP_STATUS_CODE];\n const grpcCode = attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE];\n\n const code = typeof httpCode === 'string' ? httpCode : typeof httpCode === 'number' ? httpCode.toString() : undefined;\n if (code) {\n const sentryStatus = canonicalCodesHTTPMap[code];\n if (sentryStatus) {\n return { code: SPAN_STATUS_ERROR, message: sentryStatus };\n }\n }\n\n if (typeof grpcCode === 'string') {\n const sentryStatus = canonicalCodesGrpcMap[grpcCode];\n if (sentryStatus) {\n return { code: SPAN_STATUS_ERROR, message: sentryStatus };\n }\n }\n\n const statusCode = status && status.code;\n if (statusCode === SpanStatusCode.OK || statusCode === SpanStatusCode.UNSET) {\n return { code: SPAN_STATUS_OK };\n }\n\n return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };\n}\n"],"names":[],"mappings":";;;;;AAQA;AACA,MAAM,qBAAqB,GAA0C;AACrE,EAAE,KAAK,EAAE,qBAAqB;AAC9B,EAAE,KAAK,EAAE,iBAAiB;AAC1B,EAAE,KAAK,EAAE,mBAAmB;AAC5B,EAAE,KAAK,EAAE,WAAW;AACpB,EAAE,KAAK,EAAE,SAAS;AAClB,EAAE,KAAK,EAAE,oBAAoB;AAC7B,EAAE,KAAK,EAAE,WAAW;AACpB,EAAE,KAAK,EAAE,gBAAgB;AACzB,EAAE,KAAK,EAAE,eAAe;AACxB,EAAE,KAAK,EAAE,aAAa;AACtB,EAAE,KAAK,EAAE,mBAAmB;AAC5B,CAAE,EAAA;AACF;AACA;AACA,MAAM,qBAAqB,GAA0C;AACrE,EAAE,GAAG,EAAE,WAAW;AAClB,EAAE,GAAG,EAAE,eAAe;AACtB,EAAE,GAAG,EAAE,kBAAkB;AACzB,EAAE,GAAG,EAAE,mBAAmB;AAC1B,EAAE,GAAG,EAAE,WAAW;AAClB,EAAE,GAAG,EAAE,gBAAgB;AACvB,EAAE,GAAG,EAAE,mBAAmB;AAC1B,EAAE,GAAG,EAAE,oBAAoB;AAC3B,EAAE,GAAG,EAAE,qBAAqB;AAC5B,EAAE,IAAI,EAAE,SAAS;AACjB,EAAE,IAAI,EAAE,cAAc;AACtB,EAAE,IAAI,EAAE,eAAe;AACvB,EAAE,IAAI,EAAE,gBAAgB;AACxB,EAAE,IAAI,EAAE,aAA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c,CAAC,KAAK,EAAE;AAC/E,IAAI,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAA;AACnC,GAAE;AACF;AACA,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAA,EAAiB,CAAA;AAC9D;;;;"}
@@ -1,154 +0,0 @@
1
- import { SpanKind } from '@opentelemetry/api';
2
- import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
3
- import { parseUrl, getSanitizedUrlString, stripUrlQueryAndFragment } from '@sentry/utils';
4
- import { getSpanKind } from './getSpanKind.js';
5
- import { spanHasAttributes, spanHasName } from './spanTypes.js';
6
-
7
- /**
8
- * Extract better op/description from an otel span.
9
- *
10
- * Based on https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7422ce2a06337f68a59b552b8c5a2ac125d6bae5/exporter/sentryexporter/sentry_exporter.go#L306
11
- */
12
- function parseSpanDescription(span) {
13
- const attributes = spanHasAttributes(span) ? span.attributes : {};
14
- const name = spanHasName(span) ? span.name : '<unknown>';
15
-
16
- // if http.method exists, this is an http request span
17
- const httpMethod = attributes[SemanticAttributes.HTTP_METHOD];
18
- if (httpMethod) {
19
- return descriptionForHttpMethod({ attributes, name, kind: getSpanKind(span) }, httpMethod);
20
- }
21
-
22
- // If db.type exists then this is a database call span.
23
- const dbSystem = attributes[SemanticAttributes.DB_SYSTEM];
24
- if (dbSystem) {
25
- return descriptionForDbSystem({ attributes, name });
26
- }
27
-
28
- // If rpc.service exists then this is a rpc call span.
29
- const rpcService = attributes[SemanticAttributes.RPC_SERVICE];
30
- if (rpcService) {
31
- return {
32
- op: 'rpc',
33
- description: name,
34
- source: 'route',
35
- };
36
- }
37
-
38
- // If messaging.system exists then this is a messaging system span.
39
- const messagingSystem = attributes[SemanticAttributes.MESSAGING_SYSTEM];
40
- if (messagingSystem) {
41
- return {
42
- op: 'message',
43
- description: name,
44
- source: 'route',
45
- };
46
- }
47
-
48
- // If faas.trigger exists then this is a function as a service span.
49
- const faasTrigger = attributes[SemanticAttributes.FAAS_TRIGGER];
50
- if (faasTrigger) {
51
- return { op: faasTrigger.toString(), description: name, source: 'route' };
52
- }
53
-
54
- return { op: undefined, description: name, source: 'custom' };
55
- }
56
-
57
- function descriptionForDbSystem({ attributes, name }) {
58
- // Use DB statement (Ex "SELECT * FROM table") if possible as description.
59
- const statement = attributes[SemanticAttributes.DB_STATEMENT];
60
-
61
- const description = statement ? statement.toString() : name;
62
-
63
- return { op: 'db', description, source: 'task' };
64
- }
65
-
66
- /** Only exported for tests. */
67
- function descriptionForHttpMethod(
68
- { name, kind, attributes },
69
- httpMethod,
70
- ) {
71
- const opParts = ['http'];
72
-
73
- switch (kind) {
74
- case SpanKind.CLIENT:
75
- opParts.push('client');
76
- break;
77
- case SpanKind.SERVER:
78
- opParts.push('server');
79
- break;
80
- }
81
-
82
- const { urlPath, url, query, fragment, hasRoute } = getSanitizedUrl(attributes, kind);
83
-
84
- if (!urlPath) {
85
- return { op: opParts.join('.'), description: name, source: 'custom' };
86
- }
87
-
88
- // Ex. description="GET /api/users".
89
- const description = `${httpMethod} ${urlPath}`;
90
-
91
- // If `httpPath` is a root path, then we can categorize the transaction source as route.
92
- const source = hasRoute || urlPath === '/' ? 'route' : 'url';
93
-
94
- const data = {};
95
-
96
- if (url) {
97
- data.url = url;
98
- }
99
- if (query) {
100
- data['http.query'] = query;
101
- }
102
- if (fragment) {
103
- data['http.fragment'] = fragment;
104
- }
105
-
106
- return {
107
- op: opParts.join('.'),
108
- description,
109
- source,
110
- data,
111
- };
112
- }
113
-
114
- /** Exported for tests only */
115
- function getSanitizedUrl(
116
- attributes,
117
- kind,
118
- )
119
-
120
- {
121
- // This is the relative path of the URL, e.g. /sub
122
- const httpTarget = attributes[SemanticAttributes.HTTP_TARGET];
123
- // This is the full URL, including host & query params etc., e.g. https://example.com/sub?foo=bar
124
- const httpUrl = attributes[SemanticAttributes.HTTP_URL];
125
- // This is the normalized route name - may not always be available!
126
- const httpRoute = attributes[SemanticAttributes.HTTP_ROUTE];
127
-
128
- const parsedUrl = typeof httpUrl === 'string' ? parseUrl(httpUrl) : undefined;
129
- const url = parsedUrl ? getSanitizedUrlString(parsedUrl) : undefined;
130
- const query = parsedUrl && parsedUrl.search ? parsedUrl.search : undefined;
131
- const fragment = parsedUrl && parsedUrl.hash ? parsedUrl.hash : undefined;
132
-
133
- if (typeof httpRoute === 'string') {
134
- return { urlPath: httpRoute, url, query, fragment, hasRoute: true };
135
- }
136
-
137
- if (kind === SpanKind.SERVER && typeof httpTarget === 'string') {
138
- return { urlPath: stripUrlQueryAndFragment(httpTarget), url, query, fragment, hasRoute: false };
139
- }
140
-
141
- if (parsedUrl) {
142
- return { urlPath: url, url, query, fragment, hasRoute: false };
143
- }
144
-
145
- // fall back to target even for client spans, if no URL is present
146
- if (typeof httpTarget === 'string') {
147
- return { urlPath: stripUrlQueryAndFragment(httpTarget), url, query, fragment, hasRoute: false };
148
- }
149
-
150
- return { urlPath: undefined, url, query, fragment, hasRoute: false };
151
- }
152
-
153
- export { descriptionForHttpMethod, getSanitizedUrl, parseSpanDescription };
154
- //# sourceMappingURL=parseSpanDescription.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseSpanDescription.js","sources":["../../../src/utils/parseSpanDescription.ts"],"sourcesContent":["import type { AttributeValue, Attributes } from '@opentelemetry/api';\nimport { SpanKind } from '@opentelemetry/api';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type { TransactionSource } from '@sentry/types';\nimport { getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from '@sentry/utils';\n\nimport type { AbstractSpan } from '../types';\nimport { getSpanKind } from './getSpanKind';\nimport { spanHasAttributes, spanHasName } from './spanTypes';\n\ninterface SpanDescription {\n op: string | undefined;\n description: string;\n source: TransactionSource;\n data?: Record<string, string>;\n}\n\n/**\n * Extract better op/description from an otel span.\n *\n * Based on https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7422ce2a06337f68a59b552b8c5a2ac125d6bae5/exporter/sentryexporter/sentry_exporter.go#L306\n */\nexport function parseSpanDescription(span: AbstractSpan): SpanDescription {\n const attributes = spanHasAttributes(span) ? span.attributes : {};\n const name = spanHasName(span) ? span.name : '<unknown>';\n\n // if http.method exists, this is an http request span\n const httpMethod = attributes[SemanticAttributes.HTTP_METHOD];\n if (httpMethod) {\n return descriptionForHttpMethod({ attributes, name, kind: getSpanKind(span) }, httpMethod);\n }\n\n // If db.type exists then this is a database call span.\n const dbSystem = attributes[SemanticAttributes.DB_SYSTEM];\n if (dbSystem) {\n return descriptionForDbSystem({ attributes, name });\n }\n\n // If rpc.service exists then this is a rpc call span.\n const rpcService = attributes[SemanticAttributes.RPC_SERVICE];\n if (rpcService) {\n return {\n op: 'rpc',\n description: name,\n source: 'route',\n };\n }\n\n // If messaging.system exists then this is a messaging system span.\n const messagingSystem = attributes[SemanticAttributes.MESSAGING_SYSTEM];\n if (messagingSystem) {\n return {\n op: 'message',\n description: name,\n source: 'route',\n };\n }\n\n // If faas.trigger exists then this is a function as a service span.\n const faasTrigger = attributes[SemanticAttributes.FAAS_TRIGGER];\n if (faasTrigger) {\n return { op: faasTrigger.toString(), description: name, source: 'route' };\n }\n\n return { op: undefined, description: name, source: 'custom' };\n}\n\nfunction descriptionForDbSystem({ attributes, name }: { attributes: Attributes; name: string }): SpanDescription {\n // Use DB statement (Ex \"SELECT * FROM table\") if possible as description.\n const statement = attributes[SemanticAttributes.DB_STATEMENT];\n\n const description = statement ? statement.toString() : name;\n\n return { op: 'db', description, source: 'task' };\n}\n\n/** Only exported for tests. */\nexport function descriptionForHttpMethod(\n { name, kind, attributes }: { name: string; attributes: Attributes; kind: SpanKind },\n httpMethod: AttributeValue,\n): SpanDescription {\n const opParts = ['http'];\n\n switch (kind) {\n case SpanKind.CLIENT:\n opParts.push('client');\n break;\n case SpanKind.SERVER:\n opParts.push('server');\n break;\n }\n\n const { urlPath, url, query, fragment, hasRoute } = getSanitizedUrl(attributes, kind);\n\n if (!urlPath) {\n return { op: opParts.join('.'), description: name, source: 'custom' };\n }\n\n // Ex. description=\"GET /api/users\".\n const description = `${httpMethod} ${urlPath}`;\n\n // If `httpPath` is a root path, then we can categorize the transaction source as route.\n const source: TransactionSource = hasRoute || urlPath === '/' ? 'route' : 'url';\n\n const data: Record<string, string> = {};\n\n if (url) {\n data.url = url;\n }\n if (query) {\n data['http.query'] = query;\n }\n if (fragment) {\n data['http.fragment'] = fragment;\n }\n\n return {\n op: opParts.join('.'),\n description,\n source,\n data,\n };\n}\n\n/** Exported for tests only */\nexport function getSanitizedUrl(\n attributes: Attributes,\n kind: SpanKind,\n): {\n url: string | undefined;\n urlPath: string | undefined;\n query: string | undefined;\n fragment: string | undefined;\n hasRoute: boolean;\n} {\n // This is the relative path of the URL, e.g. /sub\n const httpTarget = attributes[SemanticAttributes.HTTP_TARGET];\n // This is the full URL, including host & query params etc., e.g. https://example.com/sub?foo=bar\n const httpUrl = attributes[SemanticAttributes.HTTP_URL];\n // This is the normalized route name - may not always be available!\n const httpRoute = attributes[SemanticAttributes.HTTP_ROUTE];\n\n const parsedUrl = typeof httpUrl === 'string' ? parseUrl(httpUrl) : undefined;\n const url = parsedUrl ? getSanitizedUrlString(parsedUrl) : undefined;\n const query = parsedUrl && parsedUrl.search ? parsedUrl.search : undefined;\n const fragment = parsedUrl && parsedUrl.hash ? parsedUrl.hash : undefined;\n\n if (typeof httpRoute === 'string') {\n return { urlPath: httpRoute, url, query, fragment, hasRoute: true };\n }\n\n if (kind === SpanKind.SERVER && typeof httpTarget === 'string') {\n return { urlPath: stripUrlQueryAndFragment(httpTarget), url, query, fragment, hasRoute: false };\n }\n\n if (parsedUrl) {\n return { urlPath: url, url, query, fragment, hasRoute: false };\n }\n\n // fall back to target even for client spans, if no URL is present\n if (typeof httpTarget === 'string') {\n return { urlPath: stripUrlQueryAndFragment(httpTarget), url, query, fragment, hasRoute: false };\n }\n\n return { urlPath: undefined, url, query, fragment, hasRoute: false };\n}\n"],"names":[],"mappings":";;;;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= new Set();
2
-
3
- /** Get all the OpenTelemetry elements that have been set up. */
4
- function openTelemetrySetupCheck() {
5
- return Array.from(setupElements);
6
- }
7
-
8
- /** Mark an OpenTelemetry element as setup. */
9
- function setIsSetup(element) {
10
- setupElements.add(element);
11
- }
12
-
13
- export { openTelemetrySetupCheck, setIsSetup };
14
- //# sourceMappingURL=setupCheck.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupCheck.js","sources":["../../../src/utils/setupCheck.ts"],"sourcesContent":["type OpenTelemetryElement = 'SentrySpanProcessor' | 'SentryContextManager' | 'SentryPropagator' | 'SentrySampler';\n\nconst setupElements = new Set<OpenTelemetryElement>();\n\n/** Get all the OpenTelemetry elements that have been set up. */\nexport function openTelemetrySetupCheck(): OpenTelemetryElement[] {\n return Array.from(setupElements);\n}\n\n/** Mark an OpenTelemetry element as setup. */\nexport function setIsSetup(element: OpenTelemetryElement): void {\n setupElements.add(element);\n}\n\n/** Only exported for tests. */\nexport function clearOpenTelemetrySetupCheck(): void {\n setupElements.clear();\n}\n"],"names":[],"mappings":"AAEA,MAAM,aAAc,GAAE,IAAI,GAAG,EAAwB,CAAA;AACrD;AACA;AACO,SAAS,uBAAuB,GAA2B;AAClE,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,UAAU,CAAC,OAAO,EAA8B;AAChE,EAAE,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AAC5B;;;;"}
@@ -1,63 +0,0 @@
1
- // We store the parent span, scopes & metadata in separate weakmaps, so we can access them for a given span
2
- // This way we can enhance the data that an OTEL Span natively gives us
3
- // and since we are using weakmaps, we do not need to clean up after ourselves
4
- const SpanScopes = new WeakMap
5
-
6
- ();
7
- const SpanHub = new WeakMap();
8
- const SpanParent = new WeakMap();
9
- const SpanMetadata = new WeakMap();
10
-
11
- /** Set the Sentry hub on an OTEL span. */
12
- function setSpanHub(span, hub) {
13
- SpanHub.set(span, hub);
14
- }
15
-
16
- /** Get the Sentry hub of an OTEL span. */
17
- function getSpanHub(span) {
18
- return SpanHub.get(span);
19
- }
20
-
21
- /** Set the parent OTEL span on an OTEL span. */
22
- function setSpanParent(span, parentSpan) {
23
- SpanParent.set(span, parentSpan);
24
- }
25
-
26
- /** Get the parent OTEL span of an OTEL span. */
27
- function getSpanParent(span) {
28
- return SpanParent.get(span);
29
- }
30
-
31
- /** Set metadata for an OTEL span. */
32
- function setSpanMetadata(span, metadata) {
33
- SpanMetadata.set(span, metadata);
34
- }
35
-
36
- /** Get metadata for an OTEL span. */
37
- function getSpanMetadata(span) {
38
- return SpanMetadata.get(span);
39
- }
40
-
41
- /**
42
- * Set the Sentry scope to be used for finishing a given OTEL span.
43
- * This is different from `setCapturedScopesOnSpan`, as that works on _sentry_ spans,
44
- * while here we are basically "caching" this on the otel spans.
45
- */
46
- function setSpanScopes(
47
- span,
48
- scopes
49
-
50
- ,
51
- ) {
52
- SpanScopes.set(span, scopes);
53
- }
54
-
55
- /** Get the Sentry scopes to use for finishing an OTEL span. */
56
- function getSpanScopes(span)
57
-
58
- {
59
- return SpanScopes.get(span);
60
- }
61
-
62
- export { getSpanHub, getSpanMetadata, getSpanParent, getSpanScopes, setSpanHub, setSpanMetadata, setSpanParent, setSpanScopes };
63
- //# sourceMappingURL=spanData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spanData.js","sources":["../../../src/utils/spanData.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Hub, Scope, TransactionMetadata } from '@sentry/types';\n\nimport type { AbstractSpan } from '../types';\n\n// We store the parent span, scopes & metadata in separate weakmaps, so we can access them for a given span\n// This way we can enhance the data that an OTEL Span natively gives us\n// and since we are using weakmaps, we do not need to clean up after ourselves\nconst SpanScopes = new WeakMap<\n AbstractSpan,\n {\n scope: Scope;\n isolationScope: Scope;\n }\n>();\nconst SpanHub = new WeakMap<AbstractSpan, Hub>();\nconst SpanParent = new WeakMap<AbstractSpan, Span>();\nconst SpanMetadata = new WeakMap<AbstractSpan, Partial<TransactionMetadata>>();\n\n/** Set the Sentry hub on an OTEL span. */\nexport function setSpanHub(span: AbstractSpan, hub: Hub): void {\n SpanHub.set(span, hub);\n}\n\n/** Get the Sentry hub of an OTEL span. */\nexport function getSpanHub(span: AbstractSpan): Hub | undefined {\n return SpanHub.get(span);\n}\n\n/** Set the parent OTEL span on an OTEL span. */\nexport function setSpanParent(span: AbstractSpan, parentSpan: Span): void {\n SpanParent.set(span, parentSpan);\n}\n\n/** Get the parent OTEL span of an OTEL span. */\nexport function getSpanParent(span: AbstractSpan): Span | undefined {\n return SpanParent.get(span);\n}\n\n/** Set metadata for an OTEL span. */\nexport function setSpanMetadata(span: AbstractSpan, metadata: Partial<TransactionMetadata>): void {\n SpanMetadata.set(span, metadata);\n}\n\n/** Get metadata for an OTEL span. */\nexport function getSpanMetadata(span: AbstractSpan): Partial<TransactionMetadata> | undefined {\n return SpanMetadata.get(span);\n}\n\n/**\n * Set the Sentry scope to be used for finishing a given OTEL span.\n * This is different from `setCapturedScopesOnSpan`, as that works on _sentry_ spans,\n * while here we are basically \"caching\" this on the otel spans.\n */\nexport function setSpanScopes(\n span: AbstractSpan,\n scopes: {\n scope: Scope;\n isolationScope: Scope;\n },\n): void {\n SpanScopes.set(span, scopes);\n}\n\n/** Get the Sentry scopes to use for finishing an OTEL span. */\nexport function getSpanScopes(span: AbstractSpan):\n | {\n scope: Scope;\n isolationScope: Scope;\n }\n | undefined {\n return SpanScopes.get(span);\n}\n"],"names":[],"mappings":"AAKA;AACA;AACA;AACA,MAAM,UAAA,GAAa,IAAI,OAAO;;AAM9B,EAAG,CAAA;AACH,MAAM,OAAQ,GAAE,IAAI,OAAO,EAAqB,CAAA;AAChD,MAAM,UAAW,GAAE,IAAI,OAAO,EAAsB,CAAA;AACpD,MAAM,YAAa,GAAE,IAAI,OAAO,EAA8C,CAAA;AAC9E;AACA;AACO,SAAS,UAAU,CAAC,IAAI,EAAgB,GAAG,EAAa;AAC/D,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AACxB,CAAA;AACA;AACA;AACO,SAAS,UAAU,CAAC,IAAI,EAAiC;AAChE,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI,EAAgB,UAAU,EAAc;AAC1E,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI,EAAkC;AACpE,EAAE,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAAgB,QAAQ,EAAsC;AAClG,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAA0D;AAC9F,EAAE,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,IAAI;AACN,EAAE,MAAM;;AAGN;AACF,EAAQ;AACR,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC9B,CAAA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI;;AAKhC,CAAY;AACd,EAAE,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC7B;;;;"}
@@ -1,70 +0,0 @@
1
- /**
2
- * Check if a given span has attributes.
3
- * This is necessary because the base `Span` type does not have attributes,
4
- * so in places where we are passed a generic span, we need to check if we want to access them.
5
- */
6
- function spanHasAttributes(
7
- span,
8
- ) {
9
- const castSpan = span ;
10
- return !!castSpan.attributes && typeof castSpan.attributes === 'object';
11
- }
12
-
13
- /**
14
- * Check if a given span has a kind.
15
- * This is necessary because the base `Span` type does not have a kind,
16
- * so in places where we are passed a generic span, we need to check if we want to access it.
17
- */
18
- function spanHasKind(span) {
19
- const castSpan = span ;
20
- return !!castSpan.kind;
21
- }
22
-
23
- /**
24
- * Check if a given span has a status.
25
- * This is necessary because the base `Span` type does not have a status,
26
- * so in places where we are passed a generic span, we need to check if we want to access it.
27
- */
28
- function spanHasStatus(
29
- span,
30
- ) {
31
- const castSpan = span ;
32
- return !!castSpan.status;
33
- }
34
-
35
- /**
36
- * Check if a given span has a name.
37
- * This is necessary because the base `Span` type does not have a name,
38
- * so in places where we are passed a generic span, we need to check if we want to access it.
39
- */
40
- function spanHasName(span) {
41
- const castSpan = span ;
42
- return !!castSpan.name;
43
- }
44
-
45
- /**
46
- * Check if a given span has a kind.
47
- * This is necessary because the base `Span` type does not have a kind,
48
- * so in places where we are passed a generic span, we need to check if we want to access it.
49
- */
50
- function spanHasParentId(
51
- span,
52
- ) {
53
- const castSpan = span ;
54
- return !!castSpan.parentSpanId;
55
- }
56
-
57
- /**
58
- * Check if a given span has events.
59
- * This is necessary because the base `Span` type does not have events,
60
- * so in places where we are passed a generic span, we need to check if we want to access it.
61
- */
62
- function spanHasEvents(
63
- span,
64
- ) {
65
- const castSpan = span ;
66
- return Array.isArray(castSpan.events);
67
- }
68
-
69
- export { spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus };
70
- //# sourceMappingURL=spanTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spanTypes.js","sources":["../../../src/utils/spanTypes.ts"],"sourcesContent":["import type { SpanKind, SpanStatus } from '@opentelemetry/api';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\n\nimport type { AbstractSpan } from '../types';\n\n/**\n * Check if a given span has attributes.\n * This is necessary because the base `Span` type does not have attributes,\n * so in places where we are passed a generic span, we need to check if we want to access them.\n */\nexport function spanHasAttributes<SpanType extends AbstractSpan>(\n span: SpanType,\n): span is SpanType & { attributes: ReadableSpan['attributes'] } {\n const castSpan = span as ReadableSpan;\n return !!castSpan.attributes && typeof castSpan.attributes === 'object';\n}\n\n/**\n * Check if a given span has a kind.\n * This is necessary because the base `Span` type does not have a kind,\n * so in places where we are passed a generic span, we need to check if we want to access it.\n */\nexport function spanHasKind<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & { kind: SpanKind } {\n const castSpan = span as ReadableSpan;\n return !!castSpan.kind;\n}\n\n/**\n * Check if a given span has a status.\n * This is necessary because the base `Span` type does not have a status,\n * so in places where we are passed a generic span, we need to check if we want to access it.\n */\nexport function spanHasStatus<SpanType extends AbstractSpan>(\n span: SpanType,\n): span is SpanType & { status: SpanStatus } {\n const castSpan = span as ReadableSpan;\n return !!castSpan.status;\n}\n\n/**\n * Check if a given span has a name.\n * This is necessary because the base `Span` type does not have a name,\n * so in places where we are passed a generic span, we need to check if we want to access it.\n */\nexport function spanHasName<SpanType extends AbstractSpan>(span: SpanType): span is SpanType & { name: string } {\n const castSpan = span as ReadableSpan;\n return !!castSpan.name;\n}\n\n/**\n * Check if a given span has a kind.\n * This is necessary because the base `Span` type does not have a kind,\n * so in places where we are passed a generic span, we need to check if we want to access it.\n */\nexport function spanHasParentId<SpanType extends AbstractSpan>(\n span: SpanType,\n): span is SpanType & { parentSpanId: string } {\n const castSpan = span as ReadableSpan;\n return !!castSpan.parentSpanId;\n}\n\n/**\n * Check if a given span has events.\n * This is necessary because the base `Span` type does not have events,\n * so in places where we are passed a generic span, we need to check if we want to access it.\n */\nexport function spanHasEvents<SpanType extends AbstractSpan>(\n span: SpanType,\n): span is SpanType & { events: TimedEvent[] } {\n const castSpan = span as ReadableSpan;\n return Array.isArray(castSpan.events);\n}\n"],"names":[],"mappings":"AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB;AACjC,EAAE,IAAI;AACN,EAAiE;AACjE,EAAE,MAAM,QAAS,GAAE,IAAK,EAAA;AACxB,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAA,IAAc,OAAO,QAAQ,CAAC,UAAW,KAAI,QAAQ,CAAA;AACzE,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAgC,IAAI,EAAmD;AAClH,EAAE,MAAM,QAAS,GAAE,IAAK,EAAA;AACxB,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAA;AACxB,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,IAAI;AACN,EAA6C;AAC7C,EAAE,MAAM,QAAS,GAAE,IAAK,EAAA;AACxB,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAA;AAC1B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAgC,IAAI,EAAiD;AAChH,EAAE,MAAM,QAAS,GAAE,IAAK,EAAA;AACxB,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAA;AACxB,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,IAAI;AACN,EAA+C;AAC/C,EAAE,MAAM,QAAS,GAAE,IAAK,EAAA;AACxB,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAA;AAChC,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,IAAI;AACN,EAA+C;AAC/C,EAAE,MAAM,QAAS,GAAE,IAAK,EAAA;AACxB,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACvC;;;;"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Add tracing extensions, ensuring a patched `startTransaction` to work with OTEL.
3
- */
4
- export declare function addTracingExtensions(): void;
5
- //# sourceMappingURL=hubextensions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hubextensions.d.ts","sourceRoot":"","sources":["../../../src/custom/hubextensions.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAY3C"}