@ddd-ts-kit/tracing 0.0.0-stage → 0.1.1

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 (262) hide show
  1. package/README.md +400 -2
  2. package/dist/application/trace-application.d.ts +39 -0
  3. package/dist/application/trace-application.d.ts.map +1 -0
  4. package/dist/application/trace-application.js +31 -0
  5. package/dist/application/trace-application.js.map +1 -0
  6. package/dist/configuration/configure-tracing.d.ts +9 -0
  7. package/dist/configuration/configure-tracing.d.ts.map +1 -0
  8. package/dist/configuration/configure-tracing.js +21 -0
  9. package/dist/configuration/configure-tracing.js.map +1 -0
  10. package/dist/configuration/default-lifecycle-hooks.d.ts +2 -0
  11. package/dist/configuration/default-lifecycle-hooks.d.ts.map +1 -0
  12. package/dist/configuration/default-lifecycle-hooks.js +8 -0
  13. package/dist/configuration/default-lifecycle-hooks.js.map +1 -0
  14. package/dist/configuration/tracing-configuration.d.ts +16 -0
  15. package/dist/configuration/tracing-configuration.d.ts.map +1 -0
  16. package/dist/configuration/tracing-configuration.js +2 -0
  17. package/dist/configuration/tracing-configuration.js.map +1 -0
  18. package/dist/correlation/correlation-id-from-active-span.d.ts +6 -0
  19. package/dist/correlation/correlation-id-from-active-span.d.ts.map +1 -0
  20. package/dist/correlation/correlation-id-from-active-span.js +10 -0
  21. package/dist/correlation/correlation-id-from-active-span.js.map +1 -0
  22. package/dist/correlation/trace-log-fields.d.ts +13 -0
  23. package/dist/correlation/trace-log-fields.d.ts.map +1 -0
  24. package/dist/correlation/trace-log-fields.js +20 -0
  25. package/dist/correlation/trace-log-fields.js.map +1 -0
  26. package/dist/correlation/traced-error-reporter.d.ts +9 -0
  27. package/dist/correlation/traced-error-reporter.d.ts.map +1 -0
  28. package/dist/correlation/traced-error-reporter.js +23 -0
  29. package/dist/correlation/traced-error-reporter.js.map +1 -0
  30. package/dist/dependency/method.d.ts +2 -0
  31. package/dist/dependency/method.d.ts.map +1 -0
  32. package/dist/dependency/method.js +2 -0
  33. package/dist/dependency/method.js.map +1 -0
  34. package/dist/dependency/proxied.d.ts +8 -0
  35. package/dist/dependency/proxied.d.ts.map +1 -0
  36. package/dist/dependency/proxied.js +21 -0
  37. package/dist/dependency/proxied.js.map +1 -0
  38. package/dist/dependency/shadowed.d.ts +4 -0
  39. package/dist/dependency/shadowed.d.ts.map +1 -0
  40. package/dist/dependency/shadowed.js +14 -0
  41. package/dist/dependency/shadowed.js.map +1 -0
  42. package/dist/dependency/trace-bindings.d.ts +25 -0
  43. package/dist/dependency/trace-bindings.d.ts.map +1 -0
  44. package/dist/dependency/trace-bindings.js +35 -0
  45. package/dist/dependency/trace-bindings.js.map +1 -0
  46. package/dist/dependency/trace-dependency.d.ts +26 -0
  47. package/dist/dependency/trace-dependency.d.ts.map +1 -0
  48. package/dist/dependency/trace-dependency.js +56 -0
  49. package/dist/dependency/trace-dependency.js.map +1 -0
  50. package/dist/dependency/traceable-methods.d.ts +4 -0
  51. package/dist/dependency/traceable-methods.d.ts.map +1 -0
  52. package/dist/dependency/traceable-methods.js +46 -0
  53. package/dist/dependency/traceable-methods.js.map +1 -0
  54. package/dist/dependency/traced.d.ts +5 -0
  55. package/dist/dependency/traced.d.ts.map +1 -0
  56. package/dist/dependency/traced.js +56 -0
  57. package/dist/dependency/traced.js.map +1 -0
  58. package/dist/domain-events/traced-domain-events.d.ts +14 -0
  59. package/dist/domain-events/traced-domain-events.d.ts.map +1 -0
  60. package/dist/domain-events/traced-domain-events.js +49 -0
  61. package/dist/domain-events/traced-domain-events.js.map +1 -0
  62. package/dist/events/consumer-trace.d.ts +8 -0
  63. package/dist/events/consumer-trace.d.ts.map +1 -0
  64. package/dist/events/consumer-trace.js +2 -0
  65. package/dist/events/consumer-trace.js.map +1 -0
  66. package/dist/events/messaging-attributes.d.ts +12 -0
  67. package/dist/events/messaging-attributes.d.ts.map +1 -0
  68. package/dist/events/messaging-attributes.js +11 -0
  69. package/dist/events/messaging-attributes.js.map +1 -0
  70. package/dist/events/traced-consumer.d.ts +22 -0
  71. package/dist/events/traced-consumer.d.ts.map +1 -0
  72. package/dist/events/traced-consumer.js +65 -0
  73. package/dist/events/traced-consumer.js.map +1 -0
  74. package/dist/events/traced-publisher.d.ts +19 -0
  75. package/dist/events/traced-publisher.d.ts.map +1 -0
  76. package/dist/events/traced-publisher.js +69 -0
  77. package/dist/events/traced-publisher.js.map +1 -0
  78. package/dist/events/traced-subscriber.d.ts +15 -0
  79. package/dist/events/traced-subscriber.d.ts.map +1 -0
  80. package/dist/events/traced-subscriber.js +19 -0
  81. package/dist/events/traced-subscriber.js.map +1 -0
  82. package/dist/http/is-noise-path.d.ts +3 -0
  83. package/dist/http/is-noise-path.d.ts.map +1 -0
  84. package/dist/http/is-noise-path.js +7 -0
  85. package/dist/http/is-noise-path.js.map +1 -0
  86. package/dist/http/is-noise-route.d.ts +6 -0
  87. package/dist/http/is-noise-route.d.ts.map +1 -0
  88. package/dist/http/is-noise-route.js +7 -0
  89. package/dist/http/is-noise-route.js.map +1 -0
  90. package/dist/http/noise-paths.d.ts +3 -0
  91. package/dist/http/noise-paths.d.ts.map +1 -0
  92. package/dist/http/noise-paths.js +15 -0
  93. package/dist/http/noise-paths.js.map +1 -0
  94. package/dist/http/traced-routes.d.ts +28 -0
  95. package/dist/http/traced-routes.d.ts.map +1 -0
  96. package/dist/http/traced-routes.js +76 -0
  97. package/dist/http/traced-routes.js.map +1 -0
  98. package/dist/index.d.ts +36 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +32 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/jobs/traced-job.d.ts +16 -0
  103. package/dist/jobs/traced-job.d.ts.map +1 -0
  104. package/dist/jobs/traced-job.js +25 -0
  105. package/dist/jobs/traced-job.js.map +1 -0
  106. package/dist/local-root/admit-dependency-span.d.ts +7 -0
  107. package/dist/local-root/admit-dependency-span.d.ts.map +1 -0
  108. package/dist/local-root/admit-dependency-span.js +30 -0
  109. package/dist/local-root/admit-dependency-span.js.map +1 -0
  110. package/dist/local-root/correlate.d.ts +9 -0
  111. package/dist/local-root/correlate.d.ts.map +1 -0
  112. package/dist/local-root/correlate.js +23 -0
  113. package/dist/local-root/correlate.js.map +1 -0
  114. package/dist/local-root/local-root-tracker.d.ts +18 -0
  115. package/dist/local-root/local-root-tracker.d.ts.map +1 -0
  116. package/dist/local-root/local-root-tracker.js +26 -0
  117. package/dist/local-root/local-root-tracker.js.map +1 -0
  118. package/dist/local-root/local-root.d.ts +11 -0
  119. package/dist/local-root/local-root.d.ts.map +1 -0
  120. package/dist/local-root/local-root.js +2 -0
  121. package/dist/local-root/local-root.js.map +1 -0
  122. package/dist/local-root/local-roots.d.ts +4 -0
  123. package/dist/local-root/local-roots.d.ts.map +1 -0
  124. package/dist/local-root/local-roots.js +4 -0
  125. package/dist/local-root/local-roots.js.map +1 -0
  126. package/dist/local-root/work-attributes.d.ts +4 -0
  127. package/dist/local-root/work-attributes.d.ts.map +1 -0
  128. package/dist/local-root/work-attributes.js +11 -0
  129. package/dist/local-root/work-attributes.js.map +1 -0
  130. package/dist/node/default-instrumentations.d.ts +20 -0
  131. package/dist/node/default-instrumentations.d.ts.map +1 -0
  132. package/dist/node/default-instrumentations.js +55 -0
  133. package/dist/node/default-instrumentations.js.map +1 -0
  134. package/dist/node/init-tracing.d.ts +41 -0
  135. package/dist/node/init-tracing.d.ts.map +1 -0
  136. package/dist/node/init-tracing.js +71 -0
  137. package/dist/node/init-tracing.js.map +1 -0
  138. package/dist/node/instrumentations-off.d.ts +6 -0
  139. package/dist/node/instrumentations-off.d.ts.map +1 -0
  140. package/dist/node/instrumentations-off.js +39 -0
  141. package/dist/node/instrumentations-off.js.map +1 -0
  142. package/dist/node.d.ts +3 -0
  143. package/dist/node.d.ts.map +1 -0
  144. package/dist/node.js +3 -0
  145. package/dist/node.js.map +1 -0
  146. package/dist/processors/attribute-allow-list.d.ts +25 -0
  147. package/dist/processors/attribute-allow-list.d.ts.map +1 -0
  148. package/dist/processors/attribute-allow-list.js +38 -0
  149. package/dist/processors/attribute-allow-list.js.map +1 -0
  150. package/dist/processors/default-allowed-attributes.d.ts +8 -0
  151. package/dist/processors/default-allowed-attributes.d.ts.map +1 -0
  152. package/dist/processors/default-allowed-attributes.js +48 -0
  153. package/dist/processors/default-allowed-attributes.js.map +1 -0
  154. package/dist/processors/ended-span.d.ts +19 -0
  155. package/dist/processors/ended-span.d.ts.map +1 -0
  156. package/dist/processors/ended-span.js +2 -0
  157. package/dist/processors/ended-span.js.map +1 -0
  158. package/dist/processors/error-message-scrubber.d.ts +13 -0
  159. package/dist/processors/error-message-scrubber.d.ts.map +1 -0
  160. package/dist/processors/error-message-scrubber.js +21 -0
  161. package/dist/processors/error-message-scrubber.js.map +1 -0
  162. package/dist/processors/url-secret-span-processor.d.ts +12 -0
  163. package/dist/processors/url-secret-span-processor.d.ts.map +1 -0
  164. package/dist/processors/url-secret-span-processor.js +47 -0
  165. package/dist/processors/url-secret-span-processor.js.map +1 -0
  166. package/dist/propagation/capture-traceparent.d.ts +3 -0
  167. package/dist/propagation/capture-traceparent.d.ts.map +1 -0
  168. package/dist/propagation/capture-traceparent.js +7 -0
  169. package/dist/propagation/capture-traceparent.js.map +1 -0
  170. package/dist/propagation/context-with-traceparent.d.ts +4 -0
  171. package/dist/propagation/context-with-traceparent.d.ts.map +1 -0
  172. package/dist/propagation/context-with-traceparent.js +8 -0
  173. package/dist/propagation/context-with-traceparent.js.map +1 -0
  174. package/dist/propagation/run-with-traceparent.d.ts +6 -0
  175. package/dist/propagation/run-with-traceparent.d.ts.map +1 -0
  176. package/dist/propagation/run-with-traceparent.js +10 -0
  177. package/dist/propagation/run-with-traceparent.js.map +1 -0
  178. package/dist/propagation/span-context-from-traceparent.d.ts +4 -0
  179. package/dist/propagation/span-context-from-traceparent.d.ts.map +1 -0
  180. package/dist/propagation/span-context-from-traceparent.js +23 -0
  181. package/dist/propagation/span-context-from-traceparent.js.map +1 -0
  182. package/dist/propagation/traceparent-from-context.d.ts +4 -0
  183. package/dist/propagation/traceparent-from-context.d.ts.map +1 -0
  184. package/dist/propagation/traceparent-from-context.js +11 -0
  185. package/dist/propagation/traceparent-from-context.js.map +1 -0
  186. package/dist/span/constructor-name.d.ts +3 -0
  187. package/dist/span/constructor-name.d.ts.map +1 -0
  188. package/dist/span/constructor-name.js +9 -0
  189. package/dist/span/constructor-name.js.map +1 -0
  190. package/dist/span/failed-traces.d.ts +2 -0
  191. package/dist/span/failed-traces.d.ts.map +1 -0
  192. package/dist/span/failed-traces.js +3 -0
  193. package/dist/span/failed-traces.js.map +1 -0
  194. package/dist/span/in-span.d.ts +12 -0
  195. package/dist/span/in-span.d.ts.map +1 -0
  196. package/dist/span/in-span.js +19 -0
  197. package/dist/span/in-span.js.map +1 -0
  198. package/dist/span/is-thenable.d.ts +2 -0
  199. package/dist/span/is-thenable.d.ts.map +1 -0
  200. package/dist/span/is-thenable.js +7 -0
  201. package/dist/span/is-thenable.js.map +1 -0
  202. package/dist/span/mark-span-failed.d.ts +4 -0
  203. package/dist/span/mark-span-failed.d.ts.map +1 -0
  204. package/dist/span/mark-span-failed.js +36 -0
  205. package/dist/span/mark-span-failed.js.map +1 -0
  206. package/dist/span/outcome-attribute.d.ts +3 -0
  207. package/dist/span/outcome-attribute.d.ts.map +1 -0
  208. package/dist/span/outcome-attribute.js +3 -0
  209. package/dist/span/outcome-attribute.js.map +1 -0
  210. package/dist/span/refusal-code.d.ts +4 -0
  211. package/dist/span/refusal-code.d.ts.map +1 -0
  212. package/dist/span/refusal-code.js +10 -0
  213. package/dist/span/refusal-code.js.map +1 -0
  214. package/dist/span/tracer.d.ts +4 -0
  215. package/dist/span/tracer.d.ts.map +1 -0
  216. package/dist/span/tracer.js +7 -0
  217. package/dist/span/tracer.js.map +1 -0
  218. package/dist/span/with-span.d.ts +9 -0
  219. package/dist/span/with-span.d.ts.map +1 -0
  220. package/dist/span/with-span.js +36 -0
  221. package/dist/span/with-span.js.map +1 -0
  222. package/dist/testing/expect-span-tree.d.ts +10 -0
  223. package/dist/testing/expect-span-tree.d.ts.map +1 -0
  224. package/dist/testing/expect-span-tree.js +29 -0
  225. package/dist/testing/expect-span-tree.js.map +1 -0
  226. package/dist/testing/expected-span.d.ts +17 -0
  227. package/dist/testing/expected-span.d.ts.map +1 -0
  228. package/dist/testing/expected-span.js +2 -0
  229. package/dist/testing/expected-span.js.map +1 -0
  230. package/dist/testing/install-test-tracing.d.ts +23 -0
  231. package/dist/testing/install-test-tracing.d.ts.map +1 -0
  232. package/dist/testing/install-test-tracing.js +48 -0
  233. package/dist/testing/install-test-tracing.js.map +1 -0
  234. package/dist/testing/render-span-tree.d.ts +8 -0
  235. package/dist/testing/render-span-tree.d.ts.map +1 -0
  236. package/dist/testing/render-span-tree.js +23 -0
  237. package/dist/testing/render-span-tree.js.map +1 -0
  238. package/dist/testing/span-mismatches.d.ts +5 -0
  239. package/dist/testing/span-mismatches.d.ts.map +1 -0
  240. package/dist/testing/span-mismatches.js +34 -0
  241. package/dist/testing/span-mismatches.js.map +1 -0
  242. package/dist/testing/span-node.d.ts +13 -0
  243. package/dist/testing/span-node.d.ts.map +1 -0
  244. package/dist/testing/span-node.js +2 -0
  245. package/dist/testing/span-node.js.map +1 -0
  246. package/dist/testing/span-tree-of.d.ts +8 -0
  247. package/dist/testing/span-tree-of.d.ts.map +1 -0
  248. package/dist/testing/span-tree-of.js +34 -0
  249. package/dist/testing/span-tree-of.js.map +1 -0
  250. package/dist/testing/start-order.d.ts +12 -0
  251. package/dist/testing/start-order.d.ts.map +1 -0
  252. package/dist/testing/start-order.js +17 -0
  253. package/dist/testing/start-order.js.map +1 -0
  254. package/dist/testing.d.ts +6 -0
  255. package/dist/testing.d.ts.map +1 -0
  256. package/dist/testing.js +4 -0
  257. package/dist/testing.js.map +1 -0
  258. package/dist/use-case/trace-use-cases.d.ts +10 -0
  259. package/dist/use-case/trace-use-cases.d.ts.map +1 -0
  260. package/dist/use-case/trace-use-cases.js +41 -0
  261. package/dist/use-case/trace-use-cases.js.map +1 -0
  262. package/package.json +75 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlate.d.ts","sourceRoot":"","sources":["../../src/local-root/correlate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAmB/C"}
