autotel 7.8.0 → 7.10.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 (158) hide show
  1. package/README.md +14 -0
  2. package/dist/analysis.cjs +1 -1
  3. package/dist/analysis.d.cts +6 -7
  4. package/dist/analysis.d.ts +6 -7
  5. package/dist/analysis.js +1 -1
  6. package/dist/attributes.d.cts +1 -1
  7. package/dist/attributes.d.ts +1 -1
  8. package/dist/auto.cjs +1 -1
  9. package/dist/auto.js +1 -1
  10. package/dist/business-baggage.d.cts +12 -13
  11. package/dist/business-baggage.d.ts +12 -13
  12. package/dist/{canonical-log-line-processor-Bwrt_L4c.d.ts → canonical-log-line-processor-DDGzm-wi.d.ts} +1 -1
  13. package/dist/{canonical-log-line-processor-C0Z_N4oL.d.cts → canonical-log-line-processor-DLeAQjgb.d.cts} +1 -1
  14. package/dist/channel-BobQKsZd.js +64 -0
  15. package/dist/channel-D0eaVqn3.cjs +81 -0
  16. package/dist/config.d.cts +7 -7
  17. package/dist/config.d.ts +7 -7
  18. package/dist/correlation-id.cjs +1 -1
  19. package/dist/correlation-id.d.cts +9 -10
  20. package/dist/correlation-id.d.ts +9 -10
  21. package/dist/correlation-id.js +1 -1
  22. package/dist/db.d.cts +18 -19
  23. package/dist/db.d.ts +18 -19
  24. package/dist/decorators.cjs +1 -1
  25. package/dist/decorators.d.cts +7 -7
  26. package/dist/decorators.d.ts +7 -7
  27. package/dist/decorators.js +1 -1
  28. package/dist/diagnostics.cjs +10 -70
  29. package/dist/diagnostics.d.cts +6 -6
  30. package/dist/diagnostics.d.ts +6 -6
  31. package/dist/diagnostics.js +1 -61
  32. package/dist/drain-pipeline.d.cts +4 -5
  33. package/dist/drain-pipeline.d.ts +4 -5
  34. package/dist/enrichers.d.cts +7 -8
  35. package/dist/enrichers.d.ts +7 -8
  36. package/dist/event.cjs +1 -1
  37. package/dist/event.d.cts +6 -6
  38. package/dist/event.d.ts +6 -6
  39. package/dist/event.js +1 -1
  40. package/dist/evidence.d.cts +13 -14
  41. package/dist/evidence.d.ts +13 -14
  42. package/dist/exception-fingerprint.d.cts +10 -11
  43. package/dist/exception-fingerprint.d.ts +10 -11
  44. package/dist/exporters.d.cts +2 -2
  45. package/dist/exporters.d.ts +2 -2
  46. package/dist/feature-flags.d.cts +23 -24
  47. package/dist/feature-flags.d.ts +23 -24
  48. package/dist/{filtering-span-processor-vkewzbqB.d.ts → filtering-span-processor-BDGe1myy.d.ts} +1 -1
  49. package/dist/{filtering-span-processor-BpDagWNa.d.cts → filtering-span-processor-BYvLMiNz.d.cts} +1 -1
  50. package/dist/filtering-span-processor.cjs +3 -3
  51. package/dist/filtering-span-processor.d.cts +1 -1
  52. package/dist/filtering-span-processor.d.ts +1 -1
  53. package/dist/filtering-span-processor.js +3 -3
  54. package/dist/{functional-SeRUabkE.d.ts → functional-CbcInXMJ.d.ts} +1 -1
  55. package/dist/{functional-u5Qwjray.cjs → functional-CjZT7Jur.cjs} +19 -21
  56. package/dist/{functional-CC2BFGAO.js → functional-DHn-xGtR.js} +21 -23
  57. package/dist/{functional-DPZTpGh6.d.cts → functional-j8Joyrwd.d.cts} +1 -1
  58. package/dist/functional.cjs +1 -1
  59. package/dist/functional.d.cts +1 -1
  60. package/dist/functional.d.ts +1 -1
  61. package/dist/functional.js +1 -1
  62. package/dist/http.cjs +1 -1
  63. package/dist/http.d.cts +6 -7
  64. package/dist/http.d.ts +6 -7
  65. package/dist/http.js +1 -1
  66. package/dist/{index-B9aRLp6c.d.ts → index-DAH41w0W.d.ts} +4 -4
  67. package/dist/{index-8bFU4kmd.d.cts → index-DVPsz3DK.d.cts} +4 -4
  68. package/dist/index.cjs +3 -2
  69. package/dist/index.d.cts +38 -38
  70. package/dist/index.d.ts +38 -38
  71. package/dist/index.js +4 -4
  72. package/dist/{init-COfMwKbc.d.cts → init-BtYaU5n9.d.cts} +18 -4
  73. package/dist/{init-CnoRlJqS.d.ts → init-DUIFqRRS.d.ts} +18 -4
  74. package/dist/{init-8SISAGdE.js → init-rVPOUqng.js} +171 -10
  75. package/dist/{init-21HWbm7_.cjs → init-zb68UvOW.cjs} +180 -6
  76. package/dist/instrumentation.cjs +1 -1
  77. package/dist/instrumentation.d.cts +4 -5
  78. package/dist/instrumentation.d.ts +4 -5
  79. package/dist/instrumentation.js +1 -1
  80. package/dist/{logger-S1Fgl0g3.d.cts → logger-C9UT1aZ_.d.cts} +4 -4
  81. package/dist/{logger-S1Fgl0g3.d.ts → logger-C9UT1aZ_.d.ts} +4 -4
  82. package/dist/logger.d.cts +1 -1
  83. package/dist/logger.d.ts +1 -1
  84. package/dist/messaging-adapters.d.cts +10 -11
  85. package/dist/messaging-adapters.d.ts +10 -11
  86. package/dist/messaging-testing.d.cts +19 -20
  87. package/dist/messaging-testing.d.ts +19 -20
  88. package/dist/messaging.cjs +2 -2
  89. package/dist/messaging.d.cts +23 -24
  90. package/dist/messaging.d.ts +23 -24
  91. package/dist/messaging.js +2 -2
  92. package/dist/metric-helpers.d.cts +6 -7
  93. package/dist/metric-helpers.d.ts +6 -7
  94. package/dist/metric.d.cts +7 -7
  95. package/dist/metric.d.ts +7 -7
  96. package/dist/parse-error.d.cts +3 -4
  97. package/dist/parse-error.d.ts +3 -4
  98. package/dist/policy.cjs +0 -0
  99. package/dist/policy.js +0 -0
  100. package/dist/processors.d.cts +1 -1
  101. package/dist/processors.d.ts +1 -1
  102. package/dist/{sampling-CZi7OM9u.d.ts → sampling-B_8orhSB.d.ts} +1 -1
  103. package/dist/{sampling-DENUjT_8.d.cts → sampling-Dud4XU2m.d.cts} +1 -1
  104. package/dist/sampling.cjs +1 -1
  105. package/dist/sampling.d.cts +1 -1
  106. package/dist/sampling.d.ts +1 -1
  107. package/dist/sampling.js +1 -1
  108. package/dist/security-schema.d.cts +30 -31
  109. package/dist/security-schema.d.ts +30 -31
  110. package/dist/semantic-conventions-yG0X2AsN.d.cts +31 -0
  111. package/dist/semantic-conventions-yG0X2AsN.d.ts +31 -0
  112. package/dist/semantic-conventions.d.cts +1 -1
  113. package/dist/semantic-conventions.d.ts +1 -1
  114. package/dist/semantic-helpers.cjs +1 -1
  115. package/dist/semantic-helpers.d.cts +10 -11
  116. package/dist/semantic-helpers.d.ts +10 -11
  117. package/dist/semantic-helpers.js +1 -1
  118. package/dist/slo.d.cts +12 -13
  119. package/dist/slo.d.ts +12 -13
  120. package/dist/tail-sampling-processor.cjs +1 -1
  121. package/dist/tail-sampling-processor.d.cts +2 -3
  122. package/dist/tail-sampling-processor.d.ts +2 -3
  123. package/dist/tail-sampling-processor.js +1 -1
  124. package/dist/test-span-collector.d.cts +4 -5
  125. package/dist/test-span-collector.d.ts +4 -5
  126. package/dist/testing.d.cts +18 -18
  127. package/dist/testing.d.ts +18 -18
  128. package/dist/trace-helpers.d.cts +15 -16
  129. package/dist/trace-helpers.d.ts +15 -16
  130. package/dist/tracer-provider.cjs +21 -1
  131. package/dist/tracer-provider.d.cts +16 -6
  132. package/dist/tracer-provider.d.ts +16 -6
  133. package/dist/tracer-provider.js +22 -3
  134. package/dist/validate.cjs +8 -7
  135. package/dist/validate.d.cts +12 -12
  136. package/dist/validate.d.ts +12 -12
  137. package/dist/validate.js +8 -7
  138. package/dist/validation-attributes.d.cts +14 -15
  139. package/dist/validation-attributes.d.ts +14 -15
  140. package/dist/webhook.cjs +1 -1
  141. package/dist/webhook.d.cts +11 -12
  142. package/dist/webhook.d.ts +11 -12
  143. package/dist/webhook.js +1 -1
  144. package/dist/workflow-distributed.cjs +1 -1
  145. package/dist/workflow-distributed.d.cts +26 -27
  146. package/dist/workflow-distributed.d.ts +26 -27
  147. package/dist/workflow-distributed.js +1 -1
  148. package/dist/workflow.cjs +1 -1
  149. package/dist/workflow.d.cts +11 -12
  150. package/dist/workflow.d.ts +11 -12
  151. package/dist/workflow.js +1 -1
  152. package/dist/yaml-config.cjs +1 -1
  153. package/dist/yaml-config.d.cts +9 -10
  154. package/dist/yaml-config.d.ts +9 -10
  155. package/dist/yaml-config.js +1 -1
  156. package/package.json +15 -21
  157. package/dist/semantic-conventions-FhSxv-bK.d.cts +0 -31
  158. package/dist/semantic-conventions-FhSxv-bK.d.ts +0 -31
