autotel 8.0.0 → 8.2.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 (103) hide show
  1. package/dist/{attribute-redacting-processor-rkV_WL-k.d.ts → attribute-redacting-processor-BrrdojmP.d.ts} +5 -1
  2. package/dist/{attribute-redacting-processor-CvBE0z1p.d.cts → attribute-redacting-processor-Cq7K8Okp.d.cts} +5 -1
  3. package/dist/attribute-redacting-processor.cjs +18 -8
  4. package/dist/attribute-redacting-processor.d.cts +1 -1
  5. package/dist/attribute-redacting-processor.d.ts +1 -1
  6. package/dist/attribute-redacting-processor.js +18 -8
  7. package/dist/{attributes-Ii3jDPsW.cjs → attributes-BqgJl9qA.cjs} +1 -1
  8. package/dist/{attributes-CuGx6cOI.js → attributes-BtwTkuX7.js} +1 -1
  9. package/dist/attributes.cjs +1 -1
  10. package/dist/attributes.js +1 -1
  11. package/dist/auto.cjs +1 -1
  12. package/dist/auto.js +1 -1
  13. package/dist/business-baggage.cjs +1 -1
  14. package/dist/business-baggage.js +1 -1
  15. package/dist/{canonical-log-line-processor-CBRe-VsO.cjs → canonical-log-line-processor-DScNq1g8.cjs} +1 -1
  16. package/dist/{canonical-log-line-processor-CntKMtpJ.js → canonical-log-line-processor-naZRETyk.js} +1 -1
  17. package/dist/{channel-D0eaVqn3.cjs → channel-3MV-4Aqv.cjs} +1 -1
  18. package/dist/{channel-BobQKsZd.js → channel-BNFp4Sfq.js} +1 -1
  19. package/dist/{correlated-events-BfpH5uS-.js → correlated-events-CZFe6Z1P.js} +1 -1
  20. package/dist/{correlated-events-DE_4A3oD.cjs → correlated-events-wCrXVUby.cjs} +1 -1
  21. package/dist/correlation-id.cjs +1 -1
  22. package/dist/correlation-id.js +1 -1
  23. package/dist/db.cjs +1 -1
  24. package/dist/db.js +1 -1
  25. package/dist/decorators.cjs +2 -2
  26. package/dist/decorators.d.cts +1 -1
  27. package/dist/decorators.d.ts +1 -1
  28. package/dist/decorators.js +2 -2
  29. package/dist/diagnostics.cjs +3 -3
  30. package/dist/diagnostics.js +3 -3
  31. package/dist/event.cjs +1 -1
  32. package/dist/event.js +1 -1
  33. package/dist/exception-fingerprint.cjs +1 -1
  34. package/dist/exception-fingerprint.js +1 -1
  35. package/dist/{functional-BliCZgwO.cjs → functional-BIK5_ciY.cjs} +8 -6
  36. package/dist/{functional-DDunG47Y.d.cts → functional-CN_cqIX8.d.cts} +8 -1
  37. package/dist/{functional-DU7NXyih.d.ts → functional-IGZ-Urlq.d.ts} +8 -1
  38. package/dist/{functional-C-D0KQg6.js → functional-LPlEzBg-.js} +9 -7
  39. package/dist/functional.cjs +1 -1
  40. package/dist/functional.d.cts +1 -1
  41. package/dist/functional.d.ts +1 -1
  42. package/dist/functional.js +1 -1
  43. package/dist/http.cjs +2 -2
  44. package/dist/http.js +2 -2
  45. package/dist/index.cjs +9 -8
  46. package/dist/index.d.cts +29 -5
  47. package/dist/index.d.ts +29 -5
  48. package/dist/index.js +9 -9
  49. package/dist/{init-DMjyzzbM.d.ts → init-BYq2sUXg.d.ts} +4 -2
  50. package/dist/{init-DF4YrpSB.cjs → init-DL9jfiIY.cjs} +66 -7
  51. package/dist/{init-CKHEf5g2.js → init-DPoRpz9n.js} +61 -8
  52. package/dist/{init-D5k8hBRg.d.cts → init-axM4kgR4.d.cts} +4 -2
  53. package/dist/instrumentation.cjs +2 -2
  54. package/dist/instrumentation.js +2 -2
  55. package/dist/{logger-8Ah2EkH1.js → logger-4VXLbqWx.js} +1 -1
  56. package/dist/{logger-C_3xDBOz.cjs → logger-CWFxTLtR.cjs} +1 -1
  57. package/dist/logger.cjs +1 -1
  58. package/dist/logger.js +1 -1
  59. package/dist/messaging-adapters.cjs +1 -1
  60. package/dist/messaging-adapters.js +1 -1
  61. package/dist/messaging.cjs +4 -4
  62. package/dist/messaging.js +4 -4
  63. package/dist/{node-require-BPsB09eC.cjs → node-require-BotQNkYw.cjs} +1 -1
  64. package/dist/{node-require-CkK_xzL-.js → node-require-CY0YUdvZ.js} +1 -1
  65. package/dist/parse-error.cjs +1 -1
  66. package/dist/parse-error.js +1 -1
  67. package/dist/policy.cjs +0 -0
  68. package/dist/policy.js +0 -0
  69. package/dist/processors.cjs +1 -1
  70. package/dist/processors.js +1 -1
  71. package/dist/sampling.cjs +1 -1
  72. package/dist/sampling.js +1 -1
  73. package/dist/semantic-helpers.cjs +2 -2
  74. package/dist/semantic-helpers.js +2 -2
  75. package/dist/{stable-hash-sLi1o4jj.cjs → stable-hash-58iP5-N-.cjs} +1 -1
  76. package/dist/{stable-hash-AOUgw1DW.js → stable-hash-DVEU2MqW.js} +1 -1
  77. package/dist/{structured-error-DynjWTTu.cjs → structured-error-Ci8s_M6u.cjs} +6 -6
  78. package/dist/{structured-error-Y9y-1Pae.js → structured-error-UEtlg9Uu.js} +6 -6
  79. package/dist/tail-sampling-processor.cjs +1 -1
  80. package/dist/tail-sampling-processor.js +1 -1
  81. package/dist/test-span-collector.cjs +1 -1
  82. package/dist/test-span-collector.js +1 -1
  83. package/dist/testing.cjs +11 -1
  84. package/dist/testing.js +12 -2
  85. package/dist/trace-helpers.cjs +2 -2
  86. package/dist/trace-helpers.js +2 -2
  87. package/dist/tracer-provider.cjs +1 -1
  88. package/dist/tracer-provider.js +1 -1
  89. package/dist/validate.cjs +3 -3
  90. package/dist/validate.js +3 -3
  91. package/dist/{values-AxGpgYBA.cjs → values-9A6nOyZm.cjs} +69 -3
  92. package/dist/{values-xBtdXtjA.js → values-Dm0yEC5p.js} +58 -4
  93. package/dist/webhook.cjs +3 -3
  94. package/dist/webhook.js +3 -3
  95. package/dist/workflow-distributed.cjs +3 -3
  96. package/dist/workflow-distributed.js +3 -3
  97. package/dist/workflow.cjs +3 -3
  98. package/dist/workflow.js +3 -3
  99. package/dist/yaml-config.cjs +1 -1
  100. package/dist/yaml-config.d.cts +1 -1
  101. package/dist/yaml-config.d.ts +1 -1
  102. package/dist/yaml-config.js +1 -1
  103. package/package.json +1 -1
