autotel 6.5.0 → 7.0.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 (166) hide show
  1. package/README.md +30 -23
  2. package/dist/{attribute-redacting-processor-Pk7lAzWd.d.cts → attribute-redacting-processor-CvBE0z1p.d.cts} +33 -1
  3. package/dist/{attribute-redacting-processor-Pk7lAzWd.d.ts → attribute-redacting-processor-CvBE0z1p.d.ts} +33 -1
  4. package/dist/attribute-redacting-processor.cjs +34 -32
  5. package/dist/attribute-redacting-processor.d.cts +1 -1
  6. package/dist/attribute-redacting-processor.d.ts +1 -1
  7. package/dist/attribute-redacting-processor.js +35 -32
  8. package/dist/{attributes-aDmJYral.cjs → attributes-Cxys8tgr.cjs} +34 -35
  9. package/dist/{attributes-B7wix2VG.js → attributes-Dt4YUYbP.js} +34 -35
  10. package/dist/attributes.cjs +1 -1
  11. package/dist/attributes.d.cts +1 -1
  12. package/dist/attributes.d.ts +1 -1
  13. package/dist/attributes.js +1 -1
  14. package/dist/auto.cjs +1 -1
  15. package/dist/auto.js +1 -1
  16. package/dist/business-baggage.cjs +19 -12
  17. package/dist/business-baggage.d.cts +8 -3
  18. package/dist/business-baggage.d.ts +8 -3
  19. package/dist/business-baggage.js +19 -12
  20. package/dist/{canonical-log-line-processor-DxtBGZIi.cjs → canonical-log-line-processor-DolzdawH.cjs} +43 -32
  21. package/dist/{canonical-log-line-processor-B4WgG-VS.d.cts → canonical-log-line-processor-cPB4Axk-.d.ts} +4 -3
  22. package/dist/{canonical-log-line-processor-B0vq_QR6.js → canonical-log-line-processor-hFUmS__K.js} +43 -32
  23. package/dist/{canonical-log-line-processor-CL_J7gb5.d.ts → canonical-log-line-processor-l0Aqe6yp.d.cts} +4 -3
  24. package/dist/config.d.cts +1 -1
  25. package/dist/config.d.ts +1 -1
  26. package/dist/{correlated-events-kSwLo3mi.cjs → correlated-events-CcuknWnU.cjs} +2 -1
  27. package/dist/{correlated-events-Bzh5y-UB.js → correlated-events-DwMMbItg.js} +3 -1
  28. package/dist/correlation-id.cjs +1 -1
  29. package/dist/correlation-id.js +1 -1
  30. package/dist/db.cjs +34 -19
  31. package/dist/db.js +34 -19
  32. package/dist/decorators.cjs +4 -2
  33. package/dist/decorators.d.cts +16 -11
  34. package/dist/decorators.d.ts +16 -11
  35. package/dist/decorators.js +4 -2
  36. package/dist/{define-event-CGG048HE.d.cts → define-event-BNeuKUPv.d.cts} +1 -1
  37. package/dist/{define-event-B2z1SBe7.d.ts → define-event-Bd8f8mST.d.ts} +1 -1
  38. package/dist/diagnostics.cjs +18 -16
  39. package/dist/diagnostics.d.cts +14 -10
  40. package/dist/diagnostics.d.ts +14 -10
  41. package/dist/diagnostics.js +18 -16
  42. package/dist/{event-subscriber-CWh8sTGh.d.cts → event-subscriber-DMACQA-1.d.cts} +19 -9
  43. package/dist/{event-subscriber-CWh8sTGh.d.ts → event-subscriber-DMACQA-1.d.ts} +19 -9
  44. package/dist/event-subscriber.d.cts +2 -2
  45. package/dist/event-subscriber.d.ts +2 -2
  46. package/dist/{event-testing-D0qWfqAy.d.cts → event-testing-CBtnJXE5.d.cts} +1 -1
  47. package/dist/{event-testing-CA2mIx1E.d.ts → event-testing-CkPgV3Ii.d.ts} +1 -1
  48. package/dist/event-testing.d.cts +1 -1
  49. package/dist/event-testing.d.ts +1 -1
  50. package/dist/event.cjs +1 -1
  51. package/dist/event.d.cts +5 -5
  52. package/dist/event.d.ts +5 -5
  53. package/dist/event.js +1 -1
  54. package/dist/exception-fingerprint.cjs +133 -0
  55. package/dist/exception-fingerprint.d.cts +51 -0
  56. package/dist/exception-fingerprint.d.ts +51 -0
  57. package/dist/exception-fingerprint.js +126 -0
  58. package/dist/{functional-e6jw5zQj.d.cts → functional-CJn2zY4o.d.cts} +96 -39
  59. package/dist/{functional-AT22vCw6.d.ts → functional-DXy1cHFF.d.ts} +96 -39
  60. package/dist/{functional-C0uAZq2X.cjs → functional-Da6Yv64r.cjs} +27 -15
  61. package/dist/{functional-DX7Zvag0.js → functional-uSbNnnxK.js} +27 -15
  62. package/dist/functional.cjs +1 -1
  63. package/dist/functional.d.cts +2 -2
  64. package/dist/functional.d.ts +2 -2
  65. package/dist/functional.js +1 -1
  66. package/dist/http.cjs +11 -8
  67. package/dist/http.js +11 -8
  68. package/dist/{index-DolOVX6F.d.ts → index-CwrNAsgk.d.ts} +22 -26
  69. package/dist/{index-BPcxVucm.d.cts → index-DQHf4cNl.d.cts} +22 -26
  70. package/dist/index.cjs +41 -35
  71. package/dist/index.d.cts +45 -30
  72. package/dist/index.d.ts +45 -30
  73. package/dist/index.js +41 -35
  74. package/dist/{init-pPI3JRRf.d.ts → init-BgnYi2sm.d.ts} +6 -6
  75. package/dist/{init-CTtHITlX.cjs → init-D4m5rCmD.cjs} +110 -84
  76. package/dist/{init-ncTMKZ-s.d.cts → init-DrlL1eis.d.cts} +6 -6
  77. package/dist/{init-WHYwyItd.js → init-JtX-KKz_.js} +105 -85
  78. package/dist/instrumentation.cjs +2 -2
  79. package/dist/instrumentation.js +2 -2
  80. package/dist/{logger-D3Ej3DII.js → logger-DdPp__xW.js} +63 -54
  81. package/dist/{logger-CN4xpzMd.d.cts → logger-S1Fgl0g3.d.cts} +0 -20
  82. package/dist/{logger-CN4xpzMd.d.ts → logger-S1Fgl0g3.d.ts} +0 -20
  83. package/dist/{logger-thMPLpOG.cjs → logger-Sm66cjKl.cjs} +63 -54
  84. package/dist/logger.cjs +1 -1
  85. package/dist/logger.d.cts +1 -1
  86. package/dist/logger.d.ts +1 -1
  87. package/dist/logger.js +1 -1
  88. package/dist/messaging-adapters.cjs +26 -12
  89. package/dist/messaging-adapters.d.cts +0 -30
  90. package/dist/messaging-adapters.d.ts +0 -30
  91. package/dist/messaging-adapters.js +26 -12
  92. package/dist/messaging.cjs +37 -34
  93. package/dist/messaging.d.cts +21 -62
  94. package/dist/messaging.d.ts +21 -62
  95. package/dist/messaging.js +37 -34
  96. package/dist/{metric-testing-CpvP3ZIa.d.cts → metric-testing-86WO1wan.d.cts} +1 -1
  97. package/dist/{metric-testing-CWm6UhaR.d.ts → metric-testing-CbCxdPBp.d.ts} +1 -1
  98. package/dist/metric-testing.d.cts +1 -1
  99. package/dist/metric-testing.d.ts +1 -1
  100. package/dist/metric.d.cts +3 -3
  101. package/dist/metric.d.ts +3 -3
  102. package/dist/{node-require-vROmTeJ8.js → node-require-DSPjaw_l.js} +3 -2
  103. package/dist/{node-require-PFqDihze.cjs → node-require-EifOMikz.cjs} +3 -2
  104. package/dist/parse-error.cjs +18 -12
  105. package/dist/parse-error.d.cts +2 -1
  106. package/dist/parse-error.d.ts +2 -1
  107. package/dist/parse-error.js +19 -12
  108. package/dist/policy.cjs +0 -0
  109. package/dist/policy.js +0 -0
  110. package/dist/processors.cjs +1 -1
  111. package/dist/processors.d.cts +1 -1
  112. package/dist/processors.d.ts +1 -1
  113. package/dist/processors.js +1 -1
  114. package/dist/{sampling-BR9fkSwx.d.cts → sampling-CM5S2Lp3.d.ts} +5 -6
  115. package/dist/{sampling-CP3e7-Yr.d.ts → sampling-CmRdnXUi.d.cts} +5 -6
  116. package/dist/sampling.cjs +3 -2
  117. package/dist/sampling.d.cts +1 -1
  118. package/dist/sampling.d.ts +1 -1
  119. package/dist/sampling.js +3 -2
  120. package/dist/semantic-helpers.cjs +9 -9
  121. package/dist/semantic-helpers.d.cts +1 -1
  122. package/dist/semantic-helpers.d.ts +1 -1
  123. package/dist/semantic-helpers.js +9 -9
  124. package/dist/{stable-hash-ChFBIhNt.js → stable-hash-BkoAYVks.js} +4 -3
  125. package/dist/{stable-hash-CS9BxvVQ.cjs → stable-hash-C0pOegH_.cjs} +4 -3
  126. package/dist/{structured-error-CHg7DoIQ.cjs → structured-error--_wXpd_C.cjs} +34 -25
  127. package/dist/{structured-error-9--cxBay.js → structured-error-YIuka-FE.js} +34 -25
  128. package/dist/test-span-collector.cjs +15 -8
  129. package/dist/test-span-collector.js +15 -8
  130. package/dist/testing.cjs +16 -18
  131. package/dist/testing.d.cts +7 -6
  132. package/dist/testing.d.ts +7 -6
  133. package/dist/testing.js +16 -18
  134. package/dist/{trace-context-IuyoPyNq.d.cts → trace-context-C1Cn1q0y.d.cts} +8 -7
  135. package/dist/{trace-context-IuyoPyNq.d.ts → trace-context-f89xPJbK.d.ts} +8 -7
  136. package/dist/trace-helpers.cjs +16 -13
  137. package/dist/trace-helpers.d.cts +9 -4
  138. package/dist/trace-helpers.d.ts +9 -4
  139. package/dist/trace-helpers.js +16 -13
  140. package/dist/tracer-provider.cjs +8 -12
  141. package/dist/tracer-provider.js +8 -12
  142. package/dist/validate.cjs +22 -20
  143. package/dist/validate.d.cts +3 -2
  144. package/dist/validate.d.ts +3 -2
  145. package/dist/validate.js +22 -20
  146. package/dist/values-BenyvWKz.js +141 -0
  147. package/dist/values-CeMH-mYG.d.cts +8 -0
  148. package/dist/values-CeMH-mYG.d.ts +8 -0
  149. package/dist/values-DApyq53y.cjs +267 -0
  150. package/dist/webhook.cjs +3 -3
  151. package/dist/webhook.d.cts +1 -1
  152. package/dist/webhook.d.ts +1 -1
  153. package/dist/webhook.js +3 -3
  154. package/dist/workflow-distributed.cjs +9 -7
  155. package/dist/workflow-distributed.d.cts +9 -8
  156. package/dist/workflow-distributed.d.ts +9 -8
  157. package/dist/workflow-distributed.js +9 -7
  158. package/dist/workflow.cjs +26 -17
  159. package/dist/workflow.d.cts +1 -28
  160. package/dist/workflow.d.ts +1 -28
  161. package/dist/workflow.js +26 -17
  162. package/dist/yaml-config.cjs +26 -11
  163. package/dist/yaml-config.d.cts +9 -3
  164. package/dist/yaml-config.d.ts +9 -3
  165. package/dist/yaml-config.js +26 -11
  166. package/package.json +6 -1
