autotel 7.6.1 → 7.7.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 (116) hide show
  1. package/NOTICE +9 -0
  2. package/dist/attribute-redacting-processor.cjs +1 -1
  3. package/dist/attribute-redacting-processor.js +1 -1
  4. package/dist/{attributes-DQQl-D6Q.js → attributes-De9Fx0b4.js} +1 -1
  5. package/dist/{attributes-DnfoMlA9.cjs → attributes-DkptT2Ck.cjs} +1 -1
  6. package/dist/attributes.cjs +1 -1
  7. package/dist/attributes.d.cts +1 -1
  8. package/dist/attributes.d.ts +1 -1
  9. package/dist/attributes.js +1 -1
  10. package/dist/auto.cjs +1 -1
  11. package/dist/auto.js +1 -1
  12. package/dist/business-baggage.cjs +1 -1
  13. package/dist/business-baggage.d.cts +1 -1
  14. package/dist/business-baggage.d.ts +1 -1
  15. package/dist/business-baggage.js +1 -1
  16. package/dist/{canonical-log-line-processor-CBv-OCp4.js → canonical-log-line-processor-BQ6NeZAk.js} +1 -1
  17. package/dist/{canonical-log-line-processor-B-tzezhk.cjs → canonical-log-line-processor-Bvgb1lE4.cjs} +1 -1
  18. package/dist/{correlated-events-CcuknWnU.cjs → correlated-events-9RRdfyWR.cjs} +1 -1
  19. package/dist/{correlated-events-DwMMbItg.js → correlated-events-BfpH5uS-.js} +1 -1
  20. package/dist/correlation-id.cjs +1 -1
  21. package/dist/correlation-id.js +1 -1
  22. package/dist/db.cjs +1 -1
  23. package/dist/db.js +1 -1
  24. package/dist/decorators.cjs +2 -2
  25. package/dist/decorators.d.cts +2 -2
  26. package/dist/decorators.d.ts +2 -2
  27. package/dist/decorators.js +2 -2
  28. package/dist/diagnostics.cjs +2 -2
  29. package/dist/diagnostics.js +2 -2
  30. package/dist/event.cjs +1 -1
  31. package/dist/event.js +1 -1
  32. package/dist/exception-fingerprint.cjs +1 -1
  33. package/dist/exception-fingerprint.js +1 -1
  34. package/dist/{functional-CgWcRXGX.d.cts → functional-C4mjgtJb.d.cts} +25 -2
  35. package/dist/{functional-zasLBPyX.cjs → functional-CJI0HCVJ.cjs} +113 -23
  36. package/dist/{functional-BXgTFVTA.js → functional-Cnga_Lnv.js} +109 -25
  37. package/dist/{functional-RFFpQzAV.d.ts → functional-DN_ztd9C.d.ts} +25 -2
  38. package/dist/functional.cjs +2 -1
  39. package/dist/functional.d.cts +3 -3
  40. package/dist/functional.d.ts +3 -3
  41. package/dist/functional.js +2 -2
  42. package/dist/http.cjs +2 -2
  43. package/dist/http.js +2 -2
  44. package/dist/{index-Y7If_wH4.d.cts → index-8bFU4kmd.d.cts} +1 -1
  45. package/dist/{index-CsoeCsGL.d.ts → index-o_6YjZhV.d.ts} +1 -1
  46. package/dist/index.cjs +9 -8
  47. package/dist/index.d.cts +14 -5
  48. package/dist/index.d.ts +14 -5
  49. package/dist/index.js +9 -9
  50. package/dist/{init-OSYC19sK.cjs → init-BYXDCfRL.cjs} +60 -23
  51. package/dist/{init-BHV2gWsV.d.ts → init-CKSMbJUG.d.ts} +17 -1
  52. package/dist/{init-Bst_BhiS.js → init-Dyq6WtsO.js} +60 -23
  53. package/dist/{init-DxmeJ3d0.d.cts → init-WwjD-kQu.d.cts} +17 -1
  54. package/dist/instrumentation.cjs +2 -2
  55. package/dist/instrumentation.js +2 -2
  56. package/dist/{logger-DdPp__xW.js → logger-B2VPcBgZ.js} +1 -1
  57. package/dist/{logger-Sm66cjKl.cjs → logger-CSdZkxbh.cjs} +1 -1
  58. package/dist/logger.cjs +1 -1
  59. package/dist/logger.js +1 -1
  60. package/dist/messaging-adapters.cjs +1 -1
  61. package/dist/messaging-adapters.js +1 -1
  62. package/dist/messaging.cjs +4 -4
  63. package/dist/messaging.d.cts +1 -1
  64. package/dist/messaging.d.ts +1 -1
  65. package/dist/messaging.js +4 -4
  66. package/dist/{node-require-EifOMikz.cjs → node-require-B_IVapV3.cjs} +1 -1
  67. package/dist/{node-require-DSPjaw_l.js → node-require-CkK_xzL-.js} +1 -1
  68. package/dist/parse-error.cjs +1 -1
  69. package/dist/parse-error.js +1 -1
  70. package/dist/policy.cjs +0 -0
  71. package/dist/policy.js +0 -0
  72. package/dist/processors.cjs +1 -1
  73. package/dist/processors.js +1 -1
  74. package/dist/sampling.cjs +1 -1
  75. package/dist/sampling.js +1 -1
  76. package/dist/semantic-helpers.cjs +2 -2
  77. package/dist/semantic-helpers.d.cts +1 -1
  78. package/dist/semantic-helpers.d.ts +1 -1
  79. package/dist/semantic-helpers.js +2 -2
  80. package/dist/{stable-hash-BkoAYVks.js → stable-hash-AOUgw1DW.js} +1 -1
  81. package/dist/{stable-hash-C0pOegH_.cjs → stable-hash-C9F6xjzx.cjs} +1 -1
  82. package/dist/{structured-error--_wXpd_C.cjs → structured-error-BAXhglRE.cjs} +48 -24
  83. package/dist/{structured-error-YIuka-FE.js → structured-error-Y9y-1Pae.js} +48 -24
  84. package/dist/tail-sampling-processor.cjs +1 -1
  85. package/dist/tail-sampling-processor.js +1 -1
  86. package/dist/test-span-collector.cjs +1 -1
  87. package/dist/test-span-collector.js +1 -1
  88. package/dist/testing.cjs +1 -1
  89. package/dist/testing.js +1 -1
  90. package/dist/{trace-context-f89xPJbK.d.ts → trace-context-CqCblIQE.d.ts} +12 -5
  91. package/dist/{trace-context-C1Cn1q0y.d.cts → trace-context-f7Xq0Q2q.d.cts} +12 -5
  92. package/dist/trace-helpers.cjs +6 -6
  93. package/dist/trace-helpers.js +6 -6
  94. package/dist/tracer-provider.cjs +1 -1
  95. package/dist/tracer-provider.js +1 -1
  96. package/dist/validate.cjs +3 -3
  97. package/dist/validate.js +3 -3
  98. package/dist/{values-DApyq53y.cjs → values-tm4bi0FF.cjs} +12 -2
  99. package/dist/{values-BenyvWKz.js → values-xBtdXtjA.js} +11 -1
  100. package/dist/webhook.cjs +3 -3
  101. package/dist/webhook.d.cts +1 -1
  102. package/dist/webhook.d.ts +1 -1
  103. package/dist/webhook.js +3 -3
  104. package/dist/workflow-distributed.cjs +3 -3
  105. package/dist/workflow-distributed.d.cts +1 -1
  106. package/dist/workflow-distributed.d.ts +1 -1
  107. package/dist/workflow-distributed.js +3 -3
  108. package/dist/workflow.cjs +3 -3
  109. package/dist/workflow.d.cts +1 -1
  110. package/dist/workflow.d.ts +1 -1
  111. package/dist/workflow.js +3 -3
  112. package/dist/yaml-config.cjs +1 -1
  113. package/dist/yaml-config.d.cts +2 -2
  114. package/dist/yaml-config.d.ts +2 -2
  115. package/dist/yaml-config.js +1 -1
  116. package/package.json +4 -2