package/dist/sampling.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-DF4YrpSB.cjs');
2
+ const require_init = require('./init-DL9jfiIY.cjs');
3
3
 
4
4
  exports.AUTOTEL_DEBUG_BAGGAGE_KEY = require_init.AUTOTEL_DEBUG_BAGGAGE_KEY;
5
5
  exports.AUTOTEL_SAMPLING_RATE = require_init.AUTOTEL_SAMPLING_RATE;
package/dist/sampling.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as CompositeSampler, B as hashUnitInterval, D as AUTOTEL_SAMPLING_TAIL_KEEP, E as AUTOTEL_SAMPLING_TAIL_EVALUATED, F as RandomSampler, H as markForceKept, I as UserIdSampler, L as createLinkFromHeaders, M as FeatureFlagSampler, N as KeyTargetRateSampler, O as AdaptiveSampler, P as NeverSampler, R as debugCaptureRequested, T as AUTOTEL_SAMPLING_RATE, U as resolveSamplingPreset, V as isForceKept, W as samplingPresets, j as DeterministicSampler, k as AlwaysSampler, w as AUTOTEL_DEBUG_BAGGAGE_KEY, z as extractLinksFromBatch } from "./init-CKHEf5g2.js";
1
+ import { A as AlwaysSampler, B as extractLinksFromBatch, D as AUTOTEL_SAMPLING_TAIL_EVALUATED, E as AUTOTEL_SAMPLING_RATE, F as NeverSampler, G as samplingPresets, H as isForceKept, I as RandomSampler, L as UserIdSampler, M as DeterministicSampler, N as FeatureFlagSampler, O as AUTOTEL_SAMPLING_TAIL_KEEP, P as KeyTargetRateSampler, R as createLinkFromHeaders, T as AUTOTEL_DEBUG_BAGGAGE_KEY, U as markForceKept, V as hashUnitInterval, W as resolveSamplingPreset, j as CompositeSampler, k as AdaptiveSampler, z as debugCaptureRequested } from "./init-DPoRpz9n.js";
2
2
 
3
3
  export { AUTOTEL_DEBUG_BAGGAGE_KEY, AUTOTEL_SAMPLING_RATE, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, CompositeSampler, DeterministicSampler, FeatureFlagSampler, KeyTargetRateSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, debugCaptureRequested, extractLinksFromBatch, hashUnitInterval, isForceKept, markForceKept, resolveSamplingPreset, samplingPresets };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
