@sentry/opentelemetry 7.74.2-alpha.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 (209) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +98 -0
  3. package/cjs/asyncContextStrategy.js +46 -0
  4. package/cjs/asyncContextStrategy.js.map +1 -0
  5. package/cjs/constants.js +18 -0
  6. package/cjs/constants.js.map +1 -0
  7. package/cjs/contextManager.js +59 -0
  8. package/cjs/contextManager.js.map +1 -0
  9. package/cjs/custom/client.js +81 -0
  10. package/cjs/custom/client.js.map +1 -0
  11. package/cjs/custom/hub.js +165 -0
  12. package/cjs/custom/hub.js.map +1 -0
  13. package/cjs/custom/hubextensions.js +34 -0
  14. package/cjs/custom/hubextensions.js.map +1 -0
  15. package/cjs/custom/scope.js +181 -0
  16. package/cjs/custom/scope.js.map +1 -0
  17. package/cjs/custom/transaction.js +52 -0
  18. package/cjs/custom/transaction.js.map +1 -0
  19. package/cjs/index.js +63 -0
  20. package/cjs/index.js.map +1 -0
  21. package/cjs/propagator.js +132 -0
  22. package/cjs/propagator.js.map +1 -0
  23. package/cjs/sampler.js +185 -0
  24. package/cjs/sampler.js.map +1 -0
  25. package/cjs/semanticAttributes.js +21 -0
  26. package/cjs/semanticAttributes.js.map +1 -0
  27. package/cjs/setupEventContextTrace.js +35 -0
  28. package/cjs/setupEventContextTrace.js.map +1 -0
  29. package/cjs/spanExporter.js +302 -0
  30. package/cjs/spanExporter.js.map +1 -0
  31. package/cjs/spanProcessor.js +88 -0
  32. package/cjs/spanProcessor.js.map +1 -0
  33. package/cjs/trace.js +107 -0
  34. package/cjs/trace.js.map +1 -0
  35. package/cjs/utils/addOriginToSpan.js +11 -0
  36. package/cjs/utils/addOriginToSpan.js.map +1 -0
  37. package/cjs/utils/captureExceptionForTimedEvent.js +58 -0
  38. package/cjs/utils/captureExceptionForTimedEvent.js.map +1 -0
  39. package/cjs/utils/contextData.js +41 -0
  40. package/cjs/utils/contextData.js.map +1 -0
  41. package/cjs/utils/convertOtelTimeToSeconds.js +9 -0
  42. package/cjs/utils/convertOtelTimeToSeconds.js.map +1 -0
  43. package/cjs/utils/getActiveSpan.js +29 -0
  44. package/cjs/utils/getActiveSpan.js.map +1 -0
  45. package/cjs/utils/getRequestSpanData.js +48 -0
  46. package/cjs/utils/getRequestSpanData.js.map +1 -0
  47. package/cjs/utils/getSpanKind.js +21 -0
  48. package/cjs/utils/getSpanKind.js.map +1 -0
  49. package/cjs/utils/groupSpansWithParents.js +74 -0
  50. package/cjs/utils/groupSpansWithParents.js.map +1 -0
  51. package/cjs/utils/isSentryRequest.js +29 -0
  52. package/cjs/utils/isSentryRequest.js.map +1 -0
  53. package/cjs/utils/mapStatus.js +76 -0
  54. package/cjs/utils/mapStatus.js.map +1 -0
  55. package/cjs/utils/parseSpanDescription.js +158 -0
  56. package/cjs/utils/parseSpanDescription.js.map +1 -0
  57. package/cjs/utils/spanData.js +59 -0
  58. package/cjs/utils/spanData.js.map +1 -0
  59. package/cjs/utils/spanTypes.js +77 -0
  60. package/cjs/utils/spanTypes.js.map +1 -0
  61. package/esm/asyncContextStrategy.js +41 -0
  62. package/esm/asyncContextStrategy.js.map +1 -0
  63. package/esm/constants.js +13 -0
  64. package/esm/constants.js.map +1 -0
  65. package/esm/contextManager.js +57 -0
  66. package/esm/contextManager.js.map +1 -0
  67. package/esm/custom/client.js +76 -0
  68. package/esm/custom/client.js.map +1 -0
  69. package/esm/custom/hub.js +159 -0
  70. package/esm/custom/hub.js.map +1 -0
  71. package/esm/custom/hubextensions.js +32 -0
  72. package/esm/custom/hubextensions.js.map +1 -0
  73. package/esm/custom/scope.js +179 -0
  74. package/esm/custom/scope.js.map +1 -0
  75. package/esm/custom/transaction.js +49 -0
  76. package/esm/custom/transaction.js.map +1 -0
  77. package/esm/index.js +32 -0
  78. package/esm/index.js.map +1 -0
  79. package/esm/propagator.js +127 -0
  80. package/esm/propagator.js.map +1 -0
  81. package/esm/sampler.js +183 -0
  82. package/esm/sampler.js.map +1 -0
  83. package/esm/semanticAttributes.js +19 -0
  84. package/esm/semanticAttributes.js.map +1 -0
  85. package/esm/setupEventContextTrace.js +33 -0
  86. package/esm/setupEventContextTrace.js.map +1 -0
  87. package/esm/spanExporter.js +300 -0
  88. package/esm/spanExporter.js.map +1 -0
  89. package/esm/spanProcessor.js +86 -0
  90. package/esm/spanProcessor.js.map +1 -0
  91. package/esm/trace.js +104 -0
  92. package/esm/trace.js.map +1 -0
  93. package/esm/utils/addOriginToSpan.js +9 -0
  94. package/esm/utils/addOriginToSpan.js.map +1 -0
  95. package/esm/utils/captureExceptionForTimedEvent.js +56 -0
  96. package/esm/utils/captureExceptionForTimedEvent.js.map +1 -0
  97. package/esm/utils/contextData.js +36 -0
  98. package/esm/utils/contextData.js.map +1 -0
  99. package/esm/utils/convertOtelTimeToSeconds.js +7 -0
  100. package/esm/utils/convertOtelTimeToSeconds.js.map +1 -0
  101. package/esm/utils/getActiveSpan.js +26 -0
  102. package/esm/utils/getActiveSpan.js.map +1 -0
  103. package/esm/utils/getRequestSpanData.js +46 -0
  104. package/esm/utils/getRequestSpanData.js.map +1 -0
  105. package/esm/utils/getSpanKind.js +19 -0
  106. package/esm/utils/getSpanKind.js.map +1 -0
  107. package/esm/utils/groupSpansWithParents.js +72 -0
  108. package/esm/utils/groupSpansWithParents.js.map +1 -0
  109. package/esm/utils/isSentryRequest.js +27 -0
  110. package/esm/utils/isSentryRequest.js.map +1 -0
  111. package/esm/utils/mapStatus.js +74 -0
  112. package/esm/utils/mapStatus.js.map +1 -0
  113. package/esm/utils/parseSpanDescription.js +154 -0
  114. package/esm/utils/parseSpanDescription.js.map +1 -0
  115. package/esm/utils/spanData.js +50 -0
  116. package/esm/utils/spanData.js.map +1 -0
  117. package/esm/utils/spanTypes.js +70 -0
  118. package/esm/utils/spanTypes.js.map +1 -0
  119. package/package.json +45 -0
  120. package/types/asyncContextStrategy.d.ts +6 -0
  121. package/types/asyncContextStrategy.d.ts.map +1 -0
  122. package/types/constants.d.ts +7 -0
  123. package/types/constants.d.ts.map +1 -0
  124. package/types/contextManager.d.ts +11 -0
  125. package/types/contextManager.d.ts.map +1 -0
  126. package/types/custom/client.d.ts +12 -0
  127. package/types/custom/client.d.ts.map +1 -0
  128. package/types/custom/hub.d.ts +40 -0
  129. package/types/custom/hub.d.ts.map +1 -0
  130. package/types/custom/hubextensions.d.ts +5 -0
  131. package/types/custom/hubextensions.d.ts.map +1 -0
  132. package/types/custom/scope.d.ts +34 -0
  133. package/types/custom/scope.d.ts.map +1 -0
  134. package/types/custom/transaction.d.ts +17 -0
  135. package/types/custom/transaction.d.ts.map +1 -0
  136. package/types/index.d.ts +31 -0
  137. package/types/index.d.ts.map +1 -0
  138. package/types/propagator.d.ts +20 -0
  139. package/types/propagator.d.ts.map +1 -0
  140. package/types/sampler.d.ts +15 -0
  141. package/types/sampler.d.ts.map +1 -0
  142. package/types/semanticAttributes.d.ts +17 -0
  143. package/types/semanticAttributes.d.ts.map +1 -0
  144. package/types/setupEventContextTrace.d.ts +4 -0
  145. package/types/setupEventContextTrace.d.ts.map +1 -0
  146. package/types/spanExporter.d.ts +17 -0
  147. package/types/spanExporter.d.ts.map +1 -0
  148. package/types/spanProcessor.d.ts +22 -0
  149. package/types/spanProcessor.d.ts.map +1 -0
  150. package/types/trace.d.ts +28 -0
  151. package/types/trace.d.ts.map +1 -0
  152. package/types/types.d.ts +26 -0
  153. package/types/types.d.ts.map +1 -0
  154. package/types/utils/addOriginToSpan.d.ts +5 -0
  155. package/types/utils/addOriginToSpan.d.ts.map +1 -0
  156. package/types/utils/captureExceptionForTimedEvent.d.ts +8 -0
  157. package/types/utils/captureExceptionForTimedEvent.d.ts.map +1 -0
  158. package/types/utils/contextData.d.ts +23 -0
  159. package/types/utils/contextData.d.ts.map +1 -0
  160. package/types/utils/convertOtelTimeToSeconds.d.ts +3 -0
  161. package/types/utils/convertOtelTimeToSeconds.d.ts.map +1 -0
  162. package/types/utils/getActiveSpan.d.ts +11 -0
  163. package/types/utils/getActiveSpan.d.ts.map +1 -0
  164. package/types/utils/getRequestSpanData.d.ts +8 -0
  165. package/types/utils/getRequestSpanData.d.ts.map +1 -0
  166. package/types/utils/getSpanKind.d.ts +10 -0
  167. package/types/utils/getSpanKind.d.ts.map +1 -0
  168. package/types/utils/groupSpansWithParents.d.ts +13 -0
  169. package/types/utils/groupSpansWithParents.d.ts.map +1 -0
  170. package/types/utils/isSentryRequest.d.ts +8 -0
  171. package/types/utils/isSentryRequest.d.ts.map +1 -0
  172. package/types/utils/mapStatus.d.ts +7 -0
  173. package/types/utils/mapStatus.d.ts.map +1 -0
  174. package/types/utils/parseSpanDescription.d.ts +32 -0
  175. package/types/utils/parseSpanDescription.d.ts.map +1 -0
  176. package/types/utils/spanData.d.ts +20 -0
  177. package/types/utils/spanData.d.ts.map +1 -0
  178. package/types/utils/spanTypes.d.ts +52 -0
  179. package/types/utils/spanTypes.d.ts.map +1 -0
  180. package/types-ts3.8/asyncContextStrategy.d.ts +6 -0
  181. package/types-ts3.8/constants.d.ts +7 -0
  182. package/types-ts3.8/contextManager.d.ts +11 -0
  183. package/types-ts3.8/custom/client.d.ts +12 -0
  184. package/types-ts3.8/custom/hub.d.ts +40 -0
  185. package/types-ts3.8/custom/hubextensions.d.ts +5 -0
  186. package/types-ts3.8/custom/scope.d.ts +34 -0
  187. package/types-ts3.8/custom/transaction.d.ts +17 -0
  188. package/types-ts3.8/index.d.ts +31 -0
  189. package/types-ts3.8/propagator.d.ts +20 -0
  190. package/types-ts3.8/sampler.d.ts +15 -0
  191. package/types-ts3.8/semanticAttributes.d.ts +17 -0
  192. package/types-ts3.8/setupEventContextTrace.d.ts +4 -0
  193. package/types-ts3.8/spanExporter.d.ts +17 -0
  194. package/types-ts3.8/spanProcessor.d.ts +22 -0
  195. package/types-ts3.8/trace.d.ts +28 -0
  196. package/types-ts3.8/types.d.ts +26 -0
  197. package/types-ts3.8/utils/addOriginToSpan.d.ts +5 -0
  198. package/types-ts3.8/utils/captureExceptionForTimedEvent.d.ts +8 -0
  199. package/types-ts3.8/utils/contextData.d.ts +23 -0
  200. package/types-ts3.8/utils/convertOtelTimeToSeconds.d.ts +6 -0
  201. package/types-ts3.8/utils/getActiveSpan.d.ts +11 -0
  202. package/types-ts3.8/utils/getRequestSpanData.d.ts +8 -0
  203. package/types-ts3.8/utils/getSpanKind.d.ts +10 -0
  204. package/types-ts3.8/utils/groupSpansWithParents.d.ts +13 -0
  205. package/types-ts3.8/utils/isSentryRequest.d.ts +8 -0
  206. package/types-ts3.8/utils/mapStatus.d.ts +7 -0
  207. package/types-ts3.8/utils/parseSpanDescription.d.ts +32 -0
  208. package/types-ts3.8/utils/spanData.d.ts +20 -0
  209. package/types-ts3.8/utils/spanTypes.d.ts +52 -0