@@ -1,14 +1,14 @@
1
- import { _ as readProperty, d as asStringRecord, f as describeValue, h as isFunction, i as asNumber, l as asString, r as asFunction, s as asRecord, t as asBoolean } from "./values-BenyvWKz.js";
1
+ import { _ as readProperty, d as asStringRecord, f as describeValue, h as isFunction, i as asNumber, l as asString, r as asFunction, s as asRecord, t as asBoolean } from "./values-xBtdXtjA.js";
2
2
  import { getForceFlushableProvider } from "./tracer-provider.js";
3
3
  import { getConfig as getConfig$1 } from "./config.js";
4
- import { r as recordStructuredError } from "./structured-error-YIuka-FE.js";
5
- import { n as safeRequire, t as requireModule } from "./node-require-DSPjaw_l.js";
4
+ import { a as flattenToAttributes, o as toAttributeValue, r as recordStructuredError } from "./structured-error-Y9y-1Pae.js";
5
+ import { n as safeRequire, t as requireModule } from "./node-require-CkK_xzL-.js";
6
6
  import { FilteringSpanProcessor } from "./filtering-span-processor.js";
7
7
  import { PolicyLogRecordProcessor, policySpanFilter, setPolicies, watchPolicyFile } from "./policy.js";
8
8
  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
