autotel 2.25.2 → 2.25.3

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 (113) hide show
  1. package/README.md +152 -1
  2. package/dist/attributes.d.cts +2 -2
  3. package/dist/attributes.d.ts +2 -2
  4. package/dist/auto.cjs +6 -6
  5. package/dist/auto.js +4 -4
  6. package/dist/{chunk-QUW4I2OI.js → chunk-3ZLYWPMY.js} +3 -3
  7. package/dist/{chunk-QUW4I2OI.js.map → chunk-3ZLYWPMY.js.map} +1 -1
  8. package/dist/{chunk-BGVKKL2N.cjs → chunk-7FIGORWI.cjs} +46 -2
  9. package/dist/chunk-7FIGORWI.cjs.map +1 -0
  10. package/dist/{chunk-MNMLCLHH.cjs → chunk-AQXPGGQK.cjs} +5 -5
  11. package/dist/{chunk-MNMLCLHH.cjs.map → chunk-AQXPGGQK.cjs.map} +1 -1
  12. package/dist/{chunk-4KGC5N3J.cjs → chunk-FXKB7EPR.cjs} +13 -13
  13. package/dist/{chunk-4KGC5N3J.cjs.map → chunk-FXKB7EPR.cjs.map} +1 -1
  14. package/dist/{chunk-4SCBD22Z.js → chunk-IFKDBL65.js} +3 -3
  15. package/dist/{chunk-4SCBD22Z.js.map → chunk-IFKDBL65.js.map} +1 -1
  16. package/dist/{chunk-JVICEM6W.cjs → chunk-ITYASFHQ.cjs} +91 -19
  17. package/dist/chunk-ITYASFHQ.cjs.map +1 -0
  18. package/dist/{chunk-IKRHEUS7.js → chunk-JM63D22M.js} +10 -10
  19. package/dist/{chunk-IKRHEUS7.js.map → chunk-JM63D22M.js.map} +1 -1
  20. package/dist/{chunk-GVLK7YUU.cjs → chunk-KZEC4CHV.cjs} +6 -4
  21. package/dist/chunk-KZEC4CHV.cjs.map +1 -0
  22. package/dist/{chunk-VXLEJWLY.js → chunk-MNBAXRVG.js} +89 -17
  23. package/dist/chunk-MNBAXRVG.js.map +1 -0
  24. package/dist/{chunk-6YIDHH2S.cjs → chunk-OFPZULMQ.cjs} +32 -10
  25. package/dist/chunk-OFPZULMQ.cjs.map +1 -0
  26. package/dist/{chunk-UKUYBUFQ.cjs → chunk-OWXXS4JB.cjs} +7 -7
  27. package/dist/{chunk-UKUYBUFQ.cjs.map → chunk-OWXXS4JB.cjs.map} +1 -1
  28. package/dist/{chunk-77PLEJ54.js → chunk-PKXD2RMI.js} +4 -4
  29. package/dist/{chunk-77PLEJ54.js.map → chunk-PKXD2RMI.js.map} +1 -1
  30. package/dist/{chunk-RWOVNF3V.cjs → chunk-RMGSBMQF.cjs} +36 -36
  31. package/dist/chunk-RMGSBMQF.cjs.map +1 -0
  32. package/dist/{chunk-YTGF4L2C.js → chunk-RUD7KS4R.js} +27 -5
  33. package/dist/chunk-RUD7KS4R.js.map +1 -0
  34. package/dist/{chunk-KUSYIHW7.js → chunk-VVYSQXQL.js} +3 -3
  35. package/dist/{chunk-KUSYIHW7.js.map → chunk-VVYSQXQL.js.map} +1 -1
  36. package/dist/{chunk-XND7WBVX.js → chunk-VYA6QDNA.js} +43 -3
  37. package/dist/chunk-VYA6QDNA.js.map +1 -0
  38. package/dist/{chunk-L627YSSP.cjs → chunk-WOWTZ4EB.cjs} +9 -9
  39. package/dist/{chunk-L627YSSP.cjs.map → chunk-WOWTZ4EB.cjs.map} +1 -1
  40. package/dist/{chunk-X4RMFFMR.js → chunk-XDKK53OL.js} +6 -4
  41. package/dist/chunk-XDKK53OL.js.map +1 -0
  42. package/dist/decorators.cjs +5 -5
  43. package/dist/decorators.js +5 -5
  44. package/dist/event.cjs +8 -8
  45. package/dist/event.js +5 -5
  46. package/dist/functional.cjs +12 -12
  47. package/dist/functional.js +5 -5
  48. package/dist/index.cjs +71 -51
  49. package/dist/index.d.cts +4 -4
  50. package/dist/index.d.ts +4 -4
  51. package/dist/index.js +13 -13
  52. package/dist/{init-Q4uIQKbq.d.cts → init-CIzpC5kZ.d.cts} +9 -2
  53. package/dist/{init-ls4xSZe5.d.ts → init-C_PiC_Su.d.ts} +9 -2
  54. package/dist/instrumentation.cjs +12 -12
  55. package/dist/instrumentation.cjs.map +1 -1
  56. package/dist/instrumentation.js +4 -4
  57. package/dist/instrumentation.js.map +1 -1
  58. package/dist/messaging-adapters.d.cts +1 -1
  59. package/dist/messaging-adapters.d.ts +1 -1
  60. package/dist/messaging.cjs +9 -9
  61. package/dist/messaging.d.cts +1 -1
  62. package/dist/messaging.d.ts +1 -1
  63. package/dist/messaging.js +6 -6
  64. package/dist/metric-helpers.d.cts +1 -1
  65. package/dist/metric-helpers.d.ts +1 -1
  66. package/dist/sampling.cjs +26 -10
  67. package/dist/sampling.d.cts +49 -1
  68. package/dist/sampling.d.ts +49 -1
  69. package/dist/sampling.js +1 -1
  70. package/dist/semantic-helpers.cjs +10 -10
  71. package/dist/semantic-helpers.js +6 -6
  72. package/dist/tail-sampling-processor.cjs +6 -2
  73. package/dist/tail-sampling-processor.d.cts +2 -2
  74. package/dist/tail-sampling-processor.d.ts +2 -2
  75. package/dist/tail-sampling-processor.js +5 -1
  76. package/dist/trace-helpers.d.cts +1 -1
  77. package/dist/trace-helpers.d.ts +1 -1
  78. package/dist/{utils-D1trOLNm.d.ts → utils-Buel3cj0.d.ts} +1 -1
  79. package/dist/{utils-DuNJfXSH.d.cts → utils-CbUkl8r1.d.cts} +1 -1
  80. package/dist/webhook.cjs +6 -6
  81. package/dist/webhook.js +5 -5
  82. package/dist/workflow-distributed.cjs +7 -7
  83. package/dist/workflow-distributed.js +5 -5
  84. package/dist/workflow.cjs +10 -10
  85. package/dist/workflow.js +6 -6
  86. package/dist/yaml-config.cjs +5 -5
  87. package/dist/yaml-config.d.cts +5 -4
  88. package/dist/yaml-config.d.ts +5 -4
  89. package/dist/yaml-config.js +2 -2
  90. package/package.json +1 -1
  91. package/src/env-config.test.ts +77 -0
  92. package/src/env-config.ts +106 -0
  93. package/src/functional.ts +13 -7
  94. package/src/index.ts +6 -0
  95. package/src/init.customization.test.ts +61 -0
  96. package/src/init.integrations.test.ts +6 -1
  97. package/src/init.ts +23 -13
  98. package/src/instrumentation.ts +1 -1
  99. package/src/sampling.test.ts +96 -3
  100. package/src/sampling.ts +90 -0
  101. package/src/tail-sampling-processor.test.ts +26 -22
  102. package/src/tail-sampling-processor.ts +8 -4
  103. package/src/yaml-config.test.ts +71 -0
  104. package/src/yaml-config.ts +32 -2
  105. package/dist/chunk-6YIDHH2S.cjs.map +0 -1
  106. package/dist/chunk-BGVKKL2N.cjs.map +0 -1
  107. package/dist/chunk-GVLK7YUU.cjs.map +0 -1
  108. package/dist/chunk-JVICEM6W.cjs.map +0 -1
  109. package/dist/chunk-RWOVNF3V.cjs.map +0 -1
  110. package/dist/chunk-VXLEJWLY.js.map +0 -1
  111. package/dist/chunk-X4RMFFMR.js.map +0 -1
  112. package/dist/chunk-XND7WBVX.js.map +0 -1
  113. package/dist/chunk-YTGF4L2C.js.map +0 -1