@@ -0,0 +1,70 @@
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
@@ -0,0 +1 @@
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;AACA,SAAA,iBAAA;AACA,EAAA,IAAA;AACA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,EAAA;AACA,EAAA,OAAA,CAAA,CAAA,QAAA,CAAA,UAAA,IAAA,OAAA,QAAA,CAAA,UAAA,KAAA,QAAA,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,WAAA,CAAA,IAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,EAAA;AACA,EAAA,OAAA,CAAA,CAAA,QAAA,CAAA,IAAA,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,aAAA;AACA,EAAA,IAAA;AACA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,EAAA;AACA,EAAA,OAAA,CAAA,CAAA,QAAA,CAAA,MAAA,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,WAAA,CAAA,IAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,EAAA;AACA,EAAA,OAAA,CAAA,CAAA,QAAA,CAAA,IAAA,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,eAAA;AACA,EAAA,IAAA;AACA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,EAAA;AACA,EAAA,OAAA,CAAA,CAAA,QAAA,CAAA,YAAA,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,aAAA;AACA,EAAA,IAAA;AACA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,EAAA;AACA,EAAA,OAAA,KAAA,CAAA,OAAA,CAAA,QAAA,CAAA,MAAA,CAAA,CAAA;AACA;;;;"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@sentry/opentelemetry",
3
+ "version": "7.74.2-alpha.0",
4
+ "description": "Official Sentry utilities for OpenTelemetry",
5
+ "repository": "git://github.com/getsentry/sentry-javascript.git",
6
+ "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/opentelemetry",
7
+ "author": "Sentry",
8
+ "license": "MIT",
9
+ "engines": {
10
+ "node": ">=14"
11
+ },
12
+ "main": "cjs/index.js",
13
+ "module": "esm/index.js",
14
+ "types": "types/index.d.ts",
15
+ "typesVersions": {
16
+ "<4.9": {
17
+ "types/index.d.ts": [
18
+ "types-ts3.8/index.d.ts"
19
+ ]
20
+ }
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "dependencies": {
26
+ "@sentry/core": "7.74.2-alpha.0",
27
+ "@sentry/types": "7.74.2-alpha.0",
28
+ "@sentry/utils": "7.74.2-alpha.0"
29
+ },
30
+ "peerDependencies": {
31
+ "@opentelemetry/api": "^1.0.0",
32
+ "@opentelemetry/core": "^1.0.0",
33
+ "@opentelemetry/sdk-trace-base": "^1.0.0",
34
+ "@opentelemetry/semantic-conventions": "^1.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "@opentelemetry/api": "^1.6.0",
38
+ "@opentelemetry/context-async-hooks": "^1.17.1",
39
+ "@opentelemetry/core": "^1.17.1",
40
+ "@opentelemetry/sdk-trace-base": "^1.17.1",
41
+ "@opentelemetry/sdk-trace-node": "^1.17.1",
42
+ "@opentelemetry/semantic-conventions": "^1.17.1"
43
+ },
44
+ "sideEffects": false
45
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Sets the async context strategy to use follow the OTEL context under the hood.
3
+ * We handle forking a hub inside of our custom OTEL Context Manager (./otelContextManager.ts)
4
+ */
5
+ export declare function setOpenTelemetryContextAsyncContextStrategy(): void;
6
+ //# sourceMappingURL=asyncContextStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncContextStrategy.d.ts","sourceRoot":"","sources":["../../src/asyncContextStrategy.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,2CAA2C,IAAI,IAAI,CA4BlE"}
@@ -0,0 +1,7 @@
1
+ export declare const SENTRY_TRACE_HEADER = "sentry-trace";
2
+ export declare const SENTRY_BAGGAGE_HEADER = "baggage";
3
+ /** Context Key to hold a PropagationContext. */
4
+ export declare const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY: symbol;
5
+ /** Context Key to hold a Hub. */
6
+ export declare const SENTRY_HUB_CONTEXT_KEY: symbol;
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,gDAAgD;AAChD,eAAO,MAAM,sCAAsC,QAA6D,CAAC;AAEjH,iCAAiC;AACjC,eAAO,MAAM,sBAAsB,QAAiC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ContextManager } from '@opentelemetry/api';
2
+ /**
3
+ * Wrap an OpenTelemetry ContextManager in a way that ensures the context is kept in sync with the Sentry Hub.
4
+ *
5
+ * Usage:
6
+ * import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
7
+ * const SentryContextManager = wrapContextManagerClass(AsyncLocalStorageContextManager);
8
+ * const contextManager = new SentryContextManager();
9
+ */
10
+ export declare function wrapContextManagerClass<ContextManagerInstance extends ContextManager>(ContextManagerClass: new (...args: any[]) => ContextManagerInstance): typeof ContextManagerClass;
11
+ //# sourceMappingURL=contextManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextManager.d.ts","sourceRoot":"","sources":["../../src/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAgBlE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,sBAAsB,SAAS,cAAc,EACnF,mBAAmB,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,sBAAsB,GAClE,OAAO,mBAAmB,CA6B5B"}
@@ -0,0 +1,12 @@
1
+ import type { BaseClient } from '@sentry/core';
2
+ import type { Client } from '@sentry/types';
3
+ import type { OpenTelemetryClient as OpenTelemetryClientInterface } from '../types';
4
+ /**
5
+ * Wrap an Client with things we need for OpenTelemetry support.
6
+ *
7
+ * Usage:
8
+ * const OpenTelemetryClient = getWrappedClientClass(NodeClient);
9
+ * const client = new OpenTelemetryClient(options);
10
+ */
11
+ export declare function wrapClientClass<ClassConstructor extends new (...args: any[]) => Client & BaseClient<any>, WrappedClassConstructor extends new (...args: any[]) => Client & BaseClient<any> & OpenTelemetryClientInterface>(ClientClass: ClassConstructor): WrappedClassConstructor;
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/custom/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,eAAe,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,IAAI,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAOpF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,gBAAgB,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EACzE,uBAAuB,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,4BAA4B,EAC/G,WAAW,EAAE,gBAAgB,GAAG,uBAAuB,CAuDxD"}
@@ -0,0 +1,40 @@
1
+ import type { Carrier, Scope } from '@sentry/core';
2
+ import { Hub } from '@sentry/core';
3
+ import type { Client } from '@sentry/types';
4
+ /**
5
+ * A custom hub that ensures we always creat an OTEL scope.
6
+ * Exported only for testing
7
+ */
8
+ export declare class OpenTelemetryHub extends Hub {
9
+ constructor(client?: Client, scope?: Scope);
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ pushScope(): Scope;
14
+ }
15
+ /**
16
+ * Returns the default hub instance.
17
+ *
18
+ * If a hub is already registered in the global carrier but this module
19
+ * contains a more recent version, it replaces the registered version.
20
+ * Otherwise, the currently registered hub will be returned.
21
+ */
22
+ export declare function getCurrentHub(): Hub;
23
+ /**
24
+ * Ensure the global hub is an OpenTelemetryHub.
25
+ */
26
+ export declare function setupGlobalHub(): void;
27
+ /**
28
+ * This will create a new {@link Hub} and add to the passed object on
29
+ * __SENTRY__.hub.
30
+ * @param carrier object
31
+ * @hidden
32
+ */
33
+ export declare function getHubFromCarrier(carrier: Carrier): Hub;
34
+ /**
35
+ * @private Private API with no semver guarantees!
36
+ *
37
+ * If the carrier does not contain a hub, a new hub is created with the global hub client and scope.
38
+ */
39
+ export declare function ensureHubOnCarrier(carrier: Carrier, parent?: Hub): void;
40
+ //# sourceMappingURL=hub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.d.ts","sourceRoot":"","sources":["../../../src/custom/hub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,GAAG;gBACpB,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,KAAgC;IAI3E;;OAEG;IACI,SAAS,IAAI,KAAK;CAS1B;AAuBD;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,GAAG,CAcnC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CASrC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,GAAoB,GAAG,IAAI,CASvF"}
@@ -0,0 +1,5 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubextensions.d.ts","sourceRoot":"","sources":["../../../src/custom/hubextensions.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAY3C"}
@@ -0,0 +1,34 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ import { Scope } from '@sentry/core';
3
+ import type { Breadcrumb, Span as SentrySpan } from '@sentry/types';
4
+ /** A fork of the classic scope with some otel specific stuff. */
5
+ export declare class OpenTelemetryScope extends Scope {
6
+ /**
7
+ * This can be set to ensure the scope uses _this_ span as the active one,
8
+ * instead of using getActiveSpan().
9
+ */
10
+ activeSpan: Span | undefined;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static clone(scope?: Scope): Scope;
15
+ /**
16
+ * In node-experimental, scope.getSpan() always returns undefined.
17
+ * Instead, use the global `getActiveSpan()`.
18
+ */
19
+ getSpan(): undefined;
20
+ /**
21
+ * In node-experimental, scope.setSpan() is a noop.
22
+ * Instead, use the global `startSpan()` to define the active span.
23
+ */
24
+ setSpan(_span: SentrySpan): this;
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ protected _getBreadcrumbs(): Breadcrumb[];
33
+ }
34
+ //# sourceMappingURL=scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/custom/scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAiB,IAAI,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AASnF,iEAAiE;AACjE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C;;;OAGG;IACI,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;IAEpC;;OAEG;WACW,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK;IAsBzC;;;OAGG;IACI,OAAO,IAAI,SAAS;IAO3B;;;OAGG;IACI,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMvC;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAiB3E;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,UAAU,EAAE;CAO1C"}
@@ -0,0 +1,17 @@
1
+ import { Transaction } from '@sentry/core';
2
+ import type { Hub as HubInterface, Scope, TransactionContext } from '@sentry/types';
3
+ /**
4
+ * This is a fork of core's tracing/hubextensions.ts _startTransaction,
5
+ * with some OTEL specifics.
6
+ */
7
+ export declare function startTransaction(hub: HubInterface, transactionContext: TransactionContext): Transaction;
8
+ /**
9
+ * This is a fork of the base Transaction with OTEL specific stuff added.
10
+ */
11
+ export declare class OpenTelemetryTransaction extends Transaction {
12
+ /**
13
+ * Finish the transaction, but apply the given scope instead of the current one.
14
+ */
15
+ finishWithScope(endTimestamp?: number, scope?: Scope): string | undefined;
16
+ }
17
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/custom/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAiB,GAAG,IAAI,YAAY,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnG;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,WAAW,CAavG;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,WAAW;IACvD;;OAEG;IACI,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;CAgBjF"}
@@ -0,0 +1,31 @@
1
+ import { addOriginToSpan } from './utils/addOriginToSpan';
2
+ import { maybeCaptureExceptionForTimedEvent } from './utils/captureExceptionForTimedEvent';
3
+ import { getRequestSpanData } from './utils/getRequestSpanData';
4
+ export type { OpenTelemetryClient } from './types';
5
+ export { wrapClientClass } from './custom/client';
6
+ export { getSpanKind } from './utils/getSpanKind';
7
+ export { getSpanHub, getSpanMetadata, getSpanParent, getSpanScope, setSpanMetadata } from './utils/spanData';
8
+ export { getPropagationContextFromContext, setPropagationContextOnContext } from './utils/contextData';
9
+ export { spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus, } from './utils/spanTypes';
10
+ export { isSentryRequestSpan } from './utils/isSentryRequest';
11
+ export { getActiveSpan, getRootSpan } from './utils/getActiveSpan';
12
+ export { startSpan, startInactiveSpan } from './trace';
13
+ export { getCurrentHub, setupGlobalHub } from './custom/hub';
14
+ export { addTracingExtensions } from './custom/hubextensions';
15
+ export { setupEventContextTrace } from './setupEventContextTrace';
16
+ export { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrategy';
17
+ export { wrapContextManagerClass } from './contextManager';
18
+ export { SentryPropagator } from './propagator';
19
+ export { SentrySpanProcessor } from './spanProcessor';
20
+ export { SentrySampler } from './sampler';
21
+ /**
22
+ * The following internal utils are not considered public API and are subject to change.
23
+ * @hidden
24
+ */
25
+ declare const _INTERNAL: {
26
+ readonly addOriginToSpan: typeof addOriginToSpan;
27
+ readonly maybeCaptureExceptionForTimedEvent: typeof maybeCaptureExceptionForTimedEvent;
28
+ readonly getRequestSpanData: typeof getRequestSpanData;
29
+ };
30
+ export { _INTERNAL };
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE7G,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAEvG,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,2CAA2C,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;GAGG;AACH,QAAA,MAAM,SAAS;;;;CAIL,CAAC;AAEX,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Context, TextMapGetter, TextMapSetter } from '@opentelemetry/api';
2
+ import { W3CBaggagePropagator } from '@opentelemetry/core';
3
+ /**
4
+ * Injects and extracts `sentry-trace` and `baggage` headers from carriers.
5
+ */
6
+ export declare class SentryPropagator extends W3CBaggagePropagator {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ inject(context: Context, carrier: unknown, setter: TextMapSetter): void;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ extract(context: Context, carrier: unknown, getter: TextMapGetter): Context;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ fields(): string[];
19
+ }
20
+ //# sourceMappingURL=propagator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propagator.d.ts","sourceRoot":"","sources":["../../src/propagator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,OAAO,EAAe,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,EAAuB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAUhF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,oBAAoB;IACxD;;OAEG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAyB9E;;OAEG;IACI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;IA0BlF;;OAEG;IACI,MAAM,IAAI,MAAM,EAAE;CAG1B"}
@@ -0,0 +1,15 @@
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base';
3
+ import type { Client } from '@sentry/types';
4
+ /**
5
+ * A custom OTEL sampler that uses Sentry sampling rates to make it's decision
6
+ */
7
+ export declare class SentrySampler implements Sampler {
8
+ private _client;
9
+ constructor(client: Client);
10
+ /** @inheritDoc */
11
+ shouldSample(context: Context, traceId: string, spanName: string, _spanKind: unknown, _attributes: unknown, _links: unknown): SamplingResult;
12
+ /** Returns the sampler name or short description with the configuration. */
13
+ toString(): string;
14
+ }
15
+ //# sourceMappingURL=sampler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../../src/sampler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,OAAO,EAAe,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG7E,OAAO,KAAK,EAAE,MAAM,EAAkC,MAAM,eAAe,CAAC;AAM5E;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,OAAO,CAAS;gBAEL,MAAM,EAAE,MAAM;IAIjC,kBAAkB;IACX,YAAY,CACjB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,OAAO,GACd,cAAc;IA8FjB,4EAA4E;IACrE,QAAQ,IAAI,MAAM;CAG1B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * These are internal and are not supposed to be used/depended on by external parties.
3
+ * No guarantees apply to these attributes, and the may change/disappear at any time.
4
+ */
5
+ export declare const InternalSentrySemanticAttributes: {
6
+ readonly ORIGIN: "sentry.origin";
7
+ readonly OP: "sentry.op";
8
+ readonly SOURCE: "sentry.source";
9
+ readonly SAMPLE_RATE: "sentry.sample_rate";
10
+ readonly PARENT_SAMPLED: "sentry.parentSampled";
11
+ readonly BREADCRUMB_TYPE: "sentry.breadcrumb.type";
12
+ readonly BREADCRUMB_LEVEL: "sentry.breadcrumb.level";
13
+ readonly BREADCRUMB_EVENT_ID: "sentry.breadcrumb.event_id";
14
+ readonly BREADCRUMB_CATEGORY: "sentry.breadcrumb.category";
15
+ readonly BREADCRUMB_DATA: "sentry.breadcrumb.data";
16
+ };
17
+ //# sourceMappingURL=semanticAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semanticAttributes.d.ts","sourceRoot":"","sources":["../../src/semanticAttributes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;CAWnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Client } from '@sentry/types';
2
+ /** Ensure the `trace` context is set on all events. */
3
+ export declare function setupEventContextTrace(client: Client): void;
4
+ //# sourceMappingURL=setupEventContextTrace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupEventContextTrace.d.ts","sourceRoot":"","sources":["../../src/setupEventContextTrace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,uDAAuD;AACvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAyB3D"}
@@ -0,0 +1,17 @@
1
+ import type { ExportResult } from '@opentelemetry/core';
2
+ import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
3
+ /**
4
+ * A Sentry-specific exporter that converts OpenTelemetry Spans to Sentry Spans & Transactions.
5
+ */
6
+ export declare class SentrySpanExporter implements SpanExporter {
7
+ private _finishedSpans;
8
+ private _stopped;
9
+ constructor();
10
+ /** @inheritDoc */
11
+ export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
12
+ /** @inheritDoc */
13
+ shutdown(): Promise<void>;
14
+ /** @inheritDoc */
15
+ forceFlush(): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=spanExporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spanExporter.d.ts","sourceRoot":"","sources":["../../src/spanExporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAqBhF;;GAEG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAU;;IAO1B,kBAAkB;IACX,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAoC1F,kBAAkB;IACX,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,kBAAkB;IACL,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzC"}
@@ -0,0 +1,22 @@
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { Span, SpanProcessor as SpanProcessorInterface } from '@opentelemetry/sdk-trace-base';
3
+ import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
4
+ /**
5
+ * Converts OpenTelemetry Spans to Sentry Spans and sends them to Sentry via
6
+ * the Sentry SDK.
7
+ */
8
+ export declare class SentrySpanProcessor extends BatchSpanProcessor implements SpanProcessorInterface {
9
+ constructor();
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ onStart(span: Span, parentContext: Context): void;
14
+ /** @inheritDoc */
15
+ onEnd(span: Span): void;
16
+ /**
17
+ * You can overwrite this in a sub class to implement custom behavior for dropping spans.
18
+ * If you return `false` here, the span will not be passed to the exporter and thus not be sent.
19
+ */
20
+ protected _shouldSendSpanToSentry(_span: Span): boolean;
21
+ }
22
+ //# sourceMappingURL=spanProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spanProcessor.d.ts","sourceRoot":"","sources":["../../src/spanProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAyCnE;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,kBAAmB,YAAW,sBAAsB;;IAK3F;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAQxD,kBAAkB;IACX,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAa9B;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;CAGxD"}
@@ -0,0 +1,28 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ import type { OpenTelemetrySpanContext } from './types';
3
+ /**
4
+ * Wraps a function with a transaction/span and finishes the span after the function is done.
5
+ * The created span is the active span and will be used as parent by other spans created inside the function
6
+ * and can be accessed via `Sentry.getSpan()`, as long as the function is executed while the scope is active.
7
+ *
8
+ * If you want to create a span that is not set as active, use {@link startInactiveSpan}.
9
+ *
10
+ * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
11
+ */
12
+ export declare function startSpan<T>(spanContext: OpenTelemetrySpanContext, callback: (span: Span) => T): T;
13
+ /**
14
+ * @deprecated Use {@link startSpan} instead.
15
+ */
16
+ export declare const startActiveSpan: typeof startSpan;
17
+ /**
18
+ * Creates a span. This span is not set as active, so will not get automatic instrumentation spans
19
+ * as children or be able to be accessed via `Sentry.getSpan()`.
20
+ *
21
+ * If you want to create a span that is set as active, use {@link startSpan}.
22
+ *
23
+ * Note that if you have not enabled tracing extensions via `addTracingExtensions`
24
+ * or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans
25
+ * and the `span` returned from the callback will be undefined.
26
+ */
27
+ export declare function startInactiveSpan(spanContext: OpenTelemetrySpanContext): Span;
28
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,oBAAoB,CAAC;AAQvD,OAAO,KAAK,EAAuB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAG7E;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC,CAqClG;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,kBAAY,CAAC;AAEzC;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,wBAAwB,GAAG,IAAI,CAU7E"}
@@ -0,0 +1,26 @@
1
+ import type { Span as WriteableSpan, Tracer } from '@opentelemetry/api';
2
+ import type { BasicTracerProvider, ReadableSpan, Span } from '@opentelemetry/sdk-trace-base';
3
+ import type { SpanOrigin, TransactionMetadata, TransactionSource } from '@sentry/types';
4
+ export interface OpenTelemetryClient {
5
+ tracer: Tracer;
6
+ traceProvider: BasicTracerProvider | undefined;
7
+ }
8
+ export interface OpenTelemetrySpanContext {
9
+ name: string;
10
+ op?: string;
11
+ metadata?: Partial<TransactionMetadata>;
12
+ origin?: SpanOrigin;
13
+ source?: TransactionSource;
14
+ }
15
+ /**
16
+ * The base `Span` type is basically a `WriteableSpan`.
17
+ * There are places where we basically want to allow passing _any_ span,
18
+ * so in these cases we type this as `AbstractSpan` which could be either a regular `Span` or a `ReadableSpan`.
19
+ * You'll have to make sure to check relevant fields before accessing them.
20
+ *
21
+ * Note that technically, the `Span` exported from `@opentelemwetry/sdk-trace-base` matches this,
22
+ * but we cannot be 100% sure that we are actually getting such a span, so this type is more defensive.
23
+ */
24
+ export type AbstractSpan = WriteableSpan | ReadableSpan;
25
+ export type { Span };
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAExF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAChD;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,YAAY,CAAC;AAExD,YAAY,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ import type { SpanOrigin } from '@sentry/types';
3
+ /** Adds an origin to an OTEL Span. */
4
+ export declare function addOriginToSpan(span: Span, origin: SpanOrigin): void;
5
+ //# sourceMappingURL=addOriginToSpan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addOriginToSpan.d.ts","sourceRoot":"","sources":["../../../src/utils/addOriginToSpan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,sCAAsC;AACtC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAEpE"}
@@ -0,0 +1,8 @@
1
+ import type { Span as OtelSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';
2
+ import type { Hub } from '@sentry/types';
3
+ /**
4
+ * Maybe capture a Sentry exception for an OTEL timed event.
5
+ * This will check if the event is exception-like and in that case capture it as an exception.
6
+ */
7
+ export declare function maybeCaptureExceptionForTimedEvent(hub: Hub, event: TimedEvent, otelSpan?: OtelSpan): void;
8
+ //# sourceMappingURL=captureExceptionForTimedEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captureExceptionForTimedEvent.d.ts","sourceRoot":"","sources":["../../../src/utils/captureExceptionForTimedEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CA6CzG"}
@@ -0,0 +1,23 @@
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { Hub, PropagationContext } from '@sentry/types';
3
+ /**
4
+ * Try to get the Propagation Context from the given OTEL context.
5
+ * This requires the SentryPropagator to be registered.
6
+ */
7
+ export declare function getPropagationContextFromContext(context: Context): PropagationContext | undefined;
8
+ /**
9
+ * Set a Propagation Context on an OTEL context..
10
+ * This will return a forked context with the Propagation Context set.
11
+ */
12
+ export declare function setPropagationContextOnContext(context: Context, propagationContext: PropagationContext): Context;
13
+ /**
14
+ * Try to get the Hub from the given OTEL context.
15
+ * This requires a Context Manager that was wrapped with getWrappedContextManager.
16
+ */
17
+ export declare function getHubFromContext(context: Context): Hub | undefined;
18
+ /**
19
+ * Set a Hub on an OTEL context..
20
+ * This will return a forked context with the Propagation Context set.
21
+ */
22
+ export declare function setHubOnContext(context: Context, hub: Hub): Context;
23
+ //# sourceMappingURL=contextData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextData.d.ts","sourceRoot":"","sources":["../../../src/utils/contextData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAI7D;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAEjG;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,OAAO,CAEhH;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,GAAG,SAAS,CAEnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAEnE"}
@@ -0,0 +1,3 @@
1
+ /** Convert an OTEL time to seconds */
2
+ export declare function convertOtelTimeToSeconds([seconds, nano]: [number, number]): number;
3
+ //# sourceMappingURL=convertOtelTimeToSeconds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertOtelTimeToSeconds.d.ts","sourceRoot":"","sources":["../../../src/utils/convertOtelTimeToSeconds.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,wBAAgB,wBAAwB,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAElF"}
@@ -0,0 +1,11 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ /**
3
+ * Returns the currently active span.
4
+ */
5
+ export declare function getActiveSpan(): Span | undefined;
6
+ /**
7
+ * Get the root span for the given span.
8
+ * The given span may be the root span itself.
9
+ */
10
+ export declare function getRootSpan(span: Span): Span;
11
+ //# sourceMappingURL=getActiveSpan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getActiveSpan.d.ts","sourceRoot":"","sources":["../../../src/utils/getActiveSpan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAK/C;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,GAAG,SAAS,CAEhD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAQ5C"}
@@ -0,0 +1,8 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
+ import type { SanitizedRequestData } from '@sentry/types';
4
+ /**
5
+ * Get sanitizied request data from an OTEL span.
6
+ */
7
+ export declare function getRequestSpanData(span: Span | ReadableSpan): Partial<SanitizedRequestData>;
8
+ //# sourceMappingURL=getRequestSpanData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRequestSpanData.d.ts","sourceRoot":"","sources":["../../../src/utils/getRequestSpanData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAK1D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAmC3F"}