- import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CBv-OCp4.js";
11
+ import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-BQ6NeZAk.js";
12
12
  import { resetMetrics } from "./metric.js";
13
13
  import { NodeSDK } from "@opentelemetry/sdk-node";
14
14
  import { AlwaysOffSampler, AlwaysOnSampler, BatchSpanProcessor, ConsoleSpanExporter, ParentBasedSampler, SamplingDecision, SimpleSpanProcessor, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
@@ -1001,8 +1001,17 @@ function createTraceContext(span) {
1001
1001
  traceId: spanContext.traceId,
1002
1002
  spanId: spanContext.spanId,
1003
1003
  correlationId: spanContext.traceId.slice(0, 16),
1004
- setAttribute: span.setAttribute.bind(span),
1005
- setAttributes: span.setAttributes.bind(span),
1004
+ setAttribute: (key, value) => {
1005
+ const attr = toAttributeValue(value);
1006
+ if (attr === void 0) {
1007
+ span.setAttributes(flattenToAttributes({ [key]: value }));
1008
+ return;
1009
+ }
1010
+ span.setAttribute(key, attr);
1011
+ },
1012
+ setAttributes: (attrs) => {
1013
+ span.setAttributes(flattenToAttributes(attrs));
1014
+ },
1006
1015
  setStatus: (status) => {
1007
1016
  spansWithExplicitStatus.add(span);
1008
1017
  span.setStatus(status);
@@ -3781,6 +3790,44 @@ const INSTRUMENTATION_CLASS_TO_PACKAGE = new Map(Object.entries({
3781
3790
  MySQL2Instrumentation: "@opentelemetry/instrumentation-mysql2"
3782
3791
  }));
3783
3792
  /**
3793
+ * What autotel configures when the caller has not said otherwise.
3794
+ *
3795
+ * `instrumentation-express` opens a span per layer and runs the layer under it,
3796
+ * so whatever is active inside a middleware is that layer's span - one that
3797
+ * ends the moment `next()` fires. Request-wide attributes set there would land
3798
+ * on `middleware - anonymous` rather than on the request span every backend
3799
+ * shows as the resource. Ignoring the two leaf layer types puts them back on
3800
+ * the request span and drops a pile of noise spans with them; the route rename
3801
+ * (`GET /users/:id`) survives, because `rpcMetadata.route` is assigned before
3802
+ * the ignore check.
3803
+ *
3804
+ * Pass your own `ignoreLayersType` - `[]` for the upstream behaviour - to
3805
+ * override it, or `ignoreLayers` to silence only the noisy paths.
3806
+ */
3807
+ const AUTOTEL_DEFAULTS = { "@opentelemetry/instrumentation-express": { ignoreLayersType: ["middleware", "request_handler"] } };
3808
+ /** Apply {@link AUTOTEL_DEFAULTS} under whatever the caller already chose. */
3809
+ function withAutotelDefaults(config) {
3810
+ const merged = { ...config };
3811
+ for (const [packageName, defaults] of Object.entries(AUTOTEL_DEFAULTS)) {
3812
+ const options = merged[packageName];
3813
+ if (options?.enabled === false) continue;
3814
+ merged[packageName] = {
3815
+ ...defaults,
3816
+ ...options
3817
+ };
3818
+ }
3819
+ return merged;
3820
+ }
3821
+ /**
3822
+ * `express` and `@opentelemetry/instrumentation-express` name the same thing.
3823
+ * `getNodeAutoInstrumentations` only answers to the full name - it
3824
+ * `diag.error`s anything else and ignores the config - so the short form every
3825
+ * autotel example uses has to be expanded before it gets there.
3826
+ */
3827
+ function toPackageName(name) {
3828
+ return name.startsWith("@opentelemetry/instrumentation-") ? name : `@opentelemetry/instrumentation-${name}`;
3829
+ }
3830
+ /**
3784
3831
  * Detect if we're running in ESM mode
3785
3832
  */
3786
3833
  function isESMMode() {
@@ -3835,24 +3882,14 @@ function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @
3835
3882
  const packageName = INSTRUMENTATION_CLASS_TO_PACKAGE.get(className);
3836
3883
  if (packageName) exclusionConfig[packageName] = { enabled: false };
3837
3884
  }
3838
- if (integrations === true) {
3839
- if (Object.keys(exclusionConfig).length > 0) return getNodeAutoInstrumentations(exclusionConfig);
3840
- return getNodeAutoInstrumentations();
3885
+ const config = { ...exclusionConfig };
3886
+ const requested = integrations === true ? [] : Array.isArray(integrations) ? integrations.map((name) => [name, { enabled: true }]) : Object.entries(integrations);
3887
+ for (const [name, options] of requested) {
3888
+ const packageName = toPackageName(name);
3889
+ if (packageName in exclusionConfig) continue;
3890
+ config[packageName] = options;
3841
3891
  }
3842
- if (Array.isArray(integrations)) {
3843
- const config = { ...exclusionConfig };
3844
- for (const name of integrations) {
3845
- const packageName = `@opentelemetry/instrumentation-${name}`;
3846
- if (!exclusionConfig[packageName]) config[packageName] = { enabled: true };
3847
- }
3848
- return getNodeAutoInstrumentations(config);
3849
- }
3850
- const config = {
3851
- ...exclusionConfig,
3852
- ...integrations
3853
- };
3854
- for (const packageName of Object.keys(exclusionConfig)) if (Object.keys(integrations).find((key) => packageName.includes(key))) config[packageName] = { enabled: false };
3855
- return getNodeAutoInstrumentations(config);
3892
+ return getNodeAutoInstrumentations(withAutotelDefaults(config));
3856
3893
  }
3857
3894
 
3858
3895
  //#endregion
@@ -468,6 +468,22 @@ interface AutotelConfig {
468
468
  * })
469
469
  * ```
470
470
  *
471
+ * @example Pass options to an instrumentation
472
+ * Anything beyond `enabled` goes to that instrumentation's constructor, and
473
+ * overrides what autotel defaults it to. Express defaults to
474
+ * `ignoreLayersType: ['middleware', 'request_handler']`, which keeps
475
+ * attributes set from a middleware on the request span; `[]` asks for the
476
+ * per-layer spans back.
477
+ * ```typescript
478
+ * init({
479
+ * service: 'my-app',
480
+ * autoInstrumentations: {
481
+ * http: { enabled: true },
482
+ * express: { ignoreLayersType: [] }
483
+ * }
484
+ * })
485
+ * ```
486
+ *
471
487
  * @example Manual config when you need custom settings
472
488
  * ```typescript
473
489
  * import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb'
@@ -485,7 +501,7 @@ interface AutotelConfig {
485
501
  */
486
502
  autoInstrumentations?: string[] | boolean | Record<string, {
487
503
  enabled?: boolean;
488
- }>;
504
+ } & Record<string, unknown>>;
489
505
  /**
490
506
  * OTLP endpoint for traces/metrics/logs
491
507
  * Single-destination shorthand. For multi-backend OTLP fan-out, use
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-OSYC19sK.cjs');
3
- const require_node_require = require('./node-require-EifOMikz.cjs');
2
+ const require_init = require('./init-BYXDCfRL.cjs');
3
+ const require_node_require = require('./node-require-B_IVapV3.cjs');
4
4
  let _opentelemetry_sdk_node = require("@opentelemetry/sdk-node");
5
5
  let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
6
6
  let _opentelemetry_resources = require("@opentelemetry/resources");
@@ -1,5 +1,5 @@
1
- import { r as getLogger, x as TailSamplingSpanProcessor } from "./init-Bst_BhiS.js";
2
- import { n as safeRequire, t as requireModule } from "./node-require-DSPjaw_l.js";
1
+ import { r as getLogger, x as TailSamplingSpanProcessor } from "./init-Dyq6WtsO.js";
2
+ import { n as safeRequire, t as requireModule } from "./node-require-CkK_xzL-.js";
3
3
  import { NodeSDK } from "@opentelemetry/sdk-node";
4
4
  import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
5
5
  import { detectResources, hostDetector, processDetector, resourceFromAttributes } from "@opentelemetry/resources";
@@ -1,4 +1,4 @@
1
- import { l as asString, s as asRecord } from "./values-BenyvWKz.js";
1
+ import { l as asString, s as asRecord } from "./values-xBtdXtjA.js";
2
2
  import { getConfig } from "./config.js";
3
3
  import { SpanStatusCode, context, createContextKey, trace } from "@opentelemetry/api";
4
4
 
@@ -1,4 +1,4 @@
1
- const require_values = require('./values-DApyq53y.cjs');
1
+ const require_values = require('./values-tm4bi0FF.cjs');
2
2
  const require_config = require('./config.cjs');
3
3
  let _opentelemetry_api = require("@opentelemetry/api");
4
4
 
package/dist/logger.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_logger = require('./logger-Sm66cjKl.cjs');
2
+ const require_logger = require('./logger-CSdZkxbh.cjs');
3
3
 
4
4
  exports.LOG_LEVEL = require_logger.LOG_LEVEL;
5
5
  exports.LoggedOperation = require_logger.LoggedOperation;
package/dist/logger.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as getActiveLogLevel, i as createBuiltinLogger, n as LoggedOperation, o as getTraceContext, r as autotelLogger, s as runWithLogLevel, t as LOG_LEVEL } from "./logger-DdPp__xW.js";
1
+ import { a as getActiveLogLevel, i as createBuiltinLogger, n as LoggedOperation, o as getTraceContext, r as autotelLogger, s as runWithLogLevel, t as LOG_LEVEL } from "./logger-B2VPcBgZ.js";
2
2
 
3
3
  export { LOG_LEVEL, LoggedOperation, autotelLogger, createBuiltinLogger, getActiveLogLevel, getTraceContext, runWithLogLevel };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-DApyq53y.cjs');
2
+ const require_values = require('./values-tm4bi0FF.cjs');
3
3
  let _opentelemetry_api = require("@opentelemetry/api");
4
4
 
5
5
  //#region src/messaging-adapters.ts
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, l as asString, r as asFunction, s as asRecord } from "./values-BenyvWKz.js";
1
+ import { _ as readProperty, l as asString, r as asFunction, s as asRecord } from "./values-xBtdXtjA.js";
2
2
  import { TraceFlags } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/messaging-adapters.ts
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-DApyq53y.cjs');
3
- const require_init = require('./init-OSYC19sK.cjs');
4
- const require_functional = require('./functional-zasLBPyX.cjs');
5
- const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
2
+ const require_values = require('./values-tm4bi0FF.cjs');
3
+ const require_init = require('./init-BYXDCfRL.cjs');
4
+ const require_functional = require('./functional-CJI0HCVJ.cjs');
5
+ const require_correlated_events = require('./correlated-events-9RRdfyWR.cjs');
6
6
  const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
 
@@ -1,4 +1,4 @@
1
- import { n as TraceContext } from "./trace-context-C1Cn1q0y.cjs";
1
+ import { n as TraceContext } from "./trace-context-f7Xq0Q2q.cjs";
2
2
  import { Attributes, Link, SpanContext } from "@opentelemetry/api";
3
3
  //#region src/messaging.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as TraceContext } from "./trace-context-f89xPJbK.js";
1
+ import { n as TraceContext } from "./trace-context-CqCblIQE.js";
2
2
  import { Attributes, Link, SpanContext } from "@opentelemetry/api";
3
3
  //#region src/messaging.d.ts
4
4
  /**
package/dist/messaging.js CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as readProperty, b as toAttributeValue, c as asScalar, g as nonEmptyString, h as isFunction, s as asRecord, v as resolveValue, y as splitNameOrOptions } from "./values-BenyvWKz.js";
2
- import { F as createLinkFromHeaders, L as extractLinksFromBatch } from "./init-Bst_BhiS.js";
3
- import { c as withTracing } from "./functional-BXgTFVTA.js";
4
- import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
1
+ import { _ as readProperty, b as toAttributeValue, c as asScalar, g as nonEmptyString, h as isFunction, s as asRecord, v as resolveValue, y as splitNameOrOptions } from "./values-xBtdXtjA.js";
2
+ import { F as createLinkFromHeaders, L as extractLinksFromBatch } from "./init-Dyq6WtsO.js";
3
+ import { l as withTracing } from "./functional-Cnga_Lnv.js";
4
+ import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
5
5
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
6
6
  import { SpanKind, context, propagation } from "@opentelemetry/api";
7
7
 
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
2
- const require_values = require('./values-DApyq53y.cjs');
2
+ const require_values = require('./values-tm4bi0FF.cjs');
3
3
  let node_module = require("node:module");
4
4
  node_module = require_rolldown_runtime.__toESM(node_module, 1);
5
5
 
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, l as asString } from "./values-BenyvWKz.js";
1
+ import { _ as readProperty, l as asString } from "./values-xBtdXtjA.js";
2
2
  import * as nodeModule from "node:module";
3
3
 
4
4
  //#region src/node-require.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-DApyq53y.cjs');
2
+ const require_values = require('./values-tm4bi0FF.cjs');
3
3
 
4
4
  //#region src/parse-error.ts
5
5
  /** An HTTP-ish status, however the library that threw chose to spell it. */
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, i as asNumber, l as asString, s as asRecord } from "./values-BenyvWKz.js";
1
+ import { _ as readProperty, i as asNumber, l as asString, s as asRecord } from "./values-xBtdXtjA.js";
2
2
 
3
3
  //#region src/parse-error.ts
4
4
  /** An HTTP-ish status, however the library that threw chose to spell it. */
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-B-tzezhk.cjs');
2
+ const require_canonical_log_line_processor = require('./canonical-log-line-processor-Bvgb1lE4.cjs');
3
3
  let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
4
4
 
5
5
  Object.defineProperty(exports, 'BatchSpanProcessor', {
@@ -1,4 +1,4 @@
1
- import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CBv-OCp4.js";
1
+ import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-BQ6NeZAk.js";
2
2
  import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
3
3
 
4
4
  export { BatchSpanProcessor, CanonicalLogLineProcessor, SimpleSpanProcessor };
package/dist/sampling.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-OSYC19sK.cjs');
2
+ const require_init = require('./init-BYXDCfRL.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 FeatureFlagSampler, B as markForceKept, C as AUTOTEL_SAMPLING_RATE, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, I as debugCaptureRequested, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, O as CompositeSampler, P as UserIdSampler, R as hashUnitInterval, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, V as resolveSamplingPreset, j as KeyTargetRateSampler, k as DeterministicSampler, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, z as isForceKept } from "./init-Bst_BhiS.js";
1
+ import { A as FeatureFlagSampler, B as markForceKept, C as AUTOTEL_SAMPLING_RATE, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, I as debugCaptureRequested, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, O as CompositeSampler, P as UserIdSampler, R as hashUnitInterval, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, V as resolveSamplingPreset, j as KeyTargetRateSampler, k as DeterministicSampler, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, z as isForceKept } from "./init-Dyq6WtsO.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-DApyq53y.cjs');
3
- const require_functional = require('./functional-zasLBPyX.cjs');
2
+ const require_values = require('./values-tm4bi0FF.cjs');
3
+ const require_functional = require('./functional-CJI0HCVJ.cjs');
4
4
  const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
6
6
 
@@ -1,4 +1,4 @@
1
- import { n as TraceContext } from "./trace-context-C1Cn1q0y.cjs";
1
+ import { n as TraceContext } from "./trace-context-f7Xq0Q2q.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-f89xPJbK.js";
1
+ import { n as TraceContext } from "./trace-context-CqCblIQE.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,5 +1,5 @@
1
- import { b as toAttributeValue, g as nonEmptyString, s as asRecord } from "./values-BenyvWKz.js";
2
- import { c as withTracing } from "./functional-BXgTFVTA.js";
1
+ import { b as toAttributeValue, g as nonEmptyString, s as asRecord } from "./values-xBtdXtjA.js";
2
+ import { l as withTracing } from "./functional-Cnga_Lnv.js";
3
3
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
4
4
  import { SpanKind } from "@opentelemetry/api";
5
5
 
@@ -1,4 +1,4 @@
1
- import { s as asRecord } from "./values-BenyvWKz.js";
1
+ import { s as asRecord } from "./values-xBtdXtjA.js";
2
2
  import * as nodeCrypto from "node:crypto";
3
3
 
4
4
  //#region src/stable-hash.ts
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
2
- const require_values = require('./values-DApyq53y.cjs');
2
+ const require_values = require('./values-tm4bi0FF.cjs');
3
3
  let node_crypto = require("node:crypto");
4
4
  node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
5
5
 
@@ -1,19 +1,34 @@
1
- const require_values = require('./values-DApyq53y.cjs');
1
+ const require_values = require('./values-tm4bi0FF.cjs');
2
2
  let _opentelemetry_api = require("@opentelemetry/api");
3
3
 
4
4
  //#region src/flatten-attributes.ts
5
+ /** What a value that cannot be represented is recorded as. */
6
+ const INVALID_DATE = "<invalid-date>";
7
+ const INVALID_NUMBER = "<invalid-number>";
8
+ const SERIALIZATION_FAILED = "<serialization-failed>";
9
+ const CIRCULAR_REFERENCE = "<circular-reference>";
5
10
  /**
6
11
  * Convert a value that arrived from outside to an OTel-compatible
7
12
  * AttributeValue. Returns undefined when the value cannot be represented -
8
13
  * which is how flattenToAttributes below learns it has an object to descend
9
14
  * into rather than a leaf to record.
15
+ *
16
+ * Total by construction: this runs on whatever an application hands an
17
+ * attribute setter, so a value that cannot be read is a marker in the
18
+ * telemetry, never an exception on the request path.
10
19
  */
11
20
  function toAttributeValue(value) {
12
21
  const scalar = require_values.asString(value) ?? require_values.asNumber(value) ?? require_values.asBoolean(value);
13
22
  if (scalar !== void 0) return scalar;
14
- if (Array.isArray(value)) return toAttributeArray(value);
15
- if (value instanceof Date) return value.toISOString();
16
- if (value instanceof Error) return value.message;
23
+ if (typeof value === "number") return INVALID_NUMBER;
24
+ try {
25
+ if (Array.isArray(value)) return toAttributeArray(value);
26
+ if (value instanceof Set) return toAttributeArray([...value]);
27
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? INVALID_DATE : value.toISOString();
28
+ if (value instanceof Error) return value.message;
29
+ } catch {
30
+ return SERIALIZATION_FAILED;
31
+ }
17
32
  }
18
33
  /** A homogeneous array as itself; anything else as the JSON it serialises to. */
19
34
  function toAttributeArray(values) {
@@ -26,43 +41,52 @@ function toAttributeArray(values) {
26
41
  try {
27
42
  return JSON.stringify(values);
28
43
  } catch {
29
- return "<serialization-failed>";
44
+ return SERIALIZATION_FAILED;
30
45
  }
31
46
  }
32
47
  /**
33
48
  * Recursively flatten a nested object into dot-notation OTel attributes.
34
49
  * Includes circular reference protection via WeakSet.
50
+ *
51
+ * Every key is converted inside its own guard, so one value that cannot be read
52
+ * - a getter that throws, an exotic proxy, a `Map` whose key has no string form
53
+ * - costs that key alone and never the call. Keys are listed before their
54
+ * values are read, so a sibling of the bad value still lands.
35
55
  */
36
56
  function flattenToAttributes(fields, prefix = "") {
37
57
  const out = {};
38
58
  const seen = /* @__PURE__ */ new WeakSet();
39
59
  function flatten(obj, currentPrefix) {
40
- for (const [key, value] of Object.entries(obj)) {
41
- if (value == null) continue;
60
+ for (const key of Object.keys(obj)) {
42
61
  const nextKey = currentPrefix ? `${currentPrefix}.${key}` : key;
43
- const attr = toAttributeValue(value);
44
- if (attr !== void 0) {
45
- out[nextKey] = attr;
46
- continue;
47
- }
48
- const nested = require_values.asPlainRecord(value);
49
- if (nested !== void 0) {
50
- if (seen.has(nested)) {
51
- out[nextKey] = "<circular-reference>";
62
+ try {
63
+ const value = obj[key];
64
+ if (value == null) continue;
65
+ const attr = toAttributeValue(value);
66
+ if (attr !== void 0) {
67
+ out[nextKey] = attr;
52
68
  continue;
53
69
  }
54
- seen.add(nested);
55
- flatten(nested, nextKey);
56
- continue;
57
- }
58
- try {
59
- out[nextKey] = JSON.stringify(value);
70
+ const nested = require_values.asPlainRecordOrMap(value);
71
+ if (nested !== void 0) {
72
+ if (seen.has(value)) {
73
+ out[nextKey] = CIRCULAR_REFERENCE;
74
+ continue;
75
+ }
76
+ seen.add(value);
77
+ flatten(nested, nextKey);
78
+ continue;
79
+ }
80
+ const json = JSON.stringify(value);
81
+ if (json !== void 0) out[nextKey] = json;
60
82
  } catch {
61
- out[nextKey] = "<serialization-failed>";
83
+ out[nextKey] = SERIALIZATION_FAILED;
62
84
  }
63
85
  }
64
86
  }
65
- flatten(fields, prefix);
87
+ try {
88
+ flatten(fields, prefix);
89
+ } catch {}
66
90
  return out;
67
91
  }
68
92
 
@@ -1,19 +1,34 @@
1
- import { h as isFunction, i as asNumber, l as asString, o as asPlainRecord, t as asBoolean } from "./values-BenyvWKz.js";
1
+ import { h as isFunction, i as asNumber, l as asString, o as asPlainRecordOrMap, t as asBoolean } from "./values-xBtdXtjA.js";
2
2
  import { SpanStatusCode } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/flatten-attributes.ts
5
+ /** What a value that cannot be represented is recorded as. */
6
+ const INVALID_DATE = "<invalid-date>";
7
+ const INVALID_NUMBER = "<invalid-number>";
8
+ const SERIALIZATION_FAILED = "<serialization-failed>";
9
+ const CIRCULAR_REFERENCE = "<circular-reference>";
5
10
  /**
6
11
  * Convert a value that arrived from outside to an OTel-compatible
7
12
  * AttributeValue. Returns undefined when the value cannot be represented -
8
13
  * which is how flattenToAttributes below learns it has an object to descend
9
14
  * into rather than a leaf to record.
15
+ *
16
+ * Total by construction: this runs on whatever an application hands an
17
+ * attribute setter, so a value that cannot be read is a marker in the
18
+ * telemetry, never an exception on the request path.
10
19
  */
11
20
  function toAttributeValue(value) {
12
21
  const scalar = asString(value) ?? asNumber(value) ?? asBoolean(value);
13
22
  if (scalar !== void 0) return scalar;
14
- if (Array.isArray(value)) return toAttributeArray(value);
15
- if (value instanceof Date) return value.toISOString();
16
- if (value instanceof Error) return value.message;
23
+ if (typeof value === "number") return INVALID_NUMBER;
24
+ try {
25
+ if (Array.isArray(value)) return toAttributeArray(value);
26
+ if (value instanceof Set) return toAttributeArray([...value]);
27
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? INVALID_DATE : value.toISOString();
28
+ if (value instanceof Error) return value.message;
29
+ } catch {
30
+ return SERIALIZATION_FAILED;
31
+ }
17
32
  }
18
33
  /** A homogeneous array as itself; anything else as the JSON it serialises to. */
19
34
  function toAttributeArray(values) {
@@ -26,43 +41,52 @@ function toAttributeArray(values) {
26
41
  try {
27
42
  return JSON.stringify(values);
28
43
  } catch {
29
- return "<serialization-failed>";
44
+ return SERIALIZATION_FAILED;
30
45
  }
31
46
  }
32
47
  /**
33
48
  * Recursively flatten a nested object into dot-notation OTel attributes.
34
49
  * Includes circular reference protection via WeakSet.
50
+ *
51
+ * Every key is converted inside its own guard, so one value that cannot be read
52
+ * - a getter that throws, an exotic proxy, a `Map` whose key has no string form
53
+ * - costs that key alone and never the call. Keys are listed before their
54
+ * values are read, so a sibling of the bad value still lands.
35
55
  */
36
56
  function flattenToAttributes(fields, prefix = "") {
37
57
  const out = {};
38
58
  const seen = /* @__PURE__ */ new WeakSet();
39
59
  function flatten(obj, currentPrefix) {
40
- for (const [key, value] of Object.entries(obj)) {
41
- if (value == null) continue;
60
+ for (const key of Object.keys(obj)) {
42
61
  const nextKey = currentPrefix ? `${currentPrefix}.${key}` : key;
43
- const attr = toAttributeValue(value);
44
- if (attr !== void 0) {
45
- out[nextKey] = attr;
46
- continue;
47
- }
48
- const nested = asPlainRecord(value);
49
- if (nested !== void 0) {
50
- if (seen.has(nested)) {
51
- out[nextKey] = "<circular-reference>";
62
+ try {
63
+ const value = obj[key];
64
+ if (value == null) continue;
65
+ const attr = toAttributeValue(value);
66
+ if (attr !== void 0) {
67
+ out[nextKey] = attr;
52
68
  continue;
53
69
  }
54
- seen.add(nested);
55
- flatten(nested, nextKey);
56
- continue;
57
- }
58
- try {
59
- out[nextKey] = JSON.stringify(value);
70
+ const nested = asPlainRecordOrMap(value);
71
+ if (nested !== void 0) {
72
+ if (seen.has(value)) {
73
+ out[nextKey] = CIRCULAR_REFERENCE;
74
+ continue;
75
+ }
76
+ seen.add(value);
77
+ flatten(nested, nextKey);
78
+ continue;
79
+ }
80
+ const json = JSON.stringify(value);
81
+ if (json !== void 0) out[nextKey] = json;
60
82
  } catch {
61
- out[nextKey] = "<serialization-failed>";
83
+ out[nextKey] = SERIALIZATION_FAILED;
62
84
  }
63
85
  }
64
86
  }
65
- flatten(fields, prefix);
87
+ try {
88
+ flatten(fields, prefix);
89
+ } catch {}
66
90
  return out;
67
91
  }
68
92
 
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-OSYC19sK.cjs');
2
+ const require_init = require('./init-BYXDCfRL.cjs');
3
3
 
4
4
  exports.TailSamplingSpanProcessor = require_init.TailSamplingSpanProcessor;
@@ -1,3 +1,3 @@
1
- import { x as TailSamplingSpanProcessor } from "./init-Bst_BhiS.js";
1
+ import { x as TailSamplingSpanProcessor } from "./init-Dyq6WtsO.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-DApyq53y.cjs');
2
+ const require_values = require('./values-tm4bi0FF.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-BenyvWKz.js";
1
+ import { a as asNumberArray, c as asScalar, n as asBooleanArray, u as asStringArray } from "./values-xBtdXtjA.js";
2
2
  import { SpanStatusCode } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/test-span-collector.ts
package/dist/testing.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
3
- const require_values = require('./values-DApyq53y.cjs');
3
+ const require_values = require('./values-tm4bi0FF.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');