@@ -4,8 +4,8 @@ var chunkW4EUTSB2_cjs = require('./chunk-W4EUTSB2.cjs');
4
4
  var chunkGML3FBOT_cjs = require('./chunk-GML3FBOT.cjs');
5
5
  var chunkD5LMF53P_cjs = require('./chunk-D5LMF53P.cjs');
6
6
  var chunkXRKAL7WJ_cjs = require('./chunk-XRKAL7WJ.cjs');
7
- var chunkJVICEM6W_cjs = require('./chunk-JVICEM6W.cjs');
8
- var chunkBGVKKL2N_cjs = require('./chunk-BGVKKL2N.cjs');
7
+ var chunkITYASFHQ_cjs = require('./chunk-ITYASFHQ.cjs');
8
+ var chunk7FIGORWI_cjs = require('./chunk-7FIGORWI.cjs');
9
9
  var chunkESLWRGAG_cjs = require('./chunk-ESLWRGAG.cjs');
10
10
  var api = require('@opentelemetry/api');
11
11
  var fs = require('fs');
@@ -222,7 +222,7 @@ var EventQueue = class {
222
222
  }
223
223
  this.metrics?.dropped.add(1, attrs);
224
224
  const logLevel = reason === "payload_invalid" ? "error" : "warn";
225
- const logger = chunkJVICEM6W_cjs.getLogger();
225
+ const logger = chunkITYASFHQ_cjs.getLogger();
226
226
  if (logLevel === "error") {
227
227
  logger.error(
228
228
  {
@@ -254,7 +254,7 @@ var EventQueue = class {
254
254
  recordFailed(event, subscriberName, error) {
255
255
  this.metrics?.failed.add(1, { subscriber: subscriberName });
256
256
  this.subscriberHealthy.set(subscriberName, false);
257
- chunkJVICEM6W_cjs.getLogger().error(
257
+ chunkITYASFHQ_cjs.getLogger().error(
258
258
  {
259
259
  eventName: event.name,
260
260
  subscriber: subscriberName,
@@ -295,7 +295,7 @@ var EventQueue = class {
295
295
  if (this.queue.length >= this.config.maxSize) {
296
296
  const droppedEvent = this.queue.shift();
297
297
  this.recordDropped("rate_limit", droppedEvent);
298
- chunkJVICEM6W_cjs.getLogger().warn(
298
+ chunkITYASFHQ_cjs.getLogger().warn(
299
299
  {
300
300
  droppedEvent: droppedEvent?.name
301
301
  },
@@ -391,7 +391,7 @@ var EventQueue = class {
391
391
  const failedSubscriberNames = [
392
392
  ...new Set(failedDeliveries.map((f) => f.subscriberName))
393
393
  ];
394
- chunkJVICEM6W_cjs.getLogger().error(
394
+ chunkITYASFHQ_cjs.getLogger().error(
395
395
  {
396
396
  failedSubscribers: failedSubscriberNames,
397
397
  retriesAttempted: this.config.maxRetries
@@ -544,8 +544,8 @@ var EventQueue = class {
544
544
  // src/track.ts
545
545
  var eventsQueue = null;
546
546
  function buildAutotelContext(span2) {
547
- const eventsConfig = chunkJVICEM6W_cjs.getEventsConfig();
548
- const config = chunkJVICEM6W_cjs.getConfig();
547
+ const eventsConfig = chunkITYASFHQ_cjs.getEventsConfig();
548
+ const config = chunkITYASFHQ_cjs.getConfig();
549
549
  const correlationId = chunkXRKAL7WJ_cjs.getOrCreateCorrelationId();
550
550
  if (!eventsConfig?.includeTraceContext) {
551
551
  return {
@@ -599,12 +599,12 @@ function buildAutotelContext(span2) {
599
599
  return autotelContext;
600
600
  }
601
601
  function getOrCreateQueue() {
602
- if (!chunkJVICEM6W_cjs.isInitialized()) {
603
- chunkJVICEM6W_cjs.warnIfNotInitialized("track()");
602
+ if (!chunkITYASFHQ_cjs.isInitialized()) {
603
+ chunkITYASFHQ_cjs.warnIfNotInitialized("track()");
604
604
  return null;
605
605
  }
606
606
  if (!eventsQueue) {
607
- const config = chunkJVICEM6W_cjs.getConfig();
607
+ const config = chunkITYASFHQ_cjs.getConfig();
608
608
  if (!config?.subscribers || config.subscribers.length === 0) {
609
609
  return null;
610
610
  }
@@ -615,7 +615,7 @@ function getOrCreateQueue() {
615
615
  function track(event, data) {
616
616
  const queue = getOrCreateQueue();
617
617
  if (!queue) return;
618
- const validationConfig = chunkJVICEM6W_cjs.getValidationConfig();
618
+ const validationConfig = chunkITYASFHQ_cjs.getValidationConfig();
619
619
  const validated = chunkD5LMF53P_cjs.validateEvent(event, data, validationConfig || void 0);
620
620
  const span2 = api.trace.getActiveSpan();
621
621
  const enrichedData = span2 ? {
@@ -1009,7 +1009,7 @@ function wrapWithTracing(fnFactory, options, variableName) {
1009
1009
  const config = chunkESLWRGAG_cjs.getConfig();
1010
1010
  const tracer = config.tracer;
1011
1011
  const meter = config.meter;
1012
- const sampler = options.sampler || new chunkBGVKKL2N_cjs.AlwaysSampler();
1012
+ const sampler = options.sampler || new chunk7FIGORWI_cjs.AlwaysSampler();
1013
1013
  const tempFn = fnFactory(createDummyCtx());
1014
1014
  const spanName = getSpanName(options, tempFn, variableName);
1015
1015
  const callCounter = options.withMetrics ? meter.createCounter(`${spanName}.calls`, {
@@ -1034,8 +1034,8 @@ function wrapWithTracing(fnFactory, options, variableName) {
1034
1034
  }
1035
1035
  const startTime = performance.now();
1036
1036
  const isRootSpan = options.startNewRoot || api.trace.getActiveSpan() === void 0;
1037
- const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkJVICEM6W_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
1038
- const shouldAutoFlushSpans = chunkJVICEM6W_cjs.getConfig()?.forceFlushOnShutdown ?? false;
1037
+ const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkITYASFHQ_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
1038
+ const shouldAutoFlushSpans = chunkITYASFHQ_cjs.getConfig()?.forceFlushOnShutdown ?? false;
1039
1039
  const flushIfNeeded = async () => {
1040
1040
  if (!shouldAutoFlush || !isRootSpan) return;
1041
1041
  try {
@@ -1044,7 +1044,7 @@ function wrapWithTracing(fnFactory, options, variableName) {
1044
1044
  await queue.flush();
1045
1045
  }
1046
1046
  if (shouldAutoFlushSpans) {
1047
- const sdk = chunkJVICEM6W_cjs.getSdk();
1047
+ const sdk = chunkITYASFHQ_cjs.getSdk();
1048
1048
  if (sdk) {
1049
1049
  try {
1050
1050
  const sdkAny = sdk;
@@ -1059,7 +1059,7 @@ function wrapWithTracing(fnFactory, options, variableName) {
1059
1059
  }
1060
1060
  }
1061
1061
  } catch (error) {
1062
- const initConfig = chunkJVICEM6W_cjs.getConfig();
1062
+ const initConfig = chunkITYASFHQ_cjs.getConfig();
1063
1063
  const logger = initConfig?.logger;
1064
1064
  if (logger?.error) {
1065
1065
  logger.error(
@@ -1097,8 +1097,8 @@ function wrapWithTracing(fnFactory, options, variableName) {
1097
1097
  duration,
1098
1098
  error
1099
1099
  });
1100
- span2.setAttribute("sampling.tail.keep", shouldKeepSpan);
1101
- span2.setAttribute("sampling.tail.evaluated", true);
1100
+ span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
1101
+ span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
1102
1102
  }
1103
1103
  };
1104
1104
  const onSuccess = async (result) => {
@@ -1198,7 +1198,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
1198
1198
  const config = chunkESLWRGAG_cjs.getConfig();
1199
1199
  const tracer = config.tracer;
1200
1200
  const meter = config.meter;
1201
- const sampler = options.sampler || new chunkBGVKKL2N_cjs.AlwaysSampler();
1201
+ const sampler = options.sampler || new chunk7FIGORWI_cjs.AlwaysSampler();
1202
1202
  const tempFn = fnFactory(createDummyCtx());
1203
1203
  const spanName = getSpanName(options, tempFn, variableName);
1204
1204
  const callCounter = options.withMetrics ? meter.createCounter(`${spanName}.calls`, {
@@ -1223,14 +1223,14 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
1223
1223
  }
1224
1224
  const startTime = performance.now();
1225
1225
  const isRootSpan = options.startNewRoot || api.trace.getActiveSpan() === void 0;
1226
- const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkJVICEM6W_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
1227
- const shouldAutoFlushSpans = chunkJVICEM6W_cjs.getConfig()?.forceFlushOnShutdown ?? false;
1226
+ const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkITYASFHQ_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
1227
+ const shouldAutoFlushSpans = chunkITYASFHQ_cjs.getConfig()?.forceFlushOnShutdown ?? false;
1228
1228
  const flushIfNeeded = () => {
1229
1229
  if (!shouldAutoFlush || !isRootSpan) return;
1230
1230
  const queue = getEventQueue();
1231
1231
  if (queue && queue.size() > 0) {
1232
1232
  void queue.flush().catch((error) => {
1233
- const initConfig = chunkJVICEM6W_cjs.getConfig();
1233
+ const initConfig = chunkITYASFHQ_cjs.getConfig();
1234
1234
  const logger = initConfig?.logger;
1235
1235
  if (logger?.error) {
1236
1236
  logger.error(
@@ -1243,7 +1243,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
1243
1243
  });
1244
1244
  }
1245
1245
  if (shouldAutoFlushSpans) {
1246
- const sdk = chunkJVICEM6W_cjs.getSdk();
1246
+ const sdk = chunkITYASFHQ_cjs.getSdk();
1247
1247
  if (sdk) {
1248
1248
  try {
1249
1249
  const sdkAny = sdk;
@@ -1251,7 +1251,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
1251
1251
  const tracerProvider = sdkAny.getTracerProvider();
1252
1252
  if (tracerProvider && typeof tracerProvider.forceFlush === "function") {
1253
1253
  void tracerProvider.forceFlush().catch((error) => {
1254
- const initConfig = chunkJVICEM6W_cjs.getConfig();
1254
+ const initConfig = chunkITYASFHQ_cjs.getConfig();
1255
1255
  const logger = initConfig?.logger;
1256
1256
  if (logger?.error) {
1257
1257
  logger.error(
@@ -1290,8 +1290,8 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
1290
1290
  duration,
1291
1291
  error
1292
1292
  });
1293
- span2.setAttribute("sampling.tail.keep", shouldKeepSpan);
1294
- span2.setAttribute("sampling.tail.evaluated", true);
1293
+ span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
1294
+ span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
1295
1295
  }
1296
1296
  };
1297
1297
  const onSuccess = (result) => {
@@ -1380,7 +1380,7 @@ function executeImmediately(fn, options) {
1380
1380
  const config = chunkESLWRGAG_cjs.getConfig();
1381
1381
  const tracer = config.tracer;
1382
1382
  const meter = config.meter;
1383
- const sampler = options.sampler || new chunkBGVKKL2N_cjs.AlwaysSampler();
1383
+ const sampler = options.sampler || new chunk7FIGORWI_cjs.AlwaysSampler();
1384
1384
  const spanName = options.name || "anonymous";
1385
1385
  const samplingContext = {
1386
1386
  operationName: spanName,
@@ -1394,8 +1394,8 @@ function executeImmediately(fn, options) {
1394
1394
  }
1395
1395
  const startTime = performance.now();
1396
1396
  const isRootSpan = options.startNewRoot || api.trace.getActiveSpan() === void 0;
1397
- const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkJVICEM6W_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
1398
- const shouldAutoFlushSpans = chunkJVICEM6W_cjs.getConfig()?.forceFlushOnShutdown ?? false;
1397
+ const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkITYASFHQ_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
1398
+ const shouldAutoFlushSpans = chunkITYASFHQ_cjs.getConfig()?.forceFlushOnShutdown ?? false;
1399
1399
  const callCounter = options.withMetrics ? meter.createCounter(`${spanName}.calls`, {
1400
1400
  description: `Call count for ${spanName}`,
1401
1401
  unit: "1"
@@ -1412,7 +1412,7 @@ function executeImmediately(fn, options) {
1412
1412
  await queue.flush();
1413
1413
  }
1414
1414
  if (shouldAutoFlushSpans) {
1415
- const sdk = chunkJVICEM6W_cjs.getSdk();
1415
+ const sdk = chunkITYASFHQ_cjs.getSdk();
1416
1416
  if (sdk) {
1417
1417
  try {
1418
1418
  const sdkAny = sdk;
@@ -1427,7 +1427,7 @@ function executeImmediately(fn, options) {
1427
1427
  }
1428
1428
  }
1429
1429
  } catch (error) {
1430
- const initConfig = chunkJVICEM6W_cjs.getConfig();
1430
+ const initConfig = chunkITYASFHQ_cjs.getConfig();
1431
1431
  const logger = initConfig?.logger;
1432
1432
  if (logger?.error) {
1433
1433
  logger.error(
@@ -1458,8 +1458,8 @@ function executeImmediately(fn, options) {
1458
1458
  duration,
1459
1459
  error
1460
1460
  });
1461
- span2.setAttribute("sampling.tail.keep", shouldKeepSpan);
1462
- span2.setAttribute("sampling.tail.evaluated", true);
1461
+ span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_KEEP, shouldKeepSpan);
1462
+ span2.setAttribute(chunk7FIGORWI_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED, true);
1463
1463
  }
1464
1464
  };
1465
1465
  const onSuccessSync = (result) => {
@@ -1799,5 +1799,5 @@ exports.track = track;
1799
1799
  exports.withBaggage = withBaggage;
1800
1800
  exports.withNewContext = withNewContext;
1801
1801
  exports.withTracing = withTracing;
1802
- //# sourceMappingURL=chunk-RWOVNF3V.cjs.map
1803
- //# sourceMappingURL=chunk-RWOVNF3V.cjs.map
1802
+ //# sourceMappingURL=chunk-RMGSBMQF.cjs.map
1803
+ //# sourceMappingURL=chunk-RMGSBMQF.cjs.map