@@ -0,0 +1,23 @@
1
+ import { tracingConfiguration } from '../configuration/configure-tracing.js';
2
+ export const CORRELATION_ID_ATTRIBUTE = 'app.correlation_id';
3
+ export const ORIGIN_ATTRIBUTE = 'app.origin';
4
+ /**
5
+ * Names the execution context on the local root, once. Identifiers of the work only: who acts
6
+ * and for which tenant never become span attributes.
7
+ */
8
+ export function correlate(root) {
9
+ if (root.correlated) {
10
+ return;
11
+ }
12
+ const execution = tracingConfiguration().executionScope?.current();
13
+ if (execution === undefined) {
14
+ return;
15
+ }
16
+ root.correlated = true;
17
+ if (!root.span.isRecording()) {
18
+ return;
19
+ }
20
+ root.span.setAttribute(CORRELATION_ID_ATTRIBUTE, execution.correlationId);
21
+ root.span.setAttribute(ORIGIN_ATTRIBUTE, execution.origin);
22
+ }
23
+ //# sourceMappingURL=correlate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlate.js","sourceRoot":"","sources":["../../src/local-root/correlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAG7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;IAEnE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAEvB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAC1E,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type Context, type Span } from '@opentelemetry/api';
2
+ /**
3
+ * Span processor that remembers, for every span, the local root it belongs to (the
4
+ * first span of the trace in this process: no parent, or a remote one). Add it to the
5
+ * tracer provider to enable the per-root cap of dependency spans; without it the cap is
6
+ * not applied. Structurally compatible with the SDK `SpanProcessor`.
7
+ *
8
+ * With `configureTracing({ executionScope })`, it also names the correlation id and the origin
9
+ * of the work on the local root, as soon as a span starts inside the execution scope: the root
10
+ * itself usually starts before the boundary opened the scope.
11
+ */
12
+ export declare class LocalRootTracker {
13
+ onStart(span: Span, parentContext: Context): void;
14
+ onEnd(): void;
15
+ forceFlush(): Promise<void>;
16
+ shutdown(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=local-root-tracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-root-tracker.d.ts","sourceRoot":"","sources":["../../src/local-root/local-root-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAIpE;;;;;;;;;GASG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI,CAOhD;IAED,KAAK,IAAI,IAAI,CAAG;IAEV,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;IAE9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;CACnC"}
@@ -0,0 +1,26 @@
1
+ import { trace } from '@opentelemetry/api';
2
+ import { correlate } from './correlate.js';
3
+ import { localRoots } from './local-roots.js';
4
+ /**
5
+ * Span processor that remembers, for every span, the local root it belongs to (the
6
+ * first span of the trace in this process: no parent, or a remote one). Add it to the
7
+ * tracer provider to enable the per-root cap of dependency spans; without it the cap is
8
+ * not applied. Structurally compatible with the SDK `SpanProcessor`.
9
+ *
10
+ * With `configureTracing({ executionScope })`, it also names the correlation id and the origin
11
+ * of the work on the local root, as soon as a span starts inside the execution scope: the root
12
+ * itself usually starts before the boundary opened the scope.
13
+ */
14
+ export class LocalRootTracker {
15
+ onStart(span, parentContext) {
16
+ const parent = trace.getSpan(parentContext);
17
+ const inherited = parent === undefined ? undefined : localRoots.get(parent);
18
+ const root = inherited ?? { span, perName: new Map(), total: 0, dropped: 0, correlated: false };
19
+ localRoots.set(span, root);
20
+ correlate(root);
21
+ }
22
+ onEnd() { }
23
+ async forceFlush() { }
24
+ async shutdown() { }
25
+ }
26
+ //# sourceMappingURL=local-root-tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-root-tracker.js","sourceRoot":"","sources":["../../src/local-root/local-root-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA2B,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAgB;IAC3B,OAAO,CAAC,IAAU,EAAE,aAAsB;QACxC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5E,MAAM,IAAI,GAAG,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QAEhG,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3B,SAAS,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,KAAU,CAAC;IAEhB,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC,KAAK,CAAC,QAAQ,KAAmB,CAAC;CACnC"}
@@ -0,0 +1,11 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ /** The first span of a trace in this process, and what was counted under it. */
3
+ export interface LocalRoot {
4
+ readonly span: Span;
5
+ readonly perName: Map<string, number>;
6
+ total: number;
7
+ dropped: number;
8
+ /** Whether the span already names the execution context it belongs to. */
9
+ correlated: boolean;
10
+ }
11
+ //# sourceMappingURL=local-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-root.d.ts","sourceRoot":"","sources":["../../src/local-root/local-root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=local-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-root.js","sourceRoot":"","sources":["../../src/local-root/local-root.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ import type { LocalRoot } from './local-root.js';
3
+ export declare const localRoots: WeakMap<Span, LocalRoot>;
4
+ //# sourceMappingURL=local-roots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-roots.d.ts","sourceRoot":"","sources":["../../src/local-root/local-roots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,eAAO,MAAM,UAAU,0BAAiC,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Keyed by span object: the SDK hands the same object to the processor and to the
2
+ // context, and a WeakMap needs no cleanup when a trace ends.
3
+ export const localRoots = new WeakMap();
4
+ //# sourceMappingURL=local-roots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-roots.js","sourceRoot":"","sources":["../../src/local-root/local-roots.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,EAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Attributes } from '@opentelemetry/api';
2
+ /** The correlation id and the origin of the unit of work in progress, for the span that starts it. Empty outside of one. */
3
+ export declare function workAttributes(): Attributes;
4
+ //# sourceMappingURL=work-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work-attributes.d.ts","sourceRoot":"","sources":["../../src/local-root/work-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,4HAA4H;AAC5H,wBAAgB,cAAc,IAAI,UAAU,CAQ3C"}
@@ -0,0 +1,11 @@
1
+ import { tracingConfiguration } from '../configuration/configure-tracing.js';
2
+ import { CORRELATION_ID_ATTRIBUTE, ORIGIN_ATTRIBUTE } from './correlate.js';
3
+ /** The correlation id and the origin of the unit of work in progress, for the span that starts it. Empty outside of one. */
4
+ export function workAttributes() {
5
+ const execution = tracingConfiguration().executionScope?.current();
6
+ if (execution === undefined) {
7
+ return {};
8
+ }
9
+ return { [CORRELATION_ID_ATTRIBUTE]: execution.correlationId, [ORIGIN_ATTRIBUTE]: execution.origin };
10
+ }
11
+ //# sourceMappingURL=work-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work-attributes.js","sourceRoot":"","sources":["../../src/local-root/work-attributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE5E,4HAA4H;AAC5H,MAAM,UAAU,cAAc;IAC5B,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;IAEnE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,EAAE,CAAC,wBAAwB,CAAC,EAAE,SAAS,CAAC,aAAa,EAAE,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC;AACvG,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
2
+ export type AutoInstrumentationSettings = NonNullable<Parameters<typeof getNodeAutoInstrumentations>[0]>;
3
+ export interface DefaultInstrumentationsOptions {
4
+ /** Paths whose incoming requests get no span. Default `NOISE_PATHS`. */
5
+ readonly ignoredPaths?: readonly string[];
6
+ /** Merged over the defaults, per instrumentation: `{ '@opentelemetry/instrumentation-fs': { enabled: true } }`. */
7
+ readonly settings?: AutoInstrumentationSettings;
8
+ }
9
+ /**
10
+ * Off: plumbing and duplicates. `fs`, `dns` and `net` describe how a call was made, not what
11
+ * was done. Web framework layers (`express`, `connect`, `router`, `fastify`, `koa`, `hapi`,
12
+ * `restify`, `nestjs-core`) add a span per middleware where the kit names the request by its
13
+ * route. Broker clients (`amqplib`, `kafkajs`) would double the `publish` and `process` spans
14
+ * of the kit. Query builders, pools and loaders (`knex`, `generic-pool`, `dataloader`,
15
+ * `lru-memoizer`, `mongoose`) repeat what the driver says. Logging bridges and runtime metrics
16
+ * are no trace matter. An instrumentation a later version of the bundle adds keeps the default
17
+ * of the bundle until it is listed here.
18
+ */
19
+ export declare function defaultInstrumentations(options?: DefaultInstrumentationsOptions): ReturnType<typeof getNodeAutoInstrumentations>;
20
+ //# sourceMappingURL=default-instrumentations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-instrumentations.d.ts","sourceRoot":"","sources":["../../src/node/default-instrumentations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAKxF,MAAM,MAAM,2BAA2B,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzG,MAAM,WAAW,8BAA8B;IAC7C,wEAAwE;IACxE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,mHAAmH;IACnH,QAAQ,CAAC,QAAQ,CAAC,EAAE,2BAA2B,CAAC;CACjD;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,8BAAmC,GAC3C,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAchD"}
@@ -0,0 +1,55 @@
1
+ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
2
+ import { isNoisePath } from '../http/is-noise-path.js';
3
+ import { NOISE_PATHS } from '../http/noise-paths.js';
4
+ import { INSTRUMENTATIONS_OFF } from './instrumentations-off.js';
5
+ /**
6
+ * On: what tells the story of an action. HTTP, as server and as client (`http`, `undici`, `grpc`),
7
+ * and the database and cache drivers, whose statements are recorded as written, with their
8
+ * placeholders and never the values bound to them, and only inside a trace: a poller or a
9
+ * pool that queries outside of any request makes no span.
10
+ */
11
+ const KEPT = {
12
+ '@opentelemetry/instrumentation-http': {},
13
+ '@opentelemetry/instrumentation-undici': { requireParentforSpans: true },
14
+ '@opentelemetry/instrumentation-grpc': {},
15
+ '@opentelemetry/instrumentation-pg': {
16
+ requireParentSpan: true,
17
+ ignoreConnectSpans: true,
18
+ enhancedDatabaseReporting: false,
19
+ },
20
+ '@opentelemetry/instrumentation-mysql2': { maskStatement: true },
21
+ '@opentelemetry/instrumentation-mysql': { enhancedDatabaseReporting: false },
22
+ '@opentelemetry/instrumentation-mongodb': { requireParentSpan: true, enhancedDatabaseReporting: false },
23
+ '@opentelemetry/instrumentation-ioredis': { requireParentSpan: true },
24
+ '@opentelemetry/instrumentation-redis': { requireParentSpan: true },
25
+ };
26
+ /**
27
+ * Off: plumbing and duplicates. `fs`, `dns` and `net` describe how a call was made, not what
28
+ * was done. Web framework layers (`express`, `connect`, `router`, `fastify`, `koa`, `hapi`,
29
+ * `restify`, `nestjs-core`) add a span per middleware where the kit names the request by its
30
+ * route. Broker clients (`amqplib`, `kafkajs`) would double the `publish` and `process` spans
31
+ * of the kit. Query builders, pools and loaders (`knex`, `generic-pool`, `dataloader`,
32
+ * `lru-memoizer`, `mongoose`) repeat what the driver says. Logging bridges and runtime metrics
33
+ * are no trace matter. An instrumentation a later version of the bundle adds keeps the default
34
+ * of the bundle until it is listed here.
35
+ */
36
+ export function defaultInstrumentations(options = {}) {
37
+ const ignoredPaths = options.ignoredPaths ?? NOISE_PATHS;
38
+ const settings = {
39
+ ...everythingElseOff(),
40
+ ...enabled(KEPT),
41
+ '@opentelemetry/instrumentation-http': {
42
+ enabled: true,
43
+ ignoreIncomingRequestHook: (request) => isNoisePath(request.url ?? '', ignoredPaths),
44
+ },
45
+ ...options.settings,
46
+ };
47
+ return getNodeAutoInstrumentations(settings);
48
+ }
49
+ function everythingElseOff() {
50
+ return Object.fromEntries(INSTRUMENTATIONS_OFF.map((name) => [name, { enabled: false }]));
51
+ }
52
+ function enabled(settings) {
53
+ return Object.fromEntries(Object.entries(settings).map(([name, config]) => [name, { ...config, enabled: true }]));
54
+ }
55
+ //# sourceMappingURL=default-instrumentations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-instrumentations.js","sourceRoot":"","sources":["../../src/node/default-instrumentations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAWjE;;;;;GAKG;AACH,MAAM,IAAI,GAAgC;IACxC,qCAAqC,EAAE,EAAE;IACzC,uCAAuC,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE;IACxE,qCAAqC,EAAE,EAAE;IACzC,mCAAmC,EAAE;QACnC,iBAAiB,EAAE,IAAI;QACvB,kBAAkB,EAAE,IAAI;QACxB,yBAAyB,EAAE,KAAK;KACjC;IACD,uCAAuC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IAChE,sCAAsC,EAAE,EAAE,yBAAyB,EAAE,KAAK,EAAE;IAC5E,wCAAwC,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,yBAAyB,EAAE,KAAK,EAAE;IACvG,wCAAwC,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE;IACrE,sCAAsC,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE;CACpE,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAO,GAAmC,EAAE;IAE5C,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,WAAW,CAAC;IAEzD,MAAM,QAAQ,GAAgC;QAC5C,GAAG,iBAAiB,EAAE;QACtB,GAAG,OAAO,CAAC,IAAI,CAAC;QAChB,qCAAqC,EAAE;YACrC,OAAO,EAAE,IAAI;YACb,yBAAyB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,YAAY,CAAC;SACrF;QACD,GAAG,OAAO,CAAC,QAAQ;KACpB,CAAC;IAEF,OAAO,2BAA2B,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,MAAM,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAED,SAAS,OAAO,CAAC,QAAqC;IACpD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACpH,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { NodeSDK, tracing } from '@opentelemetry/sdk-node';
2
+ import { type AutoInstrumentationSettings } from './default-instrumentations.js';
3
+ type NodeSdkOptions = NonNullable<ConstructorParameters<typeof NodeSDK>[0]>;
4
+ export interface InitTracingOptions {
5
+ readonly serviceName: string;
6
+ readonly serviceVersion?: string;
7
+ /** Reported as `deployment.environment.name`. */
8
+ readonly environment?: string;
9
+ /**
10
+ * Full OTLP/HTTP traces URL, for example `http://collector:4318/v1/traces`. Without
11
+ * it, the standard `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_ENDPOINT`
12
+ * variables are honoured; with none of them, nothing is exported.
13
+ */
14
+ readonly exporterUrl?: string;
15
+ /**
16
+ * Share of new traces sampled, 0 to 1, decided where a trace starts: a sampled parent is
17
+ * always followed, so a trace is kept or dropped whole, across processes. Without it, the
18
+ * standard `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` variables are honoured, and
19
+ * by default every trace is kept. Keeping the traces that end in error whatever the ratio is
20
+ * tail sampling, which is the work of a collector: sample everything here and decide there.
21
+ */
22
+ readonly sampleRatio?: number;
23
+ /** Replaces the default instrumentations altogether. */
24
+ readonly instrumentations?: NonNullable<NodeSdkOptions['instrumentations']>;
25
+ /** Changes the settings of the default instrumentations, one by one: turns one on, or off, or configures it. */
26
+ readonly autoInstrumentations?: AutoInstrumentationSettings;
27
+ /** Paths whose incoming requests get no span. Default `NOISE_PATHS`: probes, metrics, documentation. */
28
+ readonly ignoredPaths?: readonly string[];
29
+ /** Attribute names, or prefixes ending with a dot, kept on spans besides `DEFAULT_ALLOWED_ATTRIBUTES`. */
30
+ readonly allowedAttributes?: readonly string[];
31
+ /** Run after the built-in scrubbing processors and before the exporter. */
32
+ readonly extraSpanProcessors?: readonly tracing.SpanProcessor[];
33
+ readonly enabled?: boolean;
34
+ }
35
+ export interface TracingHandle {
36
+ /** Flushes pending spans. Call it on SIGTERM, before the process exits. */
37
+ shutdown(): Promise<void>;
38
+ }
39
+ export declare function initTracing(options: InitTracingOptions): TracingHandle;
40
+ export {};
41
+ //# sourceMappingURL=init-tracing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-tracing.d.ts","sourceRoot":"","sources":["../../src/node/init-tracing.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAa,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKtE,OAAO,EAA2B,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE1G,KAAK,cAAc,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,iDAAiD;IACjD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC5E,gHAAgH;IAChH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,2BAA2B,CAAC;IAC5D,wGAAwG;IACxG,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,0GAA0G;IAC1G,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,2EAA2E;IAC3E,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,OAAO,CAAC,aAAa,EAAE,CAAC;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,aAAa,CAsBtE"}
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Node bootstrap. The only file of the package that loads the OpenTelemetry SDK.
3
+ *
4
+ * `initTracing` must run before any module that requires `http` or a database driver is
5
+ * loaded, otherwise auto-instrumentation registers too late and those modules stay
6
+ * unpatched. Make it the very first statement of `main.ts`. In an ES module, static
7
+ * imports are evaluated before the first statement, so there the call goes in a file of
8
+ * its own (`platform/tracing.ts`) that `main.ts` imports first, or that is preloaded
9
+ * with `node --import`. Packages published as ES modules additionally need the
10
+ * `@opentelemetry/instrumentation` loader hook; CommonJS packages and Node built-ins
11
+ * do not.
12
+ */
13
+ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
14
+ import { NodeSDK, resources, tracing } from '@opentelemetry/sdk-node';
15
+ import { LocalRootTracker } from '../local-root/local-root-tracker.js';
16
+ import { AttributeAllowList } from '../processors/attribute-allow-list.js';
17
+ import { ErrorMessageScrubber } from '../processors/error-message-scrubber.js';
18
+ import { UrlSecretSpanProcessor } from '../processors/url-secret-span-processor.js';
19
+ import { defaultInstrumentations } from './default-instrumentations.js';
20
+ export function initTracing(options) {
21
+ if (options.enabled === false || process.env['OTEL_SDK_DISABLED']?.toLowerCase() === 'true') {
22
+ return { shutdown: async () => { } };
23
+ }
24
+ const sdk = new NodeSDK({
25
+ serviceName: options.serviceName,
26
+ resource: resourceOf(options),
27
+ spanProcessors: spanProcessorsOf(options),
28
+ instrumentations: options.instrumentations ?? [instrumentationsOf(options)],
29
+ ...(options.sampleRatio === undefined
30
+ ? {}
31
+ : {
32
+ sampler: new tracing.ParentBasedSampler({
33
+ root: new tracing.TraceIdRatioBasedSampler(options.sampleRatio),
34
+ }),
35
+ }),
36
+ });
37
+ sdk.start();
38
+ return { shutdown: () => sdk.shutdown() };
39
+ }
40
+ function instrumentationsOf({ ignoredPaths, autoInstrumentations, }) {
41
+ return defaultInstrumentations({
42
+ ...(ignoredPaths === undefined ? {} : { ignoredPaths }),
43
+ ...(autoInstrumentations === undefined ? {} : { settings: autoInstrumentations }),
44
+ });
45
+ }
46
+ function resourceOf(options) {
47
+ return resources.defaultResource().merge(resources.resourceFromAttributes({
48
+ ...(options.serviceVersion === undefined ? {} : { 'service.version': options.serviceVersion }),
49
+ ...(options.environment === undefined ? {} : { 'deployment.environment.name': options.environment }),
50
+ }));
51
+ }
52
+ function spanProcessorsOf(options) {
53
+ const exporter = exporterFor(options);
54
+ return [
55
+ new LocalRootTracker(),
56
+ new UrlSecretSpanProcessor(),
57
+ new ErrorMessageScrubber(),
58
+ new AttributeAllowList(options.allowedAttributes === undefined ? {} : { alsoAllowed: options.allowedAttributes }),
59
+ ...(options.extraSpanProcessors ?? []),
60
+ ...(exporter === undefined ? [] : [new tracing.BatchSpanProcessor(exporter)]),
61
+ ];
62
+ }
63
+ function exporterFor(options) {
64
+ if (options.exporterUrl !== undefined) {
65
+ return new OTLPTraceExporter({ url: options.exporterUrl });
66
+ }
67
+ const fromEnvironment = process.env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'] ?? process.env['OTEL_EXPORTER_OTLP_ENDPOINT'];
68
+ // The exporter reads the variables itself and appends `/v1/traces` where the spec says so.
69
+ return fromEnvironment ? new OTLPTraceExporter() : undefined;
70
+ }
71
+ //# sourceMappingURL=init-tracing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-tracing.js","sourceRoot":"","sources":["../../src/node/init-tracing.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The instrumentations of the bundle that are off by default: what is neither an HTTP side nor
3
+ * a database or cache driver. Named one by one, since listing the bundle would load them all.
4
+ */
5
+ export declare const INSTRUMENTATIONS_OFF: readonly ['@opentelemetry/instrumentation-amqplib', '@opentelemetry/instrumentation-aws-lambda', '@opentelemetry/instrumentation-aws-sdk', '@opentelemetry/instrumentation-bunyan', '@opentelemetry/instrumentation-cassandra-driver', '@opentelemetry/instrumentation-connect', '@opentelemetry/instrumentation-cucumber', '@opentelemetry/instrumentation-dataloader', '@opentelemetry/instrumentation-dns', '@opentelemetry/instrumentation-express', '@opentelemetry/instrumentation-fs', '@opentelemetry/instrumentation-generic-pool', '@opentelemetry/instrumentation-graphql', '@opentelemetry/instrumentation-hapi', '@opentelemetry/instrumentation-host-metrics', '@opentelemetry/instrumentation-kafkajs', '@opentelemetry/instrumentation-knex', '@opentelemetry/instrumentation-koa', '@opentelemetry/instrumentation-lru-memoizer', '@opentelemetry/instrumentation-memcached', '@opentelemetry/instrumentation-mongoose', '@opentelemetry/instrumentation-nestjs-core', '@opentelemetry/instrumentation-net', '@opentelemetry/instrumentation-openai', '@opentelemetry/instrumentation-oracledb', '@opentelemetry/instrumentation-pino', '@opentelemetry/instrumentation-restify', '@opentelemetry/instrumentation-router', '@opentelemetry/instrumentation-runtime-node', '@opentelemetry/instrumentation-socket.io', '@opentelemetry/instrumentation-tedious', '@opentelemetry/instrumentation-winston'];
6
+ //# sourceMappingURL=instrumentations-off.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentations-off.d.ts","sourceRoot":"","sources":["../../src/node/instrumentations-off.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YAC/B,wCAAwC,EACxC,2CAA2C,EAC3C,wCAAwC,EACxC,uCAAuC,EACvC,iDAAiD,EACjD,wCAAwC,EACxC,yCAAyC,EACzC,2CAA2C,EAC3C,oCAAoC,EACpC,wCAAwC,EACxC,mCAAmC,EACnC,6CAA6C,EAC7C,wCAAwC,EACxC,qCAAqC,EACrC,6CAA6C,EAC7C,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,6CAA6C,EAC7C,0CAA0C,EAC1C,yCAAyC,EACzC,4CAA4C,EAC5C,oCAAoC,EACpC,uCAAuC,EACvC,yCAAyC,EACzC,qCAAqC,EACrC,wCAAwC,EACxC,uCAAuC,EACvC,6CAA6C,EAC7C,0CAA0C,EAC1C,wCAAwC,EACxC,wCAAwC,CAChC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The instrumentations of the bundle that are off by default: what is neither an HTTP side nor
3
+ * a database or cache driver. Named one by one, since listing the bundle would load them all.
4
+ */
5
+ export const INSTRUMENTATIONS_OFF = [
6
+ '@opentelemetry/instrumentation-amqplib',
7
+ '@opentelemetry/instrumentation-aws-lambda',
8
+ '@opentelemetry/instrumentation-aws-sdk',
9
+ '@opentelemetry/instrumentation-bunyan',
10
+ '@opentelemetry/instrumentation-cassandra-driver',
11
+ '@opentelemetry/instrumentation-connect',
12
+ '@opentelemetry/instrumentation-cucumber',
13
+ '@opentelemetry/instrumentation-dataloader',
14
+ '@opentelemetry/instrumentation-dns',
15
+ '@opentelemetry/instrumentation-express',
16
+ '@opentelemetry/instrumentation-fs',
17
+ '@opentelemetry/instrumentation-generic-pool',
18
+ '@opentelemetry/instrumentation-graphql',
19
+ '@opentelemetry/instrumentation-hapi',
20
+ '@opentelemetry/instrumentation-host-metrics',
21
+ '@opentelemetry/instrumentation-kafkajs',
22
+ '@opentelemetry/instrumentation-knex',
23
+ '@opentelemetry/instrumentation-koa',
24
+ '@opentelemetry/instrumentation-lru-memoizer',
25
+ '@opentelemetry/instrumentation-memcached',
26
+ '@opentelemetry/instrumentation-mongoose',
27
+ '@opentelemetry/instrumentation-nestjs-core',
28
+ '@opentelemetry/instrumentation-net',
29
+ '@opentelemetry/instrumentation-openai',
30
+ '@opentelemetry/instrumentation-oracledb',
31
+ '@opentelemetry/instrumentation-pino',
32
+ '@opentelemetry/instrumentation-restify',
33
+ '@opentelemetry/instrumentation-router',
34
+ '@opentelemetry/instrumentation-runtime-node',
35
+ '@opentelemetry/instrumentation-socket.io',
36
+ '@opentelemetry/instrumentation-tedious',
37
+ '@opentelemetry/instrumentation-winston',
38
+ ];
39
+ //# sourceMappingURL=instrumentations-off.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentations-off.js","sourceRoot":"","sources":["../../src/node/instrumentations-off.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,wCAAwC;IACxC,2CAA2C;IAC3C,wCAAwC;IACxC,uCAAuC;IACvC,iDAAiD;IACjD,wCAAwC;IACxC,yCAAyC;IACzC,2CAA2C;IAC3C,oCAAoC;IACpC,wCAAwC;IACxC,mCAAmC;IACnC,6CAA6C;IAC7C,wCAAwC;IACxC,qCAAqC;IACrC,6CAA6C;IAC7C,wCAAwC;IACxC,qCAAqC;IACrC,oCAAoC;IACpC,6CAA6C;IAC7C,0CAA0C;IAC1C,yCAAyC;IACzC,4CAA4C;IAC5C,oCAAoC;IACpC,uCAAuC;IACvC,yCAAyC;IACzC,qCAAqC;IACrC,wCAAwC;IACxC,uCAAuC;IACvC,6CAA6C;IAC7C,0CAA0C;IAC1C,wCAAwC;IACxC,wCAAwC;CAChC,CAAC"}
package/dist/node.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { defaultInstrumentations, type AutoInstrumentationSettings, type DefaultInstrumentationsOptions, } from './node/default-instrumentations.js';
2
+ export { initTracing, type InitTracingOptions, type TracingHandle } from './node/init-tracing.js';
3
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,GACpC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/node.js ADDED
@@ -0,0 +1,3 @@
1
+ export { defaultInstrumentations, } from './node/default-instrumentations.js';
2
+ export { initTracing } from './node/init-tracing.js';
3
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,GAGxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAA+C,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { EndedSpan } from './ended-span.js';
2
+ export interface AttributeAllowListOptions {
3
+ /** Replaces the default list. A name ending with a dot allows every attribute below it. */
4
+ readonly allowed?: readonly string[];
5
+ /** Added to the list in use. */
6
+ readonly alsoAllowed?: readonly string[];
7
+ }
8
+ /**
9
+ * Keeps on every span, and on its events, only the attributes of the allow-list: request and
10
+ * response headers, bodies, query parameter values of a database call, user and client
11
+ * identifiers an instrumentation may record never reach the exporter. Register it BEFORE the
12
+ * exporting processor.
13
+ */
14
+ export declare class AttributeAllowList {
15
+ private readonly names;
16
+ private readonly prefixes;
17
+ constructor(options?: AttributeAllowListOptions);
18
+ onStart(): void;
19
+ onEnd(span: EndedSpan): void;
20
+ forceFlush(): Promise<void>;
21
+ shutdown(): Promise<void>;
22
+ private prune;
23
+ private allows;
24
+ }
25
+ //# sourceMappingURL=attribute-allow-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-allow-list.d.ts","sourceRoot":"","sources":["../../src/processors/attribute-allow-list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,yBAAyB;IACxC,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,gCAAgC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAE5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAE7C,YAAY,OAAO,GAAE,yBAA8B,EAKlD;IAED,OAAO,IAAI,IAAI,CAAG;IAElB,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAQ3B;IAEK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;IAE9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;IAElC,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,MAAM;CAGf"}
@@ -0,0 +1,38 @@
1
+ import { DEFAULT_ALLOWED_ATTRIBUTES } from './default-allowed-attributes.js';
2
+ /**
3
+ * Keeps on every span, and on its events, only the attributes of the allow-list: request and
4
+ * response headers, bodies, query parameter values of a database call, user and client
5
+ * identifiers an instrumentation may record never reach the exporter. Register it BEFORE the
6
+ * exporting processor.
7
+ */
8
+ export class AttributeAllowList {
9
+ names;
10
+ prefixes;
11
+ constructor(options = {}) {
12
+ const allowed = [...(options.allowed ?? DEFAULT_ALLOWED_ATTRIBUTES), ...(options.alsoAllowed ?? [])];
13
+ this.names = new Set(allowed.filter((name) => !name.endsWith('.')));
14
+ this.prefixes = allowed.filter((name) => name.endsWith('.'));
15
+ }
16
+ onStart() { }
17
+ onEnd(span) {
18
+ this.prune(span.attributes);
19
+ for (const event of span.events) {
20
+ if (event.attributes !== undefined) {
21
+ this.prune(event.attributes, 'exception.type');
22
+ }
23
+ }
24
+ }
25
+ async forceFlush() { }
26
+ async shutdown() { }
27
+ prune(attributes, ...kept) {
28
+ for (const name of Object.keys(attributes)) {
29
+ if (!kept.includes(name) && !this.allows(name)) {
30
+ Reflect.deleteProperty(attributes, name);
31
+ }
32
+ }
33
+ }
34
+ allows(name) {
35
+ return this.names.has(name) || this.prefixes.some((prefix) => name.startsWith(prefix));
36
+ }
37
+ }
38
+ //# sourceMappingURL=attribute-allow-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-allow-list.js","sourceRoot":"","sources":["../../src/processors/attribute-allow-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAU7E;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IACZ,KAAK,CAAsB;IAE3B,QAAQ,CAAoB;IAE7C,YAAY,OAAO,GAA8B,EAAE;QACjD,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,0BAA0B,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC;QAErG,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,KAAU,CAAC;IAElB,KAAK,CAAC,IAAe;QACnB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE5B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBACnC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC,KAAK,CAAC,QAAQ,KAAmB,CAAC;IAE1B,KAAK,CAAC,UAAmC,EAAE,GAAG,IAAuB;QAC3E,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/C,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACzF,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Attribute names and prefixes (ending with a dot) a span may carry by default: what the kit
3
+ * writes (`app.`, `code.`, `messaging.`, `error.type`) and what the instrumentations kept on by
4
+ * default write about a request, a query or a peer. Whatever else an instrumentation adds is
5
+ * dropped before export.
6
+ */
7
+ export declare const DEFAULT_ALLOWED_ATTRIBUTES: readonly string[];
8
+ //# sourceMappingURL=default-allowed-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-allowed-attributes.d.ts","sourceRoot":"","sources":["../../src/processors/default-allowed-attributes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAwCvD,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Attribute names and prefixes (ending with a dot) a span may carry by default: what the kit
3
+ * writes (`app.`, `code.`, `messaging.`, `error.type`) and what the instrumentations kept on by
4
+ * default write about a request, a query or a peer. Whatever else an instrumentation adds is
5
+ * dropped before export.
6
+ */
7
+ export const DEFAULT_ALLOWED_ATTRIBUTES = [
8
+ 'app.',
9
+ 'code.',
10
+ 'messaging.',
11
+ 'error.type',
12
+ 'http.request.method',
13
+ 'http.request.method_original',
14
+ 'http.request.resend_count',
15
+ 'http.response.status_code',
16
+ 'http.route',
17
+ 'http.method',
18
+ 'http.status_code',
19
+ 'http.scheme',
20
+ 'http.target',
21
+ 'http.url',
22
+ 'http.host',
23
+ 'http.flavor',
24
+ 'url.',
25
+ 'server.',
26
+ 'network.protocol.',
27
+ 'network.transport',
28
+ 'network.type',
29
+ 'net.host.name',
30
+ 'net.host.port',
31
+ 'net.peer.name',
32
+ 'net.peer.port',
33
+ 'db.system',
34
+ 'db.system.name',
35
+ 'db.namespace',
36
+ 'db.name',
37
+ 'db.collection.name',
38
+ 'db.operation',
39
+ 'db.operation.name',
40
+ 'db.sql.table',
41
+ 'db.statement',
42
+ 'db.query.text',
43
+ 'db.query.summary',
44
+ 'db.response.status_code',
45
+ 'rpc.',
46
+ 'otel.',
47
+ ];
48
+ //# sourceMappingURL=default-allowed-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-allowed-attributes.js","sourceRoot":"","sources":["../../src/processors/default-allowed-attributes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,MAAM;IACN,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,qBAAqB;IACrB,8BAA8B;IAC9B,2BAA2B;IAC3B,2BAA2B;IAC3B,YAAY;IACZ,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,UAAU;IACV,WAAW;IACX,aAAa;IACb,MAAM;IACN,SAAS;IACT,mBAAmB;IACnB,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,WAAW;IACX,gBAAgB;IAChB,cAAc;IACd,SAAS;IACT,oBAAoB;IACpB,cAAc;IACd,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,yBAAyB;IACzB,MAAM;IACN,OAAO;CACR,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Attributes, SpanStatus } from '@opentelemetry/api';
2
+ /**
3
+ * The part of an ended SDK span the scrubbing processors touch. Declared here so the root
4
+ * entry depends on `@opentelemetry/api` only; the SDK `ReadableSpan` is assignable to it.
5
+ *
6
+ * Those processors edit the span in `onEnd`. The SDK types a span as read-only at that point
7
+ * and offers no supported way to rewrite an attribute or an event of a span created by someone
8
+ * else (auto-instrumentation). With sdk-trace-base 2.x the attributes, events and status are
9
+ * plain mutable objects, and exporters read them after every processor ran, so mutating them
10
+ * there is the usual approach. Register these processors BEFORE the exporting one.
11
+ */
12
+ export interface EndedSpan {
13
+ attributes: Attributes;
14
+ events: {
15
+ attributes?: Attributes;
16
+ }[];
17
+ status: SpanStatus;
18
+ }
19
+ //# sourceMappingURL=ended-span.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ended-span.d.ts","sourceRoot":"","sources":["../../src/processors/ended-span.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,UAAU,CAAA;KAAE,EAAE,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ended-span.js.map