@@ -1,11 +1,11 @@
1
1
  import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-rkV_WL-k.js";
2
- import { s as Logger } from "./logger-S1Fgl0g3.js";
3
- import { g as SamplingPreset, m as Sampler$1 } from "./sampling-CZi7OM9u.js";
2
+ import { s as Logger } from "./logger-C9UT1aZ_.js";
3
+ import { g as SamplingPreset, m as Sampler$1 } from "./sampling-B_8orhSB.js";
4
4
  import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.js";
5
- import { r as SpanFilterPredicate } from "./filtering-span-processor-vkewzbqB.js";
5
+ import { r as SpanFilterPredicate } from "./filtering-span-processor-BDGe1myy.js";
6
6
  import { r as Policy } from "./policy-DNw_0qUq.js";
7
7
  import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-DHcg1bSP.js";
8
- import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-Bwrt_L4c.js";
8
+ import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-DDGzm-wi.js";
9
9
  import { Attributes, Sampler, TextMapPropagator } from "@opentelemetry/api";
10
10
  import { Instrumentation } from "@opentelemetry/instrumentation";
11
11
  import { Resource, ResourceDetector } from "@opentelemetry/resources";
@@ -403,6 +403,20 @@ interface AutotelConfig {
403
403
  * autotel added no listener.
404
404
  */
405
405
  flushOnExit?: boolean;
406
+ /**
407
+ * Record `console.error(...)` calls made inside a span as an exception on
408
+ * that span, leaving its status alone (the error was handled). Read from
409
+ * Node's `console.*` diagnostics channels; `console` is never patched.
410
+ * Default: `true`.
411
+ */
412
+ captureConsoleErrors?: boolean;
413
+ /**
414
+ * Record one `autotel.LogFlood` exception on the active span when a single
415
+ * log template (digits, UUIDs and hex ids collapsed) is written more than
416
+ * this many times in one trace — logging inside a loop. Default: `100`;
417
+ * `0` disables.
418
+ */
419
+ logFloodThreshold?: number;
406
420
  /**
407
421
  * Local developer UX for autotel-devtools.
408
422
  *
@@ -9,8 +9,9 @@ import { SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
9
9
  import { AttributeRedactingProcessor, REDACTOR_PRESETS, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
10
10
  import { t as PrettyConsoleExporter } from "./pretty-console-exporter-DqKl_q9z.js";
11
11
  import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-BQ6NeZAk.js";
12
+ import { n as subscribeChannel } from "./channel-BobQKsZd.js";
12
13
  import { resetMetrics } from "./metric.js";
13
- import { DiagConsoleLogger, DiagLogLevel, TraceFlags, context, diag, metrics, propagation, trace } from "@opentelemetry/api";
14
+ import { DiagConsoleLogger, DiagLogLevel, TraceFlags, context, createContextKey, diag, metrics, propagation, trace } from "@opentelemetry/api";
14
15
  import { logs } from "@opentelemetry/api-logs";
15
16
  import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
16
17
  import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } from "@opentelemetry/core";
@@ -24,7 +25,7 @@ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic
24
25
  import * as nodeAsyncHooks from "node:async_hooks";
25
26
  import * as nodeFs from "node:fs";
26
27
  import path from "node:path";
27
- import { constants } from "node:os";
28
+ import * as os from "node:os";
28
29
  import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
29
30
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
30
31
 
@@ -2097,6 +2098,76 @@ var BaggageSpanProcessor = class {
2097
2098
  async forceFlush() {}
2098
2099
  };
2099
2100
 
2101
+ //#endregion
2102
+ //#region src/request-attributes.ts
2103
+ /**
2104
+ * Attributes set through `requestCtx` describe the whole request, so every
2105
+ * span started inside that request carries them too - not only the request
2106
+ * span. This stays in-process: nothing rides baggage, so a `user.email` set in
2107
+ * auth middleware never leaves in a `baggage` header on an outgoing call.
2108
+ */
2109
+ /**
2110
+ * The key `@opentelemetry/core` publishes RPC metadata under. `createContextKey`
2111
+ * is `Symbol.for`, so this reads exactly what `instrumentation-http` (and every
2112
+ * framework instrumentation that renames the route) wrote, without taking a
2113
+ * dependency on core.
2114
+ */
2115
+ const RPC_METADATA_KEY = createContextKey("OpenTelemetry SDK Context Key RPC_METADATA");
2116
+ /** The server span of the request `ctx` belongs to, if it belongs to one. */
2117
+ function getRequestSpanIn(ctx = context.active()) {
2118
+ const requestSpan = readProperty(ctx.getValue(RPC_METADATA_KEY), "span");
2119
+ return isFunction(readProperty(requestSpan, "spanContext")) ? requestSpan : void 0;
2120
+ }
2121
+ const scopes = /* @__PURE__ */ new WeakMap();
2122
+ function scopeFor(span) {
2123
+ let scope = scopes.get(span);
2124
+ if (!scope) {
2125
+ scope = { attributes: {} };
2126
+ scopes.set(span, scope);
2127
+ }
2128
+ return scope;
2129
+ }
2130
+ /**
2131
+ * The request span's attributes, or else every ancestor `requestCtx` wrote to,
2132
+ * merged so the nearer one wins a key: a job span tagging `job.id` under a
2133
+ * consumer that tagged `tenant` must not hide the tenant from its children.
2134
+ */
2135
+ function sourceOf(parentContext) {
2136
+ const requestSpan = getRequestSpanIn(parentContext);
2137
+ if (requestSpan) return scopes.get(requestSpan)?.attributes;
2138
+ const nearestFirst = [];
2139
+ const parent = trace.getSpan(parentContext);
2140
+ for (let scope = parent && scopes.get(parent); scope; scope = scope.parent) nearestFirst.push(scope.attributes);
2141
+ return nearestFirst.length > 0 ? Object.assign({}, ...nearestFirst.toReversed()) : void 0;
2142
+ }
2143
+ /** Remember attributes set through `requestCtx`, for the spans started under it. */
2144
+ function rememberRequestAttributes(span, attrs) {
2145
+ Object.assign(scopeFor(span).attributes, attrs);
2146
+ }
2147
+ /**
2148
+ * Copies `requestCtx` attributes onto each span started inside the request -
2149
+ * or, outside one, under the span `requestCtx` fell back to. Only what was set
2150
+ * before the span started is copied, and a key the span already carries keeps
2151
+ * its own value.
2152
+ */
2153
+ var RequestAttributesSpanProcessor = class {
2154
+ onStart(span, parentContext) {
2155
+ const parent = trace.getSpan(parentContext);
2156
+ if (parent) scopeFor(span).parent = scopeFor(parent);
2157
+ const attrs = sourceOf(parentContext);
2158
+ if (!attrs) return;
2159
+ const own = span.attributes;
2160
+ for (const [key, value] of Object.entries(attrs)) if (value !== void 0 && !(key in own)) span.setAttribute(key, value);
2161
+ }
2162
+ onEnd() {}
2163
+ forceFlush() {
2164
+ return Promise.resolve();
2165
+ }
2166
+ shutdown() {
2167
+ return Promise.resolve();
2168
+ }
2169
+ };
2170
+
2100
2171
  //#endregion
2101
2172
  //#region src/redact-values.ts
2102
2173
  /** Standalone string redaction for use outside the span processor pipeline. */
@@ -2329,7 +2400,7 @@ function substituteEnvVars(value) {
2329
2400
  * @returns Object with all string values having env vars substituted
2330
2401
  */
2331
2402
  function substituteEnvVarsDeep(value) {
2332
- if (Array.isArray(value)) return value.map(substituteEnvVarsDeep);
2403
+ if (Array.isArray(value)) return value.map((item) => substituteEnvVarsDeep(item));
2333
2404
  const mapping = asYamlMapping(value);
2334
2405
  if (mapping) {
2335
2406
  const result = {};
@@ -2561,7 +2632,7 @@ const DEFAULT_SHUTDOWN_TIMEOUT_MS = 2e3;
2561
2632
  function runShutdownOnce(shutdown, timeoutMs) {
2562
2633
  if (shutdownInFlight) return shutdownInFlight;
2563
2634
  let timeoutHandle;
2564
- const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() => void 0);
2635
+ const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() => {});
2565
2636
  const timeout = new Promise((resolve) => {
2566
2637
  timeoutHandle = setTimeout(resolve, timeoutMs);
2567
2638
  timeoutHandle.unref();
@@ -2573,7 +2644,7 @@ function runShutdownOnce(shutdown, timeoutMs) {
2573
2644
  }
2574
2645
  const DEFAULT_SIGNALS = ["SIGTERM", "SIGINT"];
2575
2646
  function signalExitCode(signal) {
2576
- return 128 + constants.signals[signal];
2647
+ return 128 + os.constants.signals[signal];
2577
2648
  }
2578
2649
  /**
2579
2650
  * Surface a fatal error before shutting down.
@@ -2654,7 +2725,7 @@ function installExitFlush(flushTelemetry, timeoutMs = DEFAULT_SHUTDOWN_TIMEOUT_M
2654
2725
  const deadline = setTimeout(() => {
2655
2726
  process.exit(process.exitCode ?? code);
2656
2727
  }, timeoutMs);
2657
- exitFlushInFlight = flushTelemetry().catch(() => void 0).finally(() => {
2728
+ exitFlushInFlight = flushTelemetry().catch(() => {}).finally(() => {
2658
2729
  clearTimeout(deadline);
2659
2730
  });
2660
2731
  };
@@ -2672,6 +2743,91 @@ function uninstallProcessHandlers() {
2672
2743
  exitFlushInFlight = void 0;
2673
2744
  }
2674
2745
 
2746
+ //#endregion
2747
+ //#region src/console-signals.ts
2748
+ /**
2749
+ * Console-derived error signals, recorded on the active span.
2750
+ *
2751
+ * - `console.error(...)` inside a span records an exception on that span
2752
+ * without touching its status: the code handled the error, but it still
2753
+ * belongs to the request's issue list.
2754
+ * - One log template repeated past a threshold within one trace (logging
2755
+ * inside a loop) records a single `autotel.LogFlood` exception.
2756
+ *
2757
+ * Listens on Node's `console.*` diagnostics channels, so `console` is never
2758
+ * patched and the original output is untouched. Installed once by `init()`.
2759
+ * Mirrors `autotel-edge/src/core/console-signals.ts`, which patches `console`
2760
+ * because edge runtimes have no such channel.
2761
+ */
2762
+ /** `exception.type` of the logging-in-a-loop signal. */
2763
+ const LOG_FLOOD_EXCEPTION = "autotel.LogFlood";
2764
+ const MAX_MESSAGE_LENGTH = 500;
2765
+ const MAX_TEMPLATE_LENGTH = 120;
2766
+ const MAX_INVOCATIONS = 256;
2767
+ const MAX_TEMPLATES = 256;
2768
+ const LEVELS = [
2769
+ "log",
2770
+ "info",
2771
+ "warn",
2772
+ "error",
2773
+ "debug"
2774
+ ];
2775
+ const invocations = /* @__PURE__ */ new Map();
2776
+ let options = {
2777
+ captureConsoleErrors: true,
2778
+ logFloodThreshold: 100
2779
+ };
2780
+ let installed = false;
2781
+ let busy = false;
2782
+ const nodeUtil = safeRequire("node:util");
2783
+ /** Collapse ids and numbers so one loop's lines share a template. */
2784
+ function logTemplate(args) {
2785
+ return args.map((arg) => typeof arg === "string" ? arg.slice(0, 200) : arg instanceof Error ? arg.name : `<${typeof arg}>`).join(" ").replaceAll(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, "<uuid>").replaceAll(/\b(?=[0-9a-f]*\d)[0-9a-f]{8,}\b/gi, "<hex>").replaceAll(/\d+/g, "<n>");
2786
+ }
2787
+ function countLogLine(key, template, threshold) {
2788
+ let templates = invocations.get(key);
2789
+ if (!templates) {
2790
+ if (invocations.size >= MAX_INVOCATIONS) invocations.delete(invocations.keys().next().value);
2791
+ templates = /* @__PURE__ */ new Map();
2792
+ invocations.set(key, templates);
2793
+ }
2794
+ const count = (templates.get(template) ?? 0) + 1;
2795
+ if (count > 1 || templates.size < MAX_TEMPLATES) templates.set(template, count);
2796
+ return count === threshold + 1;
2797
+ }
2798
+ function onConsole(level, args) {
2799
+ if (busy) return;
2800
+ if (typeof args[0] === "string" && args[0].startsWith("[autotel")) return;
2801
+ const captureError = level === "error" && options.captureConsoleErrors;
2802
+ const threshold = options.logFloodThreshold;
2803
+ if (!captureError && threshold <= 0) return;
2804
+ const span = trace.getActiveSpan();
2805
+ if (!span?.isRecording()) return;
2806
+ busy = true;
2807
+ try {
2808
+ if (captureError) span.recordException(args.find((a) => a instanceof Error) ?? (nodeUtil?.format(...args) ?? args.join(" ")).slice(0, MAX_MESSAGE_LENGTH));
2809
+ if (threshold > 0) {
2810
+ const template = logTemplate(args);
2811
+ if (countLogLine(span.spanContext().traceId, template, threshold)) span.recordException({
2812
+ name: LOG_FLOOD_EXCEPTION,
2813
+ message: `"${template.slice(0, MAX_TEMPLATE_LENGTH)}" logged ${threshold}+ times in one invocation`
2814
+ });
2815
+ }
2816
+ } catch {} finally {
2817
+ busy = false;
2818
+ }
2819
+ }
2820
+ /** Subscribe once; later calls only update the options. */
2821
+ function installConsoleSignals(next = {}) {
2822
+ options = {
2823
+ captureConsoleErrors: next.captureConsoleErrors ?? true,
2824
+ logFloodThreshold: next.logFloodThreshold ?? 100
2825
+ };
2826
+ if (installed) return;
2827
+ installed = true;
2828
+ for (const level of LEVELS) subscribeChannel(`console.${level}`, (message) => onConsole(level, Array.isArray(message) ? message : message?.args ?? []));
2829
+ }
2830
+
2675
2831
  //#endregion
2676
2832
  //#region src/circuit-breaker.ts
2677
2833
  const DEFAULT_CONFIG = {
@@ -4246,7 +4402,7 @@ function init(cfg) {
4246
4402
  if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
4247
4403
  if (mergedConfig.resourceAttributes) resource = resource.merge(resourceFromAttributes(mergedConfig.resourceAttributes));
4248
4404
  const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
4249
- const configuredSpanProcessors = mergedConfig.spanProcessors !== void 0 ? mergedConfig.spanProcessors : mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0;
4405
+ const configuredSpanProcessors = mergedConfig.spanProcessors === void 0 ? mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0 : mergedConfig.spanProcessors;
4250
4406
  const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
4251
4407
  const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
4252
4408
  const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
@@ -4298,6 +4454,7 @@ function init(cfg) {
4298
4454
  mergedConfig.spanFilter = userSpanFilter ? (span) => userSpanFilter(span) && policySpanFilter(span) : policySpanFilter;
4299
4455
  }
4300
4456
  if (mergedConfig.spanFilter && spanProcessors.length > 0) spanProcessors = spanProcessors.map((processor) => new FilteringSpanProcessor(processor, { filter: mergedConfig.spanFilter }));
4457
+ if (spanProcessors.length > 0) spanProcessors.unshift(new RequestAttributesSpanProcessor());
4301
4458
  if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors.unshift(...mergedConfig.spanEnrichers);
4302
4459
  const metricReaders = [];
4303
4460
  if (configuredMetricReaders && configuredMetricReaders.length > 0) metricReaders.push(...configuredMetricReaders);
@@ -4359,9 +4516,9 @@ function init(cfg) {
4359
4516
  resource,
4360
4517
  serviceName: mergedConfig.service,
4361
4518
  sampler,
4362
- instrumentations: finalInstrumentations
4519
+ instrumentations: finalInstrumentations,
4520
+ spanProcessors: spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()]
4363
4521
  };
4364
- sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
4365
4522
  if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
4366
4523
  if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
4367
4524
  else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
@@ -4382,6 +4539,10 @@ function init(cfg) {
4382
4539
  } else logger.warn({}, "[autotel] OpenLLMetry enabled but @traceloop/node-server-sdk is not installed. Install it as a peer dependency to use OpenLLMetry integration.");
4383
4540
  }
4384
4541
  initialized = true;
4542
+ installConsoleSignals({
4543
+ captureConsoleErrors: mergedConfig.captureConsoleErrors,
4544
+ logFloodThreshold: mergedConfig.logFloodThreshold
4545
+ });
4385
4546
  const processHandlers = mergedConfig.processHandlers;
4386
4547
  const handlersConfig = processHandlers && processHandlers !== true ? processHandlers : {};
4387
4548
  if (processHandlers) installProcessHandlers(handlersConfig, shutdown);
@@ -4462,4 +4623,4 @@ function getSdk() {
4462
4623
  }
4463
4624
 
4464
4625
  //#endregion
4465
- export { getCorrelationStorage as $, FeatureFlagSampler as A, markForceKept as B, AUTOTEL_SAMPLING_RATE as C, AlwaysSampler as D, AdaptiveSampler as E, createLinkFromHeaders as F, getActiveContextWithBaggage as G, samplingPresets as H, debugCaptureRequested as I, getEventQueue as J, getContextStorage as K, extractLinksFromBatch as L, NeverSampler as M, RandomSampler as N, CompositeSampler as O, UserIdSampler as P, getCorrelationId as Q, hashUnitInterval as R, AUTOTEL_DEBUG_BAGGAGE_KEY as S, AUTOTEL_SAMPLING_TAIL_KEEP as T, createTraceContext as U, resolveSamplingPreset as V, defineBaggageSchema as W, CORRELATION_ID_BAGGAGE_KEY as X, track as Y, generateCorrelationId as Z, loadYamlConfig as _, init as a, BaggageSpanProcessor as b, lockLogger as c, Event as d, getOrCreateCorrelationId as et, getEvents as f, hasYamlConfig as g, runInOperationContext as h, getSdk as i, KeyTargetRateSampler as j, DeterministicSampler as k, flush as l, getOperationContext as m, getConfiguredSampler as n, setCorrelationId as nt, isInitialized as o, resetEvents as p, hasExplicitSpanStatus as q, getLogger as r, setCorrelationIdInBaggage as rt, isLoggerLocked as s, getConfig as t, runWithCorrelationId as tt, shutdown as u, loadYamlConfigFromFile as v, AUTOTEL_SAMPLING_TAIL_EVALUATED as w, TailSamplingSpanProcessor as x, createStringRedactor as y, isForceKept as z };
4626
+ export { generateCorrelationId as $, CompositeSampler as A, hashUnitInterval as B, TailSamplingSpanProcessor as C, AUTOTEL_SAMPLING_TAIL_KEEP as D, AUTOTEL_SAMPLING_TAIL_EVALUATED as E, RandomSampler as F, createTraceContext as G, markForceKept as H, UserIdSampler as I, getContextStorage as J, defineBaggageSchema as K, createLinkFromHeaders as L, FeatureFlagSampler as M, KeyTargetRateSampler as N, AdaptiveSampler as O, NeverSampler as P, CORRELATION_ID_BAGGAGE_KEY as Q, debugCaptureRequested as R, BaggageSpanProcessor as S, AUTOTEL_SAMPLING_RATE as T, resolveSamplingPreset as U, isForceKept as V, samplingPresets as W, getEventQueue as X, hasExplicitSpanStatus as Y, track as Z, loadYamlConfig as _, init as a, setCorrelationIdInBaggage as at, getRequestSpanIn as b, lockLogger as c, Event as d, getCorrelationId as et, getEvents as f, hasYamlConfig as g, runInOperationContext as h, getSdk as i, setCorrelationId as it, DeterministicSampler as j, AlwaysSampler as k, flush as l, getOperationContext as m, getConfiguredSampler as n, getOrCreateCorrelationId as nt, isInitialized as o, resetEvents as p, getActiveContextWithBaggage as q, getLogger as r, runWithCorrelationId as rt, isLoggerLocked as s, getConfig as t, getCorrelationStorage as tt, shutdown as u, loadYamlConfigFromFile as v, AUTOTEL_DEBUG_BAGGAGE_KEY as w, rememberRequestAttributes as x, createStringRedactor as y, extractLinksFromBatch as z };
@@ -10,6 +10,7 @@ const require_span_name_normalizer = require('./span-name-normalizer.cjs');
10
10
  const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
11
11
  const require_pretty_console_exporter = require('./pretty-console-exporter-CMzlrRNg.cjs');
12
12
  const require_canonical_log_line_processor = require('./canonical-log-line-processor-BU03jJeA.cjs');
13
+ const require_channel = require('./channel-D0eaVqn3.cjs');
13
14
  const require_metric = require('./metric.cjs');
14
15
  let _opentelemetry_api = require("@opentelemetry/api");
15
16
  let _opentelemetry_api_logs = require("@opentelemetry/api-logs");
@@ -29,6 +30,7 @@ node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
29
30
  let node_path = require("node:path");
30
31
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
31
32
  let node_os = require("node:os");
33
+ node_os = require_rolldown_runtime.__toESM(node_os, 1);
32
34
  let _opentelemetry_exporter_metrics_otlp_http = require("@opentelemetry/exporter-metrics-otlp-http");
33
35
  let _opentelemetry_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
34
36
 
@@ -2101,6 +2103,76 @@ var BaggageSpanProcessor = class {
2101
2103
  async forceFlush() {}
2102
2104
  };
2103
2105
 
2106
+ //#endregion
2107
+ //#region src/request-attributes.ts
2108
+ /**
2109
+ * Attributes set through `requestCtx` describe the whole request, so every
2110
+ * span started inside that request carries them too - not only the request
2111
+ * span. This stays in-process: nothing rides baggage, so a `user.email` set in
2112
+ * auth middleware never leaves in a `baggage` header on an outgoing call.
2113
+ */
2114
+ /**
2115
+ * The key `@opentelemetry/core` publishes RPC metadata under. `createContextKey`
2116
+ * is `Symbol.for`, so this reads exactly what `instrumentation-http` (and every
2117
+ * framework instrumentation that renames the route) wrote, without taking a
2118
+ * dependency on core.
2119
+ */
2120
+ const RPC_METADATA_KEY = (0, _opentelemetry_api.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA");
2121
+ /** The server span of the request `ctx` belongs to, if it belongs to one. */
2122
+ function getRequestSpanIn(ctx = _opentelemetry_api.context.active()) {
2123
+ const requestSpan = require_values.readProperty(ctx.getValue(RPC_METADATA_KEY), "span");
2124
+ return require_values.isFunction(require_values.readProperty(requestSpan, "spanContext")) ? requestSpan : void 0;
2125
+ }
2126
+ const scopes = /* @__PURE__ */ new WeakMap();
2127
+ function scopeFor(span) {
2128
+ let scope = scopes.get(span);
2129
+ if (!scope) {
2130
+ scope = { attributes: {} };
2131
+ scopes.set(span, scope);
2132
+ }
2133
+ return scope;
2134
+ }
2135
+ /**
2136
+ * The request span's attributes, or else every ancestor `requestCtx` wrote to,
2137
+ * merged so the nearer one wins a key: a job span tagging `job.id` under a
2138
+ * consumer that tagged `tenant` must not hide the tenant from its children.
2139
+ */
2140
+ function sourceOf(parentContext) {
2141
+ const requestSpan = getRequestSpanIn(parentContext);
2142
+ if (requestSpan) return scopes.get(requestSpan)?.attributes;
2143
+ const nearestFirst = [];
2144
+ const parent = _opentelemetry_api.trace.getSpan(parentContext);
2145
+ for (let scope = parent && scopes.get(parent); scope; scope = scope.parent) nearestFirst.push(scope.attributes);
2146
+ return nearestFirst.length > 0 ? Object.assign({}, ...nearestFirst.toReversed()) : void 0;
2147
+ }
2148
+ /** Remember attributes set through `requestCtx`, for the spans started under it. */
2149
+ function rememberRequestAttributes(span, attrs) {
2150
+ Object.assign(scopeFor(span).attributes, attrs);
2151
+ }
2152
+ /**
2153
+ * Copies `requestCtx` attributes onto each span started inside the request -
2154
+ * or, outside one, under the span `requestCtx` fell back to. Only what was set
2155
+ * before the span started is copied, and a key the span already carries keeps
2156
+ * its own value.
2157
+ */
2158
+ var RequestAttributesSpanProcessor = class {
2159
+ onStart(span, parentContext) {
2160
+ const parent = _opentelemetry_api.trace.getSpan(parentContext);
2161
+ if (parent) scopeFor(span).parent = scopeFor(parent);
2162
+ const attrs = sourceOf(parentContext);
2163
+ if (!attrs) return;
2164
+ const own = span.attributes;
2165
+ for (const [key, value] of Object.entries(attrs)) if (value !== void 0 && !(key in own)) span.setAttribute(key, value);
2166
+ }
2167
+ onEnd() {}
2168
+ forceFlush() {
2169
+ return Promise.resolve();
2170
+ }
2171
+ shutdown() {
2172
+ return Promise.resolve();
2173
+ }
2174
+ };
2175
+
2104
2176
  //#endregion
2105
2177
  //#region src/redact-values.ts
2106
2178
  /** Standalone string redaction for use outside the span processor pipeline. */
@@ -2333,7 +2405,7 @@ function substituteEnvVars(value) {
2333
2405
  * @returns Object with all string values having env vars substituted
2334
2406
  */
2335
2407
  function substituteEnvVarsDeep(value) {
2336
- if (Array.isArray(value)) return value.map(substituteEnvVarsDeep);
2408
+ if (Array.isArray(value)) return value.map((item) => substituteEnvVarsDeep(item));
2337
2409
  const mapping = asYamlMapping(value);
2338
2410
  if (mapping) {
2339
2411
  const result = {};
@@ -2565,7 +2637,7 @@ const DEFAULT_SHUTDOWN_TIMEOUT_MS = 2e3;
2565
2637
  function runShutdownOnce(shutdown, timeoutMs) {
2566
2638
  if (shutdownInFlight) return shutdownInFlight;
2567
2639
  let timeoutHandle;
2568
- const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() => void 0);
2640
+ const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() => {});
2569
2641
  const timeout = new Promise((resolve) => {
2570
2642
  timeoutHandle = setTimeout(resolve, timeoutMs);
2571
2643
  timeoutHandle.unref();
@@ -2658,7 +2730,7 @@ function installExitFlush(flushTelemetry, timeoutMs = DEFAULT_SHUTDOWN_TIMEOUT_M
2658
2730
  const deadline = setTimeout(() => {
2659
2731
  process.exit(process.exitCode ?? code);
2660
2732
  }, timeoutMs);
2661
- exitFlushInFlight = flushTelemetry().catch(() => void 0).finally(() => {
2733
+ exitFlushInFlight = flushTelemetry().catch(() => {}).finally(() => {
2662
2734
  clearTimeout(deadline);
2663
2735
  });
2664
2736
  };
@@ -2676,6 +2748,91 @@ function uninstallProcessHandlers() {
2676
2748
  exitFlushInFlight = void 0;
2677
2749
  }
2678
2750
 
2751
+ //#endregion
2752
+ //#region src/console-signals.ts
2753
+ /**
2754
+ * Console-derived error signals, recorded on the active span.
2755
+ *
2756
+ * - `console.error(...)` inside a span records an exception on that span
2757
+ * without touching its status: the code handled the error, but it still
2758
+ * belongs to the request's issue list.
2759
+ * - One log template repeated past a threshold within one trace (logging
2760
+ * inside a loop) records a single `autotel.LogFlood` exception.
2761
+ *
2762
+ * Listens on Node's `console.*` diagnostics channels, so `console` is never
2763
+ * patched and the original output is untouched. Installed once by `init()`.
2764
+ * Mirrors `autotel-edge/src/core/console-signals.ts`, which patches `console`
2765
+ * because edge runtimes have no such channel.
2766
+ */
2767
+ /** `exception.type` of the logging-in-a-loop signal. */
2768
+ const LOG_FLOOD_EXCEPTION = "autotel.LogFlood";
2769
+ const MAX_MESSAGE_LENGTH = 500;
2770
+ const MAX_TEMPLATE_LENGTH = 120;
2771
+ const MAX_INVOCATIONS = 256;
2772
+ const MAX_TEMPLATES = 256;
2773
+ const LEVELS = [
2774
+ "log",
2775
+ "info",
2776
+ "warn",
2777
+ "error",
2778
+ "debug"
2779
+ ];
2780
+ const invocations = /* @__PURE__ */ new Map();
2781
+ let options = {
2782
+ captureConsoleErrors: true,
2783
+ logFloodThreshold: 100
2784
+ };
2785
+ let installed = false;
2786
+ let busy = false;
2787
+ const nodeUtil = require_node_require.safeRequire("node:util");
2788
+ /** Collapse ids and numbers so one loop's lines share a template. */
2789
+ function logTemplate(args) {
2790
+ return args.map((arg) => typeof arg === "string" ? arg.slice(0, 200) : arg instanceof Error ? arg.name : `<${typeof arg}>`).join(" ").replaceAll(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, "<uuid>").replaceAll(/\b(?=[0-9a-f]*\d)[0-9a-f]{8,}\b/gi, "<hex>").replaceAll(/\d+/g, "<n>");
2791
+ }
2792
+ function countLogLine(key, template, threshold) {
2793
+ let templates = invocations.get(key);
2794
+ if (!templates) {
2795
+ if (invocations.size >= MAX_INVOCATIONS) invocations.delete(invocations.keys().next().value);
2796
+ templates = /* @__PURE__ */ new Map();
2797
+ invocations.set(key, templates);
2798
+ }
2799
+ const count = (templates.get(template) ?? 0) + 1;
2800
+ if (count > 1 || templates.size < MAX_TEMPLATES) templates.set(template, count);
2801
+ return count === threshold + 1;
2802
+ }
2803
+ function onConsole(level, args) {
2804
+ if (busy) return;
2805
+ if (typeof args[0] === "string" && args[0].startsWith("[autotel")) return;
2806
+ const captureError = level === "error" && options.captureConsoleErrors;
2807
+ const threshold = options.logFloodThreshold;
2808
+ if (!captureError && threshold <= 0) return;
2809
+ const span = _opentelemetry_api.trace.getActiveSpan();
2810
+ if (!span?.isRecording()) return;
2811
+ busy = true;
2812
+ try {
2813
+ if (captureError) span.recordException(args.find((a) => a instanceof Error) ?? (nodeUtil?.format(...args) ?? args.join(" ")).slice(0, MAX_MESSAGE_LENGTH));
2814
+ if (threshold > 0) {
2815
+ const template = logTemplate(args);
2816
+ if (countLogLine(span.spanContext().traceId, template, threshold)) span.recordException({
2817
+ name: LOG_FLOOD_EXCEPTION,
2818
+ message: `"${template.slice(0, MAX_TEMPLATE_LENGTH)}" logged ${threshold}+ times in one invocation`
2819
+ });
2820
+ }
2821
+ } catch {} finally {
2822
+ busy = false;
2823
+ }
2824
+ }
2825
+ /** Subscribe once; later calls only update the options. */
2826
+ function installConsoleSignals(next = {}) {
2827
+ options = {
2828
+ captureConsoleErrors: next.captureConsoleErrors ?? true,
2829
+ logFloodThreshold: next.logFloodThreshold ?? 100
2830
+ };
2831
+ if (installed) return;
2832
+ installed = true;
2833
+ for (const level of LEVELS) require_channel.subscribeChannel(`console.${level}`, (message) => onConsole(level, Array.isArray(message) ? message : message?.args ?? []));
2834
+ }
2835
+
2679
2836
  //#endregion
2680
2837
  //#region src/circuit-breaker.ts
2681
2838
  const DEFAULT_CONFIG = {
@@ -4250,7 +4407,7 @@ function init(cfg) {
4250
4407
  if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
4251
4408
  if (mergedConfig.resourceAttributes) resource = resource.merge((0, _opentelemetry_resources.resourceFromAttributes)(mergedConfig.resourceAttributes));
4252
4409
  const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
4253
- const configuredSpanProcessors = mergedConfig.spanProcessors !== void 0 ? mergedConfig.spanProcessors : mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0;
4410
+ const configuredSpanProcessors = mergedConfig.spanProcessors === void 0 ? mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0 : mergedConfig.spanProcessors;
4254
4411
  const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
4255
4412
  const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
4256
4413
  const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
@@ -4302,6 +4459,7 @@ function init(cfg) {
4302
4459
  mergedConfig.spanFilter = userSpanFilter ? (span) => userSpanFilter(span) && require_policy.policySpanFilter(span) : require_policy.policySpanFilter;
4303
4460
  }
4304
4461
  if (mergedConfig.spanFilter && spanProcessors.length > 0) spanProcessors = spanProcessors.map((processor) => new require_filtering_span_processor.FilteringSpanProcessor(processor, { filter: mergedConfig.spanFilter }));
4462
+ if (spanProcessors.length > 0) spanProcessors.unshift(new RequestAttributesSpanProcessor());
4305
4463
  if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors.unshift(...mergedConfig.spanEnrichers);
4306
4464
  const metricReaders = [];
4307
4465
  if (configuredMetricReaders && configuredMetricReaders.length > 0) metricReaders.push(...configuredMetricReaders);
@@ -4363,9 +4521,9 @@ function init(cfg) {
4363
4521
  resource,
4364
4522
  serviceName: mergedConfig.service,
4365
4523
  sampler,
4366
- instrumentations: finalInstrumentations
4524
+ instrumentations: finalInstrumentations,
4525
+ spanProcessors: spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()]
4367
4526
  };
4368
- sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
4369
4527
  if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
4370
4528
  if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
4371
4529
  else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
@@ -4386,6 +4544,10 @@ function init(cfg) {
4386
4544
  } else logger.warn({}, "[autotel] OpenLLMetry enabled but @traceloop/node-server-sdk is not installed. Install it as a peer dependency to use OpenLLMetry integration.");
4387
4545
  }
4388
4546
  initialized = true;
4547
+ installConsoleSignals({
4548
+ captureConsoleErrors: mergedConfig.captureConsoleErrors,
4549
+ logFloodThreshold: mergedConfig.logFloodThreshold
4550
+ });
4389
4551
  const processHandlers = mergedConfig.processHandlers;
4390
4552
  const handlersConfig = processHandlers && processHandlers !== true ? processHandlers : {};
4391
4553
  if (processHandlers) installProcessHandlers(handlersConfig, shutdown);
@@ -4682,6 +4844,12 @@ Object.defineProperty(exports, 'getOrCreateCorrelationId', {
4682
4844
  return getOrCreateCorrelationId;
4683
4845
  }
4684
4846
  });
4847
+ Object.defineProperty(exports, 'getRequestSpanIn', {
4848
+ enumerable: true,
4849
+ get: function () {
4850
+ return getRequestSpanIn;
4851
+ }
4852
+ });
4685
4853
  Object.defineProperty(exports, 'getSdk', {
4686
4854
  enumerable: true,
4687
4855
  get: function () {
@@ -4754,6 +4922,12 @@ Object.defineProperty(exports, 'markForceKept', {
4754
4922
  return markForceKept;
4755
4923
  }
4756
4924
  });
4925
+ Object.defineProperty(exports, 'rememberRequestAttributes', {
4926
+ enumerable: true,
4927
+ get: function () {
4928
+ return rememberRequestAttributes;
4929
+ }
4930
+ });
4757
4931
  Object.defineProperty(exports, 'resetEvents', {
4758
4932
  enumerable: true,
4759
4933
  get: function () {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-21HWbm7_.cjs');
2
+ const require_init = require('./init-zb68UvOW.cjs');
3
3
  const require_node_require = require('./node-require-BPsB09eC.cjs');
4
4
  let _opentelemetry_resources = require("@opentelemetry/resources");
5
5
  let _opentelemetry_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
@@ -1,6 +1,6 @@
1
1
  import { NodeSDK } from "@opentelemetry/sdk-node";
2
2
  //#region src/instrumentation.d.ts
3
- interface InstrumentationConfig {
3
+ export interface InstrumentationConfig {
4
4
  serviceName: string;
5
5
  serviceVersion?: string;
6
6
  deploymentEnvironment?: string;
@@ -43,7 +43,6 @@ interface InstrumentationConfig {
43
43
  * Shutdown the OpenTelemetry SDK gracefully
44
44
  * Call this before process exit or during hot-reloads
45
45
  */
46
- declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
47
- declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
48
- //#endregion
49
- export { InstrumentationConfig, initInstrumentation, shutdownInstrumentation };
46
+ export declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
47
+ export declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
48
+ //#endregion
@@ -1,6 +1,6 @@
1
1
  import { NodeSDK } from "@opentelemetry/sdk-node";
2
2
  //#region src/instrumentation.d.ts
3
- interface InstrumentationConfig {
3
+ export interface InstrumentationConfig {
4
4
  serviceName: string;
5
5
  serviceVersion?: string;
6
6
  deploymentEnvironment?: string;
@@ -43,7 +43,6 @@ interface InstrumentationConfig {
43
43
  * Shutdown the OpenTelemetry SDK gracefully
44
44
  * Call this before process exit or during hot-reloads
45
45
  */
46
- declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
47
- declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
48
- //#endregion
49
- export { InstrumentationConfig, initInstrumentation, shutdownInstrumentation };
46
+ export declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
47
+ export declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
48
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { r as getLogger, x as TailSamplingSpanProcessor } from "./init-8SISAGdE.js";
1
+ import { C as TailSamplingSpanProcessor, r as getLogger } from "./init-rVPOUqng.js";
2
2
  import { n as safeRequire, t as requireModule } from "./node-require-CkK_xzL-.js";
3
3
  import { detectResources, hostDetector, processDetector, resourceFromAttributes } from "@opentelemetry/resources";
4
4
  import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
@@ -192,10 +192,10 @@ declare function autotelLogger(options?: {
192
192
  * Log level constants
193
193
  */
194
194
  declare const LOG_LEVEL: {
195
- readonly DEBUG: "debug";
196
- readonly INFO: "info";
197
- readonly WARN: "warn";
198
- readonly ERROR: "error";
195
+ readonly DEBUG: 'debug';
196
+ readonly INFO: 'info';
197
+ readonly WARN: 'warn';
198
+ readonly ERROR: 'error';
199
199
  };
200
200
  type LogLevel = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL];
201
201
  /**