3
- const require_functional = require('./functional-BliCZgwO.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
+ const require_functional = require('./functional-BIK5_ciY.cjs');
4
4
  const require_trace_factory_validation = require('./trace-factory-validation-CHU1WcjK.cjs');
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
6
6
 
@@ -1,5 +1,5 @@
1
- import { b as toAttributeValue, g as nonEmptyString, s as asRecord } from "./values-xBtdXtjA.js";
2
- import { l as withTracing } from "./functional-C-D0KQg6.js";
1
+ import { S as toAttributeValue, _ as nonEmptyString, s as asRecord } from "./values-Dm0yEC5p.js";
2
+ import { l as withTracing } from "./functional-LPlEzBg-.js";
3
3
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
4
4
  import { SpanKind } from "@opentelemetry/api";
5
5
 
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.cjs');
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  let node_crypto = require("node:crypto");
4
4
  node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
5
5
 
@@ -1,4 +1,4 @@
1
- import { s as asRecord } from "./values-xBtdXtjA.js";
1
+ import { s as asRecord } from "./values-Dm0yEC5p.js";
2
2
  import * as nodeCrypto from "node:crypto";
3
3
 
4
4
  //#region src/stable-hash.ts
@@ -1,4 +1,4 @@
1
- const require_values = require('./values-AxGpgYBA.cjs');
1
+ const require_values = require('./values-9A6nOyZm.cjs');
2
2
  let _opentelemetry_api = require("@opentelemetry/api");
3
3
 
4
4
  //#region src/flatten-attributes.ts
@@ -11,7 +11,8 @@ const CIRCULAR_REFERENCE = "<circular-reference>";
11
11
  * Convert a value that arrived from outside to an OTel-compatible
12
12
  * AttributeValue. Returns undefined when the value cannot be represented -
13
13
  * which is how flattenToAttributes below learns it has an object to descend
14
- * into rather than a leaf to record.
14
+ * into rather than a leaf to record. An Error is one of those: it flattens to
15
+ * its name, message, stack, cause and fields, not its message alone.
15
16
  *
16
17
  * Total by construction: this runs on whatever an application hands an
17
18
  * attribute setter, so a value that cannot be read is a marker in the
@@ -25,7 +26,6 @@ function toAttributeValue(value) {
25
26
  if (Array.isArray(value)) return toAttributeArray(value);
26
27
  if (value instanceof Set) return toAttributeArray([...value]);
27
28
  if (value instanceof Date) return Number.isNaN(value.getTime()) ? INVALID_DATE : value.toISOString();
28
- if (value instanceof Error) return value.message;
29
29
  } catch {
30
30
  return SERIALIZATION_FAILED;
31
31
  }
@@ -39,7 +39,7 @@ function toAttributeArray(values) {
39
39
  const booleans = values.filter((v) => require_values.asBoolean(v) !== void 0);
40
40
  if (booleans.length === values.length) return booleans.map(Boolean);
41
41
  try {
42
- return JSON.stringify(values);
42
+ return require_values.stringifyWithErrors(values) ?? SERIALIZATION_FAILED;
43
43
  } catch {
44
44
  return SERIALIZATION_FAILED;
45
45
  }
@@ -67,7 +67,7 @@ function flattenToAttributes(fields, prefix = "") {
67
67
  out[nextKey] = attr;
68
68
  continue;
69
69
  }
70
- const nested = require_values.asPlainRecordOrMap(value);
70
+ const nested = value instanceof Error ? require_values.errorToRecord(value) : require_values.asPlainRecordOrMap(value);
71
71
  if (nested !== void 0) {
72
72
  if (seen.has(value)) {
73
73
  out[nextKey] = CIRCULAR_REFERENCE;
@@ -77,7 +77,7 @@ function flattenToAttributes(fields, prefix = "") {
77
77
  flatten(nested, nextKey);
78
78
  continue;
79
79
  }
80
- const json = JSON.stringify(value);
80
+ const json = require_values.stringifyWithErrors(value);
81
81
  if (json !== void 0) out[nextKey] = json;
82
82
  } catch {
83
83
  out[nextKey] = SERIALIZATION_FAILED;
@@ -1,4 +1,4 @@
1
- import { h as isFunction, i as asNumber, l as asString, o as asPlainRecordOrMap, t as asBoolean } from "./values-xBtdXtjA.js";
1
+ import { g as isFunction, i as asNumber, l as asString, o as asPlainRecordOrMap, p as errorToRecord, t as asBoolean, x as stringifyWithErrors } from "./values-Dm0yEC5p.js";
2
2
  import { SpanStatusCode } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/flatten-attributes.ts
@@ -11,7 +11,8 @@ const CIRCULAR_REFERENCE = "<circular-reference>";
11
11
  * Convert a value that arrived from outside to an OTel-compatible
12
12
  * AttributeValue. Returns undefined when the value cannot be represented -
13
13
  * which is how flattenToAttributes below learns it has an object to descend
14
- * into rather than a leaf to record.
14
+ * into rather than a leaf to record. An Error is one of those: it flattens to
15
+ * its name, message, stack, cause and fields, not its message alone.
15
16
  *
16
17
  * Total by construction: this runs on whatever an application hands an
17
18
  * attribute setter, so a value that cannot be read is a marker in the
@@ -25,7 +26,6 @@ function toAttributeValue(value) {
25
26
  if (Array.isArray(value)) return toAttributeArray(value);
26
27
  if (value instanceof Set) return toAttributeArray([...value]);
27
28
  if (value instanceof Date) return Number.isNaN(value.getTime()) ? INVALID_DATE : value.toISOString();
28
- if (value instanceof Error) return value.message;
29
29
  } catch {
30
30
  return SERIALIZATION_FAILED;
31
31
  }
@@ -39,7 +39,7 @@ function toAttributeArray(values) {
39
39
  const booleans = values.filter((v) => asBoolean(v) !== void 0);
40
40
  if (booleans.length === values.length) return booleans.map(Boolean);
41
41
  try {
42
- return JSON.stringify(values);
42
+ return stringifyWithErrors(values) ?? SERIALIZATION_FAILED;
43
43
  } catch {
44
44
  return SERIALIZATION_FAILED;
45
45
  }
@@ -67,7 +67,7 @@ function flattenToAttributes(fields, prefix = "") {
67
67
  out[nextKey] = attr;
68
68
  continue;
69
69
  }
70
- const nested = asPlainRecordOrMap(value);
70
+ const nested = value instanceof Error ? errorToRecord(value) : asPlainRecordOrMap(value);
71
71
  if (nested !== void 0) {
72
72
  if (seen.has(value)) {
73
73
  out[nextKey] = CIRCULAR_REFERENCE;
@@ -77,7 +77,7 @@ function flattenToAttributes(fields, prefix = "") {
77
77
  flatten(nested, nextKey);
78
78
  continue;
79
79
  }
80
- const json = JSON.stringify(value);
80
+ const json = stringifyWithErrors(value);
81
81
  if (json !== void 0) out[nextKey] = json;
82
82
  } catch {
83
83
  out[nextKey] = SERIALIZATION_FAILED;
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-DF4YrpSB.cjs');
2
+ const require_init = require('./init-DL9jfiIY.cjs');
3
3
 
4
4
  exports.TailSamplingSpanProcessor = require_init.TailSamplingSpanProcessor;
@@ -1,3 +1,3 @@
1
- import { C as TailSamplingSpanProcessor } from "./init-CKHEf5g2.js";
1
+ import { w as TailSamplingSpanProcessor } from "./init-DPoRpz9n.js";
2
2
 
3
3
  export { TailSamplingSpanProcessor };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  let _opentelemetry_api = require("@opentelemetry/api");
4
4
 
5
5
  //#region src/test-span-collector.ts
@@ -1,4 +1,4 @@
1
- import { a as asNumberArray, c as asScalar, n as asBooleanArray, u as asStringArray } from "./values-xBtdXtjA.js";
1
+ import { a as asNumberArray, c as asScalar, n as asBooleanArray, u as asStringArray } from "./values-Dm0yEC5p.js";
2
2
  import { SpanStatusCode } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/test-span-collector.ts
package/dist/testing.cjs CHANGED
@@ -1,11 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.cjs');
3
- const require_values = require('./values-AxGpgYBA.cjs');
3
+ const require_values = require('./values-9A6nOyZm.cjs');
4
4
  const require_config = require('./config.cjs');
5
5
  const require_event_testing = require('./event-testing.cjs');
6
6
  const require_test_span_collector = require('./test-span-collector.cjs');
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
  let _opentelemetry_context_async_hooks = require("@opentelemetry/context-async-hooks");
9
+ let _opentelemetry_core = require("@opentelemetry/core");
9
10
  let node_async_hooks = require("node:async_hooks");
10
11
  node_async_hooks = require_rolldown_runtime.__toESM(node_async_hooks, 1);
11
12
 
@@ -76,6 +77,14 @@ function ensureContextManager() {
76
77
  _opentelemetry_api.context.setGlobalContextManager(new _opentelemetry_context_async_hooks.AsyncLocalStorageContextManager().enable());
77
78
  }
78
79
  /**
80
+ * Registers the W3C trace-context and baggage propagator that `init()` would,
81
+ * so `propagation.inject`/`extract` work in tests. Keeps one the test set.
82
+ */
83
+ function ensurePropagator() {
84
+ if (_opentelemetry_api.propagation.fields().length > 0) return;
85
+ _opentelemetry_api.propagation.setGlobalPropagator(new _opentelemetry_core.CompositePropagator({ propagators: [new _opentelemetry_core.W3CTraceContextPropagator(), new _opentelemetry_core.W3CBaggagePropagator()] }));
86
+ }
87
+ /**
79
88
  * Create an in-memory trace collector for testing
80
89
  *
81
90
  * IMPORTANT: This automatically configures the global tracer to record spans.
@@ -103,6 +112,7 @@ function ensureContextManager() {
103
112
  */
104
113
  function createTraceCollector() {
105
114
  ensureContextManager();
115
+ ensurePropagator();
106
116
  const spans = [];
107
117
  const activeMockSpanStorage = new node_async_hooks.AsyncLocalStorage();
108
118
  let nextTraceId = 1;
package/dist/testing.js CHANGED
@@ -1,9 +1,10 @@
1
- import { l as asString, s as asRecord } from "./values-xBtdXtjA.js";
1
+ import { l as asString, s as asRecord } from "./values-Dm0yEC5p.js";
2
2
  import { configure } from "./config.js";
3
3
  import { assertEventTracked, assertOutcomeTracked, createEventCollector } from "./event-testing.js";
4
4
  import { TestSpanCollector, serializeSpan } from "./test-span-collector.js";
5
- import { ROOT_CONTEXT, SpanStatusCode, context, createContextKey, trace } from "@opentelemetry/api";
5
+ import { ROOT_CONTEXT, SpanStatusCode, context, createContextKey, propagation, trace } from "@opentelemetry/api";
6
6
  import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
7
+ import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } from "@opentelemetry/core";
7
8
  import * as nodeAsyncHooks from "node:async_hooks";
8
9
 
9
10
  //#region src/memory-exporter.ts
@@ -73,6 +74,14 @@ function ensureContextManager() {
73
74
  context.setGlobalContextManager(new AsyncLocalStorageContextManager().enable());
74
75
  }
75
76
  /**
77
+ * Registers the W3C trace-context and baggage propagator that `init()` would,
78
+ * so `propagation.inject`/`extract` work in tests. Keeps one the test set.
79
+ */
80
+ function ensurePropagator() {
81
+ if (propagation.fields().length > 0) return;
82
+ propagation.setGlobalPropagator(new CompositePropagator({ propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()] }));
83
+ }
84
+ /**
76
85
  * Create an in-memory trace collector for testing
77
86
  *
78
87
  * IMPORTANT: This automatically configures the global tracer to record spans.
@@ -100,6 +109,7 @@ function ensureContextManager() {
100
109
  */
101
110
  function createTraceCollector() {
102
111
  ensureContextManager();
112
+ ensurePropagator();
103
113
  const spans = [];
104
114
  const activeMockSpanStorage = new nodeAsyncHooks.AsyncLocalStorage();
105
115
  let nextTraceId = 1;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
3
- const require_node_require = require('./node-require-BPsB09eC.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
+ const require_node_require = require('./node-require-BotQNkYw.cjs');
4
4
  let _opentelemetry_api = require("@opentelemetry/api");
5
5
 
6
6
  //#region src/trace-helpers.ts
@@ -1,5 +1,5 @@
1
- import { i as asNumber, l as asString, o as asPlainRecordOrMap, t as asBoolean, x as toError } from "./values-xBtdXtjA.js";
2
- import { t as requireModule } from "./node-require-CkK_xzL-.js";
1
+ import { C as toError, i as asNumber, l as asString, o as asPlainRecordOrMap, t as asBoolean } from "./values-Dm0yEC5p.js";
2
+ import { t as requireModule } from "./node-require-CY0YUdvZ.js";
3
3
  import { SpanStatusCode, context, trace } from "@opentelemetry/api";
4
4
 
5
5
  //#region src/trace-helpers.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  let _opentelemetry_api = require("@opentelemetry/api");
4
4
 
5
5
  //#region src/tracer-provider.ts
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, h as isFunction, r as asFunction } from "./values-xBtdXtjA.js";
1
+ import { g as isFunction, r as asFunction, v as readProperty } from "./values-Dm0yEC5p.js";
2
2
  import { ProxyTracerProvider, trace } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/tracer-provider.ts
package/dist/validate.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
3
- const require_structured_error = require('./structured-error-DynjWTTu.cjs');
4
- const require_stable_hash = require('./stable-hash-sLi1o4jj.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
+ const require_structured_error = require('./structured-error-Ci8s_M6u.cjs');
4
+ const require_stable_hash = require('./stable-hash-58iP5-N-.cjs');
5
5
  const require_metric_helpers = require('./metric-helpers.cjs');
6
6
  const require_validation_attributes = require('./validation-attributes.cjs');
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
package/dist/validate.js CHANGED
@@ -1,6 +1,6 @@
1
- import { l as asString, s as asRecord } from "./values-xBtdXtjA.js";
2
- import { t as createStructuredError } from "./structured-error-Y9y-1Pae.js";
3
- import { t as hashJson } from "./stable-hash-AOUgw1DW.js";
1
+ import { l as asString, s as asRecord } from "./values-Dm0yEC5p.js";
2
+ import { t as createStructuredError } from "./structured-error-UEtlg9Uu.js";
3
+ import { t as hashJson } from "./stable-hash-DVEU2MqW.js";
4
4
  import { createCounter } from "./metric-helpers.js";
5
5
  import { VALIDATION_ATTR, VALIDATION_ISSUE_CAP, VALIDATION_METRICS } from "./validation-attributes.js";
6
6
  import { trace } from "@opentelemetry/api";
@@ -109,6 +109,60 @@ function toError(cause) {
109
109
  return cause instanceof Error ? cause : new Error(String(cause));
110
110
  }
111
111
  /**
112
+ * Fields an HTTP client hangs on its errors (axios, got, fetch wrappers):
113
+ * the request and response, with their headers - Authorization, cookies, API
114
+ * keys. Never copied, whatever they hold.
115
+ */
116
+ const REQUEST_ERROR_KEYS = /* @__PURE__ */ new Set([
117
+ "config",
118
+ "request",
119
+ "response",
120
+ "headers",
121
+ "options"
122
+ ]);
123
+ /**
124
+ * An Error as a record: name, message, stack, its cause (recursively), and the
125
+ * scalar fields the thrower attached (`code`, `status`, `errno`...). JSON
126
+ * writes an Error as `{}`, and its message alone drops the rest.
127
+ *
128
+ * Only scalar fields are copied: an object on an error is usually the request
129
+ * or response that failed, with its credentials, and redaction may be off.
130
+ * `seen` breaks cycles: an error already being written becomes
131
+ * `<circular-reference>`.
132
+ */
133
+ function errorToRecord(error, seen = /* @__PURE__ */ new WeakSet()) {
134
+ seen.add(error);
135
+ const record = {
136
+ name: error.name,
137
+ message: error.message
138
+ };
139
+ if (error.stack) record.stack = error.stack;
140
+ const fields = error;
141
+ for (const key of Object.keys(error)) {
142
+ if (REQUEST_ERROR_KEYS.has(key.toLowerCase())) continue;
143
+ const value = fields[key];
144
+ const scalar = asString(value) ?? asNumber(value) ?? asBoolean(value);
145
+ if (scalar !== void 0) record[key] = scalar;
146
+ }
147
+ const cause = error.cause;
148
+ if (cause instanceof Error) record.cause = seen.has(cause) ? "<circular-reference>" : errorToRecord(cause, seen);
149
+ else {
150
+ const scalar = asString(cause) ?? asNumber(cause) ?? asBoolean(cause);
151
+ if (scalar !== void 0) record.cause = scalar;
152
+ }
153
+ return record;
154
+ }
155
+ /** JSON.stringify, with any Error inside written as its {@link errorToRecord}. */
156
+ function stringifyWithErrors(value) {
157
+ const seen = /* @__PURE__ */ new WeakSet();
158
+ const raw = (holder, key, v) => typeof holder === "object" && holder !== null ? Reflect.get(holder, key) : v;
159
+ return JSON.stringify(value, function(key, v) {
160
+ const original = raw(this, key, v);
161
+ if (!(original instanceof Error)) return v;
162
+ return seen.has(original) ? "<circular-reference>" : errorToRecord(original, seen);
163
+ });
164
+ }
165
+ /**
112
166
  * A value as an OTel attribute, or undefined when it cannot be one.
113
167
  *
114
168
  * OTel accepts scalars and homogeneous arrays of scalars. Anything else - a
@@ -121,8 +175,8 @@ function toAttributeValue(value) {
121
175
  if (scalar !== void 0) return scalar;
122
176
  if (Array.isArray(value)) return toAttributeArray(value);
123
177
  if (value instanceof Set) return toAttributeArray([...value]);
124
- if (value instanceof Map) return JSON.stringify(Object.fromEntries(value));
125
- return JSON.stringify(value);
178
+ if (value instanceof Map) return stringifyWithErrors(Object.fromEntries(value));
179
+ return stringifyWithErrors(value);
126
180
  }
127
181
  /** The scalars in an array, dropping the entries OTel cannot carry. */
128
182
  function toAttributeArray(values) {
@@ -132,7 +186,7 @@ function toAttributeArray(values) {
132
186
  if (numbers.length === values.length) return numbers;
133
187
  const booleans = values.filter((v) => typeof v === "boolean");
134
188
  if (booleans.length === values.length) return booleans;
135
- return values.length > 0 ? JSON.stringify(values) : void 0;
189
+ return values.length > 0 ? stringifyWithErrors(values) : void 0;
136
190
  }
137
191
  /** Whether a Node-style `process` global exists at all - edge runtimes have none. */
138
192
  function hasProcess() {
@@ -220,6 +274,12 @@ Object.defineProperty(exports, 'describeValue', {
220
274
  return describeValue;
221
275
  }
222
276
  });
277
+ Object.defineProperty(exports, 'errorToRecord', {
278
+ enumerable: true,
279
+ get: function () {
280
+ return errorToRecord;
281
+ }
282
+ });
223
283
  Object.defineProperty(exports, 'hasProcess', {
224
284
  enumerable: true,
225
285
  get: function () {
@@ -262,6 +322,12 @@ Object.defineProperty(exports, 'splitNameOrOptions', {
262
322
  return splitNameOrOptions;
263
323
  }
264
324
  });
325
+ Object.defineProperty(exports, 'stringifyWithErrors', {
326
+ enumerable: true,
327
+ get: function () {
328
+ return stringifyWithErrors;
329
+ }
330
+ });
265
331
  Object.defineProperty(exports, 'toAttributeValue', {
266
332
  enumerable: true,
267
333
  get: function () {
@@ -109,6 +109,60 @@ function toError(cause) {
109
109
  return cause instanceof Error ? cause : new Error(String(cause));
110
110
  }
111
111
  /**
112
+ * Fields an HTTP client hangs on its errors (axios, got, fetch wrappers):
113
+ * the request and response, with their headers - Authorization, cookies, API
114
+ * keys. Never copied, whatever they hold.
115
+ */
116
+ const REQUEST_ERROR_KEYS = /* @__PURE__ */ new Set([
117
+ "config",
118
+ "request",
119
+ "response",
120
+ "headers",
121
+ "options"
122
+ ]);
123
+ /**
124
+ * An Error as a record: name, message, stack, its cause (recursively), and the
125
+ * scalar fields the thrower attached (`code`, `status`, `errno`...). JSON
126
+ * writes an Error as `{}`, and its message alone drops the rest.
127
+ *
128
+ * Only scalar fields are copied: an object on an error is usually the request
129
+ * or response that failed, with its credentials, and redaction may be off.
130
+ * `seen` breaks cycles: an error already being written becomes
131
+ * `<circular-reference>`.
132
+ */
133
+ function errorToRecord(error, seen = /* @__PURE__ */ new WeakSet()) {
134
+ seen.add(error);
135
+ const record = {
136
+ name: error.name,
137
+ message: error.message
138
+ };
139
+ if (error.stack) record.stack = error.stack;
140
+ const fields = error;
141
+ for (const key of Object.keys(error)) {
142
+ if (REQUEST_ERROR_KEYS.has(key.toLowerCase())) continue;
143
+ const value = fields[key];
144
+ const scalar = asString(value) ?? asNumber(value) ?? asBoolean(value);
145
+ if (scalar !== void 0) record[key] = scalar;
146
+ }
147
+ const cause = error.cause;
148
+ if (cause instanceof Error) record.cause = seen.has(cause) ? "<circular-reference>" : errorToRecord(cause, seen);
149
+ else {
150
+ const scalar = asString(cause) ?? asNumber(cause) ?? asBoolean(cause);
151
+ if (scalar !== void 0) record.cause = scalar;
152
+ }
153
+ return record;
154
+ }
155
+ /** JSON.stringify, with any Error inside written as its {@link errorToRecord}. */
156
+ function stringifyWithErrors(value) {
157
+ const seen = /* @__PURE__ */ new WeakSet();
158
+ const raw = (holder, key, v) => typeof holder === "object" && holder !== null ? Reflect.get(holder, key) : v;
159
+ return JSON.stringify(value, function(key, v) {
160
+ const original = raw(this, key, v);
161
+ if (!(original instanceof Error)) return v;
162
+ return seen.has(original) ? "<circular-reference>" : errorToRecord(original, seen);
163
+ });
164
+ }
165
+ /**
112
166
  * A value as an OTel attribute, or undefined when it cannot be one.
113
167
  *
114
168
  * OTel accepts scalars and homogeneous arrays of scalars. Anything else - a
@@ -121,8 +175,8 @@ function toAttributeValue(value) {
121
175
  if (scalar !== void 0) return scalar;
122
176
  if (Array.isArray(value)) return toAttributeArray(value);
123
177
  if (value instanceof Set) return toAttributeArray([...value]);
124
- if (value instanceof Map) return JSON.stringify(Object.fromEntries(value));
125
- return JSON.stringify(value);
178
+ if (value instanceof Map) return stringifyWithErrors(Object.fromEntries(value));
179
+ return stringifyWithErrors(value);
126
180
  }
127
181
  /** The scalars in an array, dropping the entries OTel cannot carry. */
128
182
  function toAttributeArray(values) {
@@ -132,7 +186,7 @@ function toAttributeArray(values) {
132
186
  if (numbers.length === values.length) return numbers;
133
187
  const booleans = values.filter((v) => typeof v === "boolean");
134
188
  if (booleans.length === values.length) return booleans;
135
- return values.length > 0 ? JSON.stringify(values) : void 0;
189
+ return values.length > 0 ? stringifyWithErrors(values) : void 0;
136
190
  }
137
191
  /** Whether a Node-style `process` global exists at all - edge runtimes have none. */
138
192
  function hasProcess() {
@@ -148,4 +202,4 @@ function isDevelopment() {
148
202
  }
149
203
 
150
204
  //#endregion
151
- export { readProperty as _, asNumberArray as a, toAttributeValue as b, asScalar as c, asStringRecord as d, describeValue as f, nonEmptyString as g, isFunction as h, asNumber as i, asString as l, isDevelopment as m, asBooleanArray as n, asPlainRecordOrMap as o, hasProcess as p, asFunction as r, asRecord as s, asBoolean as t, asStringArray as u, resolveValue as v, toError as x, splitNameOrOptions as y };
205
+ export { toError as C, toAttributeValue as S, nonEmptyString as _, asNumberArray as a, splitNameOrOptions as b, asScalar as c, asStringRecord as d, describeValue as f, isFunction as g, isDevelopment as h, asNumber as i, asString as l, hasProcess as m, asBooleanArray as n, asPlainRecordOrMap as o, errorToRecord as p, asFunction as r, asRecord as s, asBoolean as t, asStringArray as u, readProperty as v, stringifyWithErrors as x, resolveValue as y };
package/dist/webhook.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_structured_error = require('./structured-error-DynjWTTu.cjs');
3
- const require_functional = require('./functional-BliCZgwO.cjs');
4
- const require_correlated_events = require('./correlated-events-DE_4A3oD.cjs');
2
+ const require_structured_error = require('./structured-error-Ci8s_M6u.cjs');
3
+ const require_functional = require('./functional-BIK5_ciY.cjs');
4
+ const require_correlated_events = require('./correlated-events-wCrXVUby.cjs');
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
6
6
 
7
7
  //#region src/webhook.ts
package/dist/webhook.js CHANGED
@@ -1,6 +1,6 @@
1
- import { r as recordStructuredError } from "./structured-error-Y9y-1Pae.js";
2
- import { l as withTracing } from "./functional-C-D0KQg6.js";
3
- import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
1
+ import { r as recordStructuredError } from "./structured-error-UEtlg9Uu.js";
2
+ import { l as withTracing } from "./functional-LPlEzBg-.js";
3
+ import { t as emitCorrelatedEvent } from "./correlated-events-CZFe6Z1P.js";
4
4
  import { SpanKind, trace } from "@opentelemetry/api";
5
5
 
6
6
  //#region src/webhook.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
3
- const require_functional = require('./functional-BliCZgwO.cjs');
4
- const require_correlated_events = require('./correlated-events-DE_4A3oD.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
+ const require_functional = require('./functional-BIK5_ciY.cjs');
4
+ const require_correlated_events = require('./correlated-events-wCrXVUby.cjs');
5
5
  const require_business_baggage = require('./business-baggage.cjs');
6
6
  let _opentelemetry_api = require("@opentelemetry/api");
7
7
 
@@ -1,6 +1,6 @@
1
- import { h as isFunction, x as toError } from "./values-xBtdXtjA.js";
2
- import { l as withTracing } from "./functional-C-D0KQg6.js";
3
- import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
1
+ import { C as toError, g as isFunction } from "./values-Dm0yEC5p.js";
2
+ import { l as withTracing } from "./functional-LPlEzBg-.js";
3
+ import { t as emitCorrelatedEvent } from "./correlated-events-CZFe6Z1P.js";
4
4
  import { createSafeBaggageSchema } from "./business-baggage.js";
5
5
  import { SpanKind, context, propagation } from "@opentelemetry/api";
6
6
 
package/dist/workflow.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.cjs');
3
- const require_values = require('./values-AxGpgYBA.cjs');
4
- const require_functional = require('./functional-BliCZgwO.cjs');
3
+ const require_values = require('./values-9A6nOyZm.cjs');
4
+ const require_functional = require('./functional-BIK5_ciY.cjs');
5
5
  const require_trace_helpers = require('./trace-helpers.cjs');
6
- const require_correlated_events = require('./correlated-events-DE_4A3oD.cjs');
6
+ const require_correlated_events = require('./correlated-events-wCrXVUby.cjs');
7
7
  const require_trace_factory_validation = require('./trace-factory-validation-CHU1WcjK.cjs');
8
8
  let node_async_hooks = require("node:async_hooks");
9
9
  node_async_hooks = require_rolldown_runtime.__toESM(node_async_hooks, 1);
package/dist/workflow.js CHANGED
@@ -1,7 +1,7 @@
1
- import { b as toAttributeValue, g as nonEmptyString, h as isFunction, l as asString, s as asRecord, x as toError } from "./values-xBtdXtjA.js";
2
- import { l as withTracing } from "./functional-C-D0KQg6.js";
1
+ import { C as toError, S as toAttributeValue, _ as nonEmptyString, g as isFunction, l as asString, s as asRecord } from "./values-Dm0yEC5p.js";
2
+ import { l as withTracing } from "./functional-LPlEzBg-.js";
3
3
  import { getActiveSpan } from "./trace-helpers.js";
4
- import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
4
+ import { t as emitCorrelatedEvent } from "./correlated-events-CZFe6Z1P.js";
5
5
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
6
6
  import * as nodeAsyncHooks from "node:async_hooks";
7
7
 
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-DF4YrpSB.cjs');
2
+ const require_init = require('./init-DL9jfiIY.cjs');
3
3
 
4
4
  exports.hasYamlConfig = require_init.hasYamlConfig;
5
5
  exports.loadYamlConfig = require_init.loadYamlConfig;
@@ -1,5 +1,5 @@
1
1
  import { g as SamplingPreset } from "./sampling-CLJmXMw0.cjs";
2
- import { a as AutotelConfig, o as OtlpSignal } from "./init-D5k8hBRg.cjs";
2
+ import { a as AutotelConfig, o as OtlpSignal } from "./init-axM4kgR4.cjs";
3
3
  //#region src/yaml-config.d.ts
4
4
  /** A value as a YAML document carries it: scalars, sequences, mappings. */
5
5
  export type YamlValue = string | number | boolean | null | YamlValue[] | YamlMapping;
@@ -1,5 +1,5 @@
1
1
  import { g as SamplingPreset } from "./sampling-DBlX8Nv5.js";
2
- import { a as AutotelConfig, o as OtlpSignal } from "./init-DMjyzzbM.js";
2
+ import { a as AutotelConfig, o as OtlpSignal } from "./init-BYq2sUXg.js";
3
3
  //#region src/yaml-config.d.ts
4
4
  /** A value as a YAML document carries it: scalars, sequences, mappings. */
5
5
  export type YamlValue = string | number | boolean | null | YamlValue[] | YamlMapping;
@@ -1,3 +1,3 @@
1
- import { _ as loadYamlConfig, g as hasYamlConfig, v as loadYamlConfigFromFile } from "./init-CKHEf5g2.js";
1
+ import { _ as loadYamlConfig, g as hasYamlConfig, v as loadYamlConfigFromFile } from "./init-DPoRpz9n.js";
2
2
 
3
3
  export { hasYamlConfig, loadYamlConfig, loadYamlConfigFromFile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel",
3
- "version": "8.0.0",
3
+ "version": "8.2.0",
4
4
  "description": "Write Once, Observe Anywhere",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",