@@ -1,3 +1,4 @@
1
+ import { t as UnknownRecord } from "./values-CeMH-mYG.cjs";
1
2
  //#region src/parse-error.d.ts
2
3
  interface ParsedError {
3
4
  message: string;
@@ -6,7 +7,7 @@ interface ParsedError {
6
7
  fix?: string;
7
8
  link?: string;
8
9
  code?: string | number;
9
- details?: Record<string, unknown>;
10
+ details?: UnknownRecord;
10
11
  raw: unknown;
11
12
  }
12
13
  declare function parseError(error: unknown): ParsedError;
@@ -1,3 +1,4 @@
1
+ import { t as UnknownRecord } from "./values-CeMH-mYG.js";
1
2
  //#region src/parse-error.d.ts
2
3
  interface ParsedError {
3
4
  message: string;
@@ -6,7 +7,7 @@ interface ParsedError {
6
7
  fix?: string;
7
8
  link?: string;
8
9
  code?: string | number;
9
- details?: Record<string, unknown>;
10
+ details?: UnknownRecord;
10
11
  raw: unknown;
11
12
  }
12
13
  declare function parseError(error: unknown): ParsedError;
@@ -1,19 +1,26 @@
1
+ import { _ as readProperty, i as asNumber, l as asString, s as asRecord } from "./values-BenyvWKz.js";
2
+
1
3
  //#region src/parse-error.ts
4
+ /** An HTTP-ish status, however the library that threw chose to spell it. */
2
5
  function toStatus(value) {
3
- if (typeof value === "number" && Number.isFinite(value)) return value;
4
- if (typeof value === "string") {
5
- const n = Number(value);
6
- if (Number.isFinite(n)) return n;
7
- }
6
+ const text = asString(value);
7
+ return text === void 0 ? asNumber(value) : asNumber(Number(text)) ?? void 0;
8
8
  }
9
9
  function pickString(value) {
10
- return typeof value === "string" && value.length > 0 ? value : void 0;
10
+ const text = asString(value);
11
+ return text !== void 0 && text.length > 0 ? text : void 0;
11
12
  }
12
13
  function pickCode(value) {
13
- if (typeof value === "string" || typeof value === "number") return value;
14
+ return asString(value) ?? asNumber(value);
14
15
  }
16
+ /**
17
+ * A plain object of extra fields. Only a plain one: an Error, a Response or a
18
+ * class instance carries behaviour, and copying it onto a log line as details
19
+ * would serialise something the thrower never meant to publish.
20
+ */
15
21
  function pickDetails(value) {
16
- if (value && typeof value === "object" && value.constructor === Object) return value;
22
+ const record = asRecord(value);
23
+ return record?.constructor === Object ? record : void 0;
17
24
  }
18
25
  function parseError(error) {
19
26
  if (error instanceof Error) {
@@ -29,10 +36,10 @@ function parseError(error) {
29
36
  raw: error
30
37
  };
31
38
  }
32
- if (error && typeof error === "object") {
33
- const err = error;
34
- const data = err.data && typeof err.data === "object" ? err.data : void 0;
35
- const payload = (data?.data && typeof data.data === "object" ? data.data : void 0) ?? data;
39
+ const err = asRecord(error);
40
+ if (err) {
41
+ const data = asRecord(err.data);
42
+ const payload = asRecord(readProperty(data, "data")) ?? data;
36
43
  return {
37
44
  message: pickString(data?.statusText) || pickString(data?.statusMessage) || pickString(data?.message) || pickString(payload?.statusText) || pickString(payload?.statusMessage) || pickString(payload?.message) || pickString(err.message) || "An error occurred",
38
45
  status: toStatus(payload?.status) || toStatus(payload?.statusCode) || toStatus(err.status) || toStatus(err.statusCode) || 500,
package/dist/policy.cjs CHANGED
Binary file
package/dist/policy.js CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_canonical_log_line_processor = require('./canonical-log-line-processor-DxtBGZIi.cjs');
2
+ const require_canonical_log_line_processor = require('./canonical-log-line-processor-DolzdawH.cjs');
3
3
  let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
4
4
 
5
5
  Object.defineProperty(exports, 'BatchSpanProcessor', {
@@ -1,3 +1,3 @@
1
- import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-B4WgG-VS.cjs";
1
+ import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-l0Aqe6yp.cjs";
2
2
  import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
3
3
  export { BatchSpanProcessor, type CanonicalLogLineOptions, CanonicalLogLineProcessor, SimpleSpanProcessor };
@@ -1,3 +1,3 @@
1
- import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-CL_J7gb5.js";
1
+ import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-cPB4Axk-.js";
2
2
  import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
3
3
  export { BatchSpanProcessor, type CanonicalLogLineOptions, CanonicalLogLineProcessor, SimpleSpanProcessor };
@@ -1,4 +1,4 @@
1
- import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-B0vq_QR6.js";
1
+ import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-hFUmS__K.js";
2
2
  import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
3
3
 
4
4
  export { BatchSpanProcessor, CanonicalLogLineProcessor, SimpleSpanProcessor };
@@ -1,4 +1,5 @@
1
- import { s as Logger } from "./logger-CN4xpzMd.cjs";
1
+ import { t as UnknownRecord } from "./values-CeMH-mYG.js";
2
+ import { s as Logger } from "./logger-S1Fgl0g3.js";
2
3
  import { Attributes, Link } from "@opentelemetry/api";
3
4
  //#region src/sampling.d.ts
4
5
  /**
@@ -76,7 +77,7 @@ interface SamplingContext {
76
77
  /** Method arguments (for extracting user IDs, etc.) */
77
78
  args: unknown[];
78
79
  /** Optional metadata (e.g., feature flags, request headers) */
79
- metadata?: Record<string, unknown>;
80
+ metadata?: UnknownRecord;
80
81
  /** Optional span links for links-based sampling */
81
82
  links?: Link[];
82
83
  }
@@ -355,7 +356,7 @@ declare class FeatureFlagSampler implements Sampler {
355
356
  constructor(options: {
356
357
  baselineSampleRate?: number;
357
358
  alwaysSampleFlags?: string[];
358
- extractFlags: (args: unknown[], metadata?: Record<string, unknown>) => string[] | undefined;
359
+ extractFlags: (args: unknown[], metadata?: UnknownRecord) => string[] | undefined;
359
360
  logger?: Logger;
360
361
  });
361
362
  shouldSample(context: SamplingContext): boolean;
@@ -460,8 +461,6 @@ declare function createLinkFromHeaders(headers: Record<string, string>, attribut
460
461
  * });
461
462
  * ```
462
463
  */
463
- declare function extractLinksFromBatch(messages: Array<{
464
- [key: string]: unknown;
465
- }>, headersKey?: string): Link[];
464
+ declare function extractLinksFromBatch(messages: UnknownRecord[], headersKey?: string): Link[];
466
465
  //#endregion
467
466
  export { createLinkFromHeaders as _, AlwaysSampler as a, resolveSamplingPreset as b, FeatureFlagSampler as c, OperationResult as d, RandomSampler as f, UserIdSampler as g, SamplingPreset as h, AdaptiveSampler as i, KeyTargetRateSampler as l, SamplingContext as m, AUTOTEL_SAMPLING_TAIL_EVALUATED as n, CompositeSampler as o, Sampler as p, AUTOTEL_SAMPLING_TAIL_KEEP as r, DeterministicSampler as s, AUTOTEL_SAMPLING_RATE as t, NeverSampler as u, extractLinksFromBatch as v, samplingPresets as x, hashUnitInterval as y };
@@ -1,4 +1,5 @@
1
- import { s as Logger } from "./logger-CN4xpzMd.js";
1
+ import { t as UnknownRecord } from "./values-CeMH-mYG.cjs";
2
+ import { s as Logger } from "./logger-S1Fgl0g3.cjs";
2
3
  import { Attributes, Link } from "@opentelemetry/api";
3
4
  //#region src/sampling.d.ts
4
5
  /**
@@ -76,7 +77,7 @@ interface SamplingContext {
76
77
  /** Method arguments (for extracting user IDs, etc.) */
77
78
  args: unknown[];
78
79
  /** Optional metadata (e.g., feature flags, request headers) */
79
- metadata?: Record<string, unknown>;
80
+ metadata?: UnknownRecord;
80
81
  /** Optional span links for links-based sampling */
81
82
  links?: Link[];
82
83
  }
@@ -355,7 +356,7 @@ declare class FeatureFlagSampler implements Sampler {
355
356
  constructor(options: {
356
357
  baselineSampleRate?: number;
357
358
  alwaysSampleFlags?: string[];
358
- extractFlags: (args: unknown[], metadata?: Record<string, unknown>) => string[] | undefined;
359
+ extractFlags: (args: unknown[], metadata?: UnknownRecord) => string[] | undefined;
359
360
  logger?: Logger;
360
361
  });
361
362
  shouldSample(context: SamplingContext): boolean;
@@ -460,8 +461,6 @@ declare function createLinkFromHeaders(headers: Record<string, string>, attribut
460
461
  * });
461
462
  * ```
462
463
  */
463
- declare function extractLinksFromBatch(messages: Array<{
464
- [key: string]: unknown;
465
- }>, headersKey?: string): Link[];
464
+ declare function extractLinksFromBatch(messages: UnknownRecord[], headersKey?: string): Link[];
466
465
  //#endregion
467
466
  export { createLinkFromHeaders as _, AlwaysSampler as a, resolveSamplingPreset as b, FeatureFlagSampler as c, OperationResult as d, RandomSampler as f, UserIdSampler as g, SamplingPreset as h, AdaptiveSampler as i, KeyTargetRateSampler as l, SamplingContext as m, AUTOTEL_SAMPLING_TAIL_EVALUATED as n, CompositeSampler as o, Sampler as p, AUTOTEL_SAMPLING_TAIL_KEEP as r, DeterministicSampler as s, AUTOTEL_SAMPLING_RATE as t, NeverSampler as u, extractLinksFromBatch as v, samplingPresets as x, hashUnitInterval as y };
package/dist/sampling.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_values = require('./values-DApyq53y.cjs');
2
3
  let _opentelemetry_api = require("@opentelemetry/api");
3
4
 
4
5
  //#region src/sampling.ts
@@ -544,8 +545,8 @@ function createLinkFromHeaders(headers, attributes) {
544
545
  function extractLinksFromBatch(messages, headersKey = "headers") {
545
546
  const links = [];
546
547
  for (const msg of messages) {
547
- const msgHeaders = msg[headersKey];
548
- if (msgHeaders && typeof msgHeaders === "object" && msgHeaders !== null) {
548
+ const msgHeaders = require_values.asStringRecord(msg[headersKey]);
549
+ if (msgHeaders) {
549
550
  const link = createLinkFromHeaders(msgHeaders, { "messaging.batch.message_index": links.length });
550
551
  if (link) links.push(link);
551
552
  }
@@ -1,2 +1,2 @@
1
- import { _ as createLinkFromHeaders, a as AlwaysSampler, b as resolveSamplingPreset, c as FeatureFlagSampler, d as OperationResult, f as RandomSampler, g as UserIdSampler, h as SamplingPreset, i as AdaptiveSampler, l as KeyTargetRateSampler, m as SamplingContext, n as AUTOTEL_SAMPLING_TAIL_EVALUATED, o as CompositeSampler, p as Sampler, r as AUTOTEL_SAMPLING_TAIL_KEEP, s as DeterministicSampler, t as AUTOTEL_SAMPLING_RATE, u as NeverSampler, v as extractLinksFromBatch, x as samplingPresets, y as hashUnitInterval } from "./sampling-BR9fkSwx.cjs";
1
+ import { _ as createLinkFromHeaders, a as AlwaysSampler, b as resolveSamplingPreset, c as FeatureFlagSampler, d as OperationResult, f as RandomSampler, g as UserIdSampler, h as SamplingPreset, i as AdaptiveSampler, l as KeyTargetRateSampler, m as SamplingContext, n as AUTOTEL_SAMPLING_TAIL_EVALUATED, o as CompositeSampler, p as Sampler, r as AUTOTEL_SAMPLING_TAIL_KEEP, s as DeterministicSampler, t as AUTOTEL_SAMPLING_RATE, u as NeverSampler, v as extractLinksFromBatch, x as samplingPresets, y as hashUnitInterval } from "./sampling-CmRdnXUi.cjs";
2
2
  export { AUTOTEL_SAMPLING_RATE, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, CompositeSampler, DeterministicSampler, FeatureFlagSampler, KeyTargetRateSampler, NeverSampler, OperationResult, RandomSampler, Sampler, SamplingContext, SamplingPreset, UserIdSampler, createLinkFromHeaders, extractLinksFromBatch, hashUnitInterval, resolveSamplingPreset, samplingPresets };
@@ -1,2 +1,2 @@
1
- import { _ as createLinkFromHeaders, a as AlwaysSampler, b as resolveSamplingPreset, c as FeatureFlagSampler, d as OperationResult, f as RandomSampler, g as UserIdSampler, h as SamplingPreset, i as AdaptiveSampler, l as KeyTargetRateSampler, m as SamplingContext, n as AUTOTEL_SAMPLING_TAIL_EVALUATED, o as CompositeSampler, p as Sampler, r as AUTOTEL_SAMPLING_TAIL_KEEP, s as DeterministicSampler, t as AUTOTEL_SAMPLING_RATE, u as NeverSampler, v as extractLinksFromBatch, x as samplingPresets, y as hashUnitInterval } from "./sampling-CP3e7-Yr.js";
1
+ import { _ as createLinkFromHeaders, a as AlwaysSampler, b as resolveSamplingPreset, c as FeatureFlagSampler, d as OperationResult, f as RandomSampler, g as UserIdSampler, h as SamplingPreset, i as AdaptiveSampler, l as KeyTargetRateSampler, m as SamplingContext, n as AUTOTEL_SAMPLING_TAIL_EVALUATED, o as CompositeSampler, p as Sampler, r as AUTOTEL_SAMPLING_TAIL_KEEP, s as DeterministicSampler, t as AUTOTEL_SAMPLING_RATE, u as NeverSampler, v as extractLinksFromBatch, x as samplingPresets, y as hashUnitInterval } from "./sampling-CM5S2Lp3.js";
2
2
  export { AUTOTEL_SAMPLING_RATE, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, CompositeSampler, DeterministicSampler, FeatureFlagSampler, KeyTargetRateSampler, NeverSampler, OperationResult, RandomSampler, Sampler, SamplingContext, SamplingPreset, UserIdSampler, createLinkFromHeaders, extractLinksFromBatch, hashUnitInterval, resolveSamplingPreset, samplingPresets };
package/dist/sampling.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { d as asStringRecord } from "./values-BenyvWKz.js";
1
2
  import { TraceFlags } from "@opentelemetry/api";
2
3
 
3
4
  //#region src/sampling.ts
@@ -543,8 +544,8 @@ function createLinkFromHeaders(headers, attributes) {
543
544
  function extractLinksFromBatch(messages, headersKey = "headers") {
544
545
  const links = [];
545
546
  for (const msg of messages) {
546
- const msgHeaders = msg[headersKey];
547
- if (msgHeaders && typeof msgHeaders === "object" && msgHeaders !== null) {
547
+ const msgHeaders = asStringRecord(msg[headersKey]);
548
+ if (msgHeaders) {
548
549
  const link = createLinkFromHeaders(msgHeaders, { "messaging.batch.message_index": links.length });
549
550
  if (link) links.push(link);
550
551
  }
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_functional = require('./functional-C0uAZq2X.cjs');
2
+ const require_values = require('./values-DApyq53y.cjs');
3
+ const require_functional = require('./functional-Da6Yv64r.cjs');
3
4
  const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
4
5
  let _opentelemetry_api = require("@opentelemetry/api");
5
6
 
@@ -15,9 +16,8 @@ let _opentelemetry_api = require("@opentelemetry/api");
15
16
  function setConfiguredAttributes(ctx, attributes) {
16
17
  if (!attributes) return;
17
18
  for (const [key, value] of Object.entries(attributes)) {
18
- if (value === void 0 || value === null) continue;
19
- const attributeValue = typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value);
20
- ctx.setAttribute(key, attributeValue);
19
+ const attributeValue = require_values.toAttributeValue(value);
20
+ if (attributeValue !== void 0) ctx.setAttribute(key, attributeValue);
21
21
  }
22
22
  }
23
23
  /**
@@ -49,8 +49,8 @@ function wrapSemantic(helperName, name, spanKind, configure, fn) {
49
49
  };
50
50
  }
51
51
  function traceDB(config, fn) {
52
- if (!config || typeof config !== "object") throw new TypeError("traceDB: config must be an object");
53
- if (typeof config.system !== "string" || config.system.trim() === "") throw new TypeError("traceDB: config.system must be a non-empty string");
52
+ if (require_values.asRecord(config) === void 0) throw new TypeError("traceDB: config must be an object");
53
+ if (require_values.nonEmptyString(config.system) === void 0) throw new TypeError("traceDB: config.system must be a non-empty string");
54
54
  const target = config.collection ?? config.database;
55
55
  const spanName = (config.querySummary ?? [config.operation, target].filter(Boolean).join(" ")) || config.system;
56
56
  const configure = (ctx) => {
@@ -71,7 +71,7 @@ function traceDB(config, fn) {
71
71
  return wrapSemantic("traceDB", spanName, _opentelemetry_api.SpanKind.CLIENT, configure, fn);
72
72
  }
73
73
  function traceHTTP(config, fn) {
74
- if (!config || typeof config !== "object") throw new TypeError("traceHTTP: config must be an object");
74
+ if (require_values.asRecord(config) === void 0) throw new TypeError("traceHTTP: config must be an object");
75
75
  const method = config.method?.toUpperCase() || "HTTP";
76
76
  const target = config.route ?? config.urlTemplate;
77
77
  const spanName = target ? `${method} ${target}` : method;
@@ -85,8 +85,8 @@ function traceHTTP(config, fn) {
85
85
  return wrapSemantic("traceHTTP", spanName, _opentelemetry_api.SpanKind.CLIENT, configure, fn);
86
86
  }
87
87
  function traceMessaging(config, fn) {
88
- if (!config || typeof config !== "object") throw new TypeError("traceMessaging: config must be an object");
89
- if (typeof config.system !== "string" || config.system.trim() === "") throw new TypeError("traceMessaging: config.system must be a non-empty string");
88
+ if (require_values.asRecord(config) === void 0) throw new TypeError("traceMessaging: config must be an object");
89
+ if (require_values.nonEmptyString(config.system) === void 0) throw new TypeError("traceMessaging: config.system must be a non-empty string");
90
90
  const operation = config.operation ?? "messaging";
91
91
  const spanName = [operation, config.destination].filter(Boolean).join(" ");
92
92
  const operationType = operation === "publish" ? "send" : operation;
@@ -1,4 +1,4 @@
1
- import { n as TraceContext } from "./trace-context-IuyoPyNq.cjs";
1
+ import { n as TraceContext } from "./trace-context-C1Cn1q0y.cjs";
2
2
  import { Attributes } from "@opentelemetry/api";
3
3
  //#region src/semantic-helpers.d.ts
4
4
  type SemanticHandler<TArgs extends unknown[], TReturn> = (...args: TArgs) => TReturn | Promise<TReturn>;
@@ -1,4 +1,4 @@
1
- import { n as TraceContext } from "./trace-context-IuyoPyNq.js";
1
+ import { n as TraceContext } from "./trace-context-f89xPJbK.js";
2
2
  import { Attributes } from "@opentelemetry/api";
3
3
  //#region src/semantic-helpers.d.ts
4
4
  type SemanticHandler<TArgs extends unknown[], TReturn> = (...args: TArgs) => TReturn | Promise<TReturn>;
@@ -1,4 +1,5 @@
1
- import { c as withTracing } from "./functional-DX7Zvag0.js";
1
+ import { b as toAttributeValue, g as nonEmptyString, s as asRecord } from "./values-BenyvWKz.js";
2
+ import { c as withTracing } from "./functional-uSbNnnxK.js";
2
3
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
3
4
  import { SpanKind } from "@opentelemetry/api";
4
5
 
@@ -14,9 +15,8 @@ import { SpanKind } from "@opentelemetry/api";
14
15
  function setConfiguredAttributes(ctx, attributes) {
15
16
  if (!attributes) return;
16
17
  for (const [key, value] of Object.entries(attributes)) {
17
- if (value === void 0 || value === null) continue;
18
- const attributeValue = typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value);
19
- ctx.setAttribute(key, attributeValue);
18
+ const attributeValue = toAttributeValue(value);
19
+ if (attributeValue !== void 0) ctx.setAttribute(key, attributeValue);
20
20
  }
21
21
  }
22
22
  /**
@@ -48,8 +48,8 @@ function wrapSemantic(helperName, name, spanKind, configure, fn) {
48
48
  };
49
49
  }
50
50
  function traceDB(config, fn) {
51
- if (!config || typeof config !== "object") throw new TypeError("traceDB: config must be an object");
52
- if (typeof config.system !== "string" || config.system.trim() === "") throw new TypeError("traceDB: config.system must be a non-empty string");
51
+ if (asRecord(config) === void 0) throw new TypeError("traceDB: config must be an object");
52
+ if (nonEmptyString(config.system) === void 0) throw new TypeError("traceDB: config.system must be a non-empty string");
53
53
  const target = config.collection ?? config.database;
54
54
  const spanName = (config.querySummary ?? [config.operation, target].filter(Boolean).join(" ")) || config.system;
55
55
  const configure = (ctx) => {
@@ -70,7 +70,7 @@ function traceDB(config, fn) {
70
70
  return wrapSemantic("traceDB", spanName, SpanKind.CLIENT, configure, fn);
71
71
  }
72
72
  function traceHTTP(config, fn) {
73
- if (!config || typeof config !== "object") throw new TypeError("traceHTTP: config must be an object");
73
+ if (asRecord(config) === void 0) throw new TypeError("traceHTTP: config must be an object");
74
74
  const method = config.method?.toUpperCase() || "HTTP";
75
75
  const target = config.route ?? config.urlTemplate;
76
76
  const spanName = target ? `${method} ${target}` : method;
@@ -84,8 +84,8 @@ function traceHTTP(config, fn) {
84
84
  return wrapSemantic("traceHTTP", spanName, SpanKind.CLIENT, configure, fn);
85
85
  }
86
86
  function traceMessaging(config, fn) {
87
- if (!config || typeof config !== "object") throw new TypeError("traceMessaging: config must be an object");
88
- if (typeof config.system !== "string" || config.system.trim() === "") throw new TypeError("traceMessaging: config.system must be a non-empty string");
87
+ if (asRecord(config) === void 0) throw new TypeError("traceMessaging: config must be an object");
88
+ if (nonEmptyString(config.system) === void 0) throw new TypeError("traceMessaging: config.system must be a non-empty string");
89
89
  const operation = config.operation ?? "messaging";
90
90
  const spanName = [operation, config.destination].filter(Boolean).join(" ");
91
91
  const operationType = operation === "publish" ? "send" : operation;
@@ -1,3 +1,4 @@
1
+ import { s as asRecord } from "./values-BenyvWKz.js";
1
2
  import * as nodeCrypto from "node:crypto";
2
3
 
3
4
  //#region src/stable-hash.ts
@@ -8,10 +9,10 @@ import * as nodeCrypto from "node:crypto";
8
9
  * hashes.
9
10
  */
10
11
  function stableStringify(value) {
11
- if (value === null || value === void 0 || typeof value !== "object") return JSON.stringify(value);
12
12
  if (Array.isArray(value)) return "[" + value.map((v) => stableStringify(v)).join(",") + "]";
13
- const obj = value;
14
- return "{" + Object.keys(obj).toSorted().map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
13
+ const record = asRecord(value);
14
+ if (record === void 0) return JSON.stringify(value);
15
+ return "{" + Object.keys(record).toSorted().map((k) => JSON.stringify(k) + ":" + stableStringify(record[k])).join(",") + "}";
15
16
  }
16
17
  /** Stable sha256 of any JSON-serializable value. */
17
18
  function hashJson(value) {
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
2
+ const require_values = require('./values-DApyq53y.cjs');
2
3
  let node_crypto = require("node:crypto");
3
4
  node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
4
5
 
@@ -10,10 +11,10 @@ node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
10
11
  * hashes.
11
12
  */
12
13
  function stableStringify(value) {
13
- if (value === null || value === void 0 || typeof value !== "object") return JSON.stringify(value);
14
14
  if (Array.isArray(value)) return "[" + value.map((v) => stableStringify(v)).join(",") + "]";
15
- const obj = value;
16
- return "{" + Object.keys(obj).toSorted().map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
15
+ const record = require_values.asRecord(value);
16
+ if (record === void 0) return JSON.stringify(value);
17
+ return "{" + Object.keys(record).toSorted().map((k) => JSON.stringify(k) + ":" + stableStringify(record[k])).join(",") + "}";
17
18
  }
18
19
  /** Stable sha256 of any JSON-serializable value. */
19
20
  function hashJson(value) {
@@ -1,23 +1,34 @@
1
+ const require_values = require('./values-DApyq53y.cjs');
1
2
  let _opentelemetry_api = require("@opentelemetry/api");
2
3
 
3
4
  //#region src/flatten-attributes.ts
4
5
  /**
5
- * Convert an unknown value to an OTel-compatible AttributeValue.
6
- * Returns undefined when the value cannot be represented.
6
+ * Convert a value that arrived from outside to an OTel-compatible
7
+ * AttributeValue. Returns undefined when the value cannot be represented -
8
+ * which is how flattenToAttributes below learns it has an object to descend
9
+ * into rather than a leaf to record.
7
10
  */
8
11
  function toAttributeValue(value) {
9
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
10
- if (Array.isArray(value)) {
11
- if (value.every((v) => typeof v === "string") || value.every((v) => typeof v === "number") || value.every((v) => typeof v === "boolean")) return value;
12
- try {
13
- return JSON.stringify(value);
14
- } catch {
15
- return "<serialization-failed>";
16
- }
17
- }
12
+ const scalar = require_values.asString(value) ?? require_values.asNumber(value) ?? require_values.asBoolean(value);
13
+ if (scalar !== void 0) return scalar;
14
+ if (Array.isArray(value)) return toAttributeArray(value);
18
15
  if (value instanceof Date) return value.toISOString();
19
16
  if (value instanceof Error) return value.message;
20
17
  }
18
+ /** A homogeneous array as itself; anything else as the JSON it serialises to. */
19
+ function toAttributeArray(values) {
20
+ const strings = values.filter((v) => require_values.asString(v) !== void 0);
21
+ if (strings.length === values.length) return strings.map(String);
22
+ const numbers = values.filter((v) => require_values.asNumber(v) !== void 0);
23
+ if (numbers.length === values.length) return numbers.map(Number);
24
+ const booleans = values.filter((v) => require_values.asBoolean(v) !== void 0);
25
+ if (booleans.length === values.length) return booleans.map(Boolean);
26
+ try {
27
+ return JSON.stringify(values);
28
+ } catch {
29
+ return "<serialization-failed>";
30
+ }
31
+ }
21
32
  /**
22
33
  * Recursively flatten a nested object into dot-notation OTel attributes.
23
34
  * Includes circular reference protection via WeakSet.
@@ -34,13 +45,14 @@ function flattenToAttributes(fields, prefix = "") {
34
45
  out[nextKey] = attr;
35
46
  continue;
36
47
  }
37
- if (typeof value === "object" && value.constructor === Object) {
38
- if (seen.has(value)) {
48
+ const nested = require_values.asPlainRecord(value);
49
+ if (nested !== void 0) {
50
+ if (seen.has(nested)) {
39
51
  out[nextKey] = "<circular-reference>";
40
52
  continue;
41
53
  }
42
- seen.add(value);
43
- flatten(value, nextKey);
54
+ seen.add(nested);
55
+ flatten(nested, nextKey);
44
56
  continue;
45
57
  }
46
58
  try {
@@ -86,10 +98,8 @@ function createStructuredError(input) {
86
98
  if (error.link) lines.push(` Link: ${error.link}`);
87
99
  if (error.code !== void 0) lines.push(` Code: ${error.code}`);
88
100
  if (error.status !== void 0) lines.push(` Status: ${error.status}`);
89
- if (error.cause) {
90
- const cause = error.cause;
91
- lines.push(` Caused by: ${cause.name}: ${cause.message}`);
92
- }
101
+ if (error.cause instanceof Error) lines.push(` Caused by: ${error.cause.name}: ${error.cause.message}`);
102
+ else if (error.cause !== void 0) lines.push(` Caused by: ${String(error.cause)}`);
93
103
  return lines.join("\n");
94
104
  };
95
105
  return error;
@@ -115,22 +125,21 @@ function structuredErrorToJSON(error) {
115
125
  }
116
126
  function getStructuredErrorAttributes(error) {
117
127
  const structured = error;
118
- const attributes = {
119
- "error.type": error.name || "Error",
120
- "error.message": error.message
121
- };
128
+ const attributes = {};
129
+ attributes["error.type"] = error.name || "Error";
130
+ attributes["error.message"] = error.message;
122
131
  if (error.stack) attributes["error.stack"] = error.stack;
123
132
  if (structured.why) attributes["error.why"] = structured.why;
124
133
  if (structured.fix) attributes["error.fix"] = structured.fix;
125
134
  if (structured.link) attributes["error.link"] = structured.link;
126
- if (structured.code !== void 0) attributes["error.code"] = typeof structured.code === "string" ? structured.code : String(structured.code);
135
+ if (structured.code !== void 0) attributes["error.code"] = String(structured.code);
127
136
  if (structured.status !== void 0) attributes["error.status"] = structured.status;
128
137
  if (structured.details) Object.assign(attributes, flattenToAttributes(structured.details, "error.details"));
129
138
  return attributes;
130
139
  }
131
140
  function recordStructuredError(ctx, error) {
132
141
  const maybeRecordException = ctx.recordException;
133
- if (typeof maybeRecordException === "function") maybeRecordException(error);
142
+ if (require_values.isFunction(maybeRecordException)) maybeRecordException(error);
134
143
  ctx.setStatus({
135
144
  code: _opentelemetry_api.SpanStatusCode.ERROR,
136
145
  message: error.message
@@ -1,23 +1,34 @@
1
+ import { h as isFunction, i as asNumber, l as asString, o as asPlainRecord, t as asBoolean } from "./values-BenyvWKz.js";
1
2
  import { SpanStatusCode } from "@opentelemetry/api";
2
3
 
3
4
  //#region src/flatten-attributes.ts
4
5
  /**
5
- * Convert an unknown value to an OTel-compatible AttributeValue.
6
- * Returns undefined when the value cannot be represented.
6
+ * Convert a value that arrived from outside to an OTel-compatible
7
+ * AttributeValue. Returns undefined when the value cannot be represented -
8
+ * which is how flattenToAttributes below learns it has an object to descend
9
+ * into rather than a leaf to record.
7
10
  */
8
11
  function toAttributeValue(value) {
9
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
10
- if (Array.isArray(value)) {
11
- if (value.every((v) => typeof v === "string") || value.every((v) => typeof v === "number") || value.every((v) => typeof v === "boolean")) return value;
12
- try {
13
- return JSON.stringify(value);
14
- } catch {
15
- return "<serialization-failed>";
16
- }
17
- }
12
+ const scalar = asString(value) ?? asNumber(value) ?? asBoolean(value);
13
+ if (scalar !== void 0) return scalar;
14
+ if (Array.isArray(value)) return toAttributeArray(value);
18
15
  if (value instanceof Date) return value.toISOString();
19
16
  if (value instanceof Error) return value.message;
20
17
  }
18
+ /** A homogeneous array as itself; anything else as the JSON it serialises to. */
19
+ function toAttributeArray(values) {
20
+ const strings = values.filter((v) => asString(v) !== void 0);
21
+ if (strings.length === values.length) return strings.map(String);
22
+ const numbers = values.filter((v) => asNumber(v) !== void 0);
23
+ if (numbers.length === values.length) return numbers.map(Number);
24
+ const booleans = values.filter((v) => asBoolean(v) !== void 0);
25
+ if (booleans.length === values.length) return booleans.map(Boolean);
26
+ try {
27
+ return JSON.stringify(values);
28
+ } catch {
29
+ return "<serialization-failed>";
30
+ }
31
+ }
21
32
  /**
22
33
  * Recursively flatten a nested object into dot-notation OTel attributes.
23
34
  * Includes circular reference protection via WeakSet.
@@ -34,13 +45,14 @@ function flattenToAttributes(fields, prefix = "") {
34
45
  out[nextKey] = attr;
35
46
  continue;
36
47
  }
37
- if (typeof value === "object" && value.constructor === Object) {
38
- if (seen.has(value)) {
48
+ const nested = asPlainRecord(value);
49
+ if (nested !== void 0) {
50
+ if (seen.has(nested)) {
39
51
  out[nextKey] = "<circular-reference>";
40
52
  continue;
41
53
  }
42
- seen.add(value);
43
- flatten(value, nextKey);
54
+ seen.add(nested);
55
+ flatten(nested, nextKey);
44
56
  continue;
45
57
  }
46
58
  try {
@@ -86,10 +98,8 @@ function createStructuredError(input) {
86
98
  if (error.link) lines.push(` Link: ${error.link}`);
87
99
  if (error.code !== void 0) lines.push(` Code: ${error.code}`);
88
100
  if (error.status !== void 0) lines.push(` Status: ${error.status}`);
89
- if (error.cause) {
90
- const cause = error.cause;
91
- lines.push(` Caused by: ${cause.name}: ${cause.message}`);
92
- }
101
+ if (error.cause instanceof Error) lines.push(` Caused by: ${error.cause.name}: ${error.cause.message}`);
102
+ else if (error.cause !== void 0) lines.push(` Caused by: ${String(error.cause)}`);
93
103
  return lines.join("\n");
94
104
  };
95
105
  return error;
@@ -115,22 +125,21 @@ function structuredErrorToJSON(error) {
115
125
  }
116
126
  function getStructuredErrorAttributes(error) {
117
127
  const structured = error;
118
- const attributes = {
119
- "error.type": error.name || "Error",
120
- "error.message": error.message
121
- };
128
+ const attributes = {};
129
+ attributes["error.type"] = error.name || "Error";
130
+ attributes["error.message"] = error.message;
122
131
  if (error.stack) attributes["error.stack"] = error.stack;
123
132
  if (structured.why) attributes["error.why"] = structured.why;
124
133
  if (structured.fix) attributes["error.fix"] = structured.fix;
125
134
  if (structured.link) attributes["error.link"] = structured.link;
126
- if (structured.code !== void 0) attributes["error.code"] = typeof structured.code === "string" ? structured.code : String(structured.code);
135
+ if (structured.code !== void 0) attributes["error.code"] = String(structured.code);
127
136
  if (structured.status !== void 0) attributes["error.status"] = structured.status;
128
137
  if (structured.details) Object.assign(attributes, flattenToAttributes(structured.details, "error.details"));
129
138
  return attributes;
130
139
  }
131
140
  function recordStructuredError(ctx, error) {
132
141
  const maybeRecordException = ctx.recordException;
133
- if (typeof maybeRecordException === "function") maybeRecordException(error);
142
+ if (isFunction(maybeRecordException)) maybeRecordException(error);
134
143
  ctx.setStatus({
135
144
  code: SpanStatusCode.ERROR,
136
145
  message: error.message