autotel 7.0.1 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +25 -0
  2. package/dist/analysis.cjs +17 -0
  3. package/dist/analysis.d.cts +9 -1
  4. package/dist/analysis.d.ts +9 -1
  5. package/dist/analysis.js +17 -1
  6. package/dist/auto.cjs +2 -3
  7. package/dist/auto.js +1 -2
  8. package/dist/correlation-id.cjs +1 -1
  9. package/dist/correlation-id.js +1 -1
  10. package/dist/decorators.cjs +1 -1
  11. package/dist/decorators.d.cts +1 -1
  12. package/dist/decorators.d.ts +1 -1
  13. package/dist/decorators.js +1 -1
  14. package/dist/event.cjs +1 -1
  15. package/dist/event.js +1 -1
  16. package/dist/evidence.cjs +57 -0
  17. package/dist/evidence.d.cts +61 -0
  18. package/dist/evidence.d.ts +61 -0
  19. package/dist/evidence.js +50 -0
  20. package/dist/{functional-C2ONG9PK.cjs → functional-C925G95W.cjs} +68 -17
  21. package/dist/{functional-CJn2zY4o.d.cts → functional-CgWcRXGX.d.cts} +12 -5
  22. package/dist/{functional-nS5U4KCQ.js → functional-Doi0hFm3.js} +64 -13
  23. package/dist/{functional-DXy1cHFF.d.ts → functional-RFFpQzAV.d.ts} +12 -5
  24. package/dist/functional.cjs +1 -1
  25. package/dist/functional.d.cts +1 -1
  26. package/dist/functional.d.ts +1 -1
  27. package/dist/functional.js +1 -1
  28. package/dist/http.cjs +1 -1
  29. package/dist/http.js +1 -1
  30. package/dist/index.cjs +53 -15
  31. package/dist/index.d.cts +24 -4
  32. package/dist/index.d.ts +24 -4
  33. package/dist/index.js +40 -5
  34. package/dist/{init-DrlL1eis.d.cts → init-8GSy2bza.d.cts} +1 -1
  35. package/dist/{init-DDyaLzeg.js → init-DzAdgcFM.js} +2181 -1303
  36. package/dist/{init-BgnYi2sm.d.ts → init-UnKrXhpq.d.ts} +1 -1
  37. package/dist/{init-C5aHRqi2.cjs → init-aTZKsAwy.cjs} +2324 -1294
  38. package/dist/instrumentation.cjs +2 -3
  39. package/dist/instrumentation.js +1 -2
  40. package/dist/messaging.cjs +5 -5
  41. package/dist/messaging.js +2 -2
  42. package/dist/{sampling-CM5S2Lp3.d.ts → sampling-DBng4Foa.d.ts} +20 -1
  43. package/dist/{sampling-CmRdnXUi.d.cts → sampling-Er217Mge.d.cts} +20 -1
  44. package/dist/sampling.cjs +22 -601
  45. package/dist/sampling.d.cts +2 -2
  46. package/dist/sampling.d.ts +2 -2
  47. package/dist/sampling.js +2 -585
  48. package/dist/semantic-helpers.cjs +1 -1
  49. package/dist/semantic-helpers.js +1 -1
  50. package/dist/tail-sampling-processor.cjs +2 -26
  51. package/dist/tail-sampling-processor.js +1 -25
  52. package/dist/webhook.cjs +1 -1
  53. package/dist/webhook.js +1 -1
  54. package/dist/workflow-distributed.cjs +1 -1
  55. package/dist/workflow-distributed.js +1 -1
  56. package/dist/workflow.cjs +1 -1
  57. package/dist/workflow.js +1 -1
  58. package/dist/yaml-config.cjs +4 -248
  59. package/dist/yaml-config.d.cts +2 -2
  60. package/dist/yaml-config.d.ts +2 -2
  61. package/dist/yaml-config.js +1 -242
  62. package/package.json +6 -1
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-C5aHRqi2.cjs');
2
+ const require_init = require('./init-aTZKsAwy.cjs');
3
3
  const require_node_require = require('./node-require-EifOMikz.cjs');
4
- const require_tail_sampling_processor = require('./tail-sampling-processor.cjs');
5
4
  let _opentelemetry_sdk_node = require("@opentelemetry/sdk-node");
6
5
  let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
7
6
  let _opentelemetry_resources = require("@opentelemetry/resources");
@@ -119,7 +118,7 @@ async function initInstrumentation(config) {
119
118
  });
120
119
  let instrumentations = config.instrumentations || [];
121
120
  if (config.selectiveInstrumentation === false) instrumentations = [require_node_require.requireModule("@opentelemetry/auto-instrumentations-node").getNodeAutoInstrumentations()];
122
- const spanProcessor = new require_tail_sampling_processor.TailSamplingSpanProcessor(new _opentelemetry_sdk_trace_base.BatchSpanProcessor(new _opentelemetry_exporter_trace_otlp_http.OTLPTraceExporter({
121
+ const spanProcessor = new require_init.TailSamplingSpanProcessor(new _opentelemetry_sdk_trace_base.BatchSpanProcessor(new _opentelemetry_exporter_trace_otlp_http.OTLPTraceExporter({
123
122
  url: `${config.otlpEndpoint || "http://localhost:4318"}/v1/traces`,
124
123
  headers: otlpHeaders
125
124
  })));
@@ -1,6 +1,5 @@
1
- import { n as getLogger } from "./init-DDyaLzeg.js";
1
+ import { b as TailSamplingSpanProcessor, n as getLogger } from "./init-DzAdgcFM.js";
2
2
  import { n as safeRequire, t as requireModule } from "./node-require-DSPjaw_l.js";
3
- import { TailSamplingSpanProcessor } from "./tail-sampling-processor.js";
4
3
  import { NodeSDK } from "@opentelemetry/sdk-node";
5
4
  import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
6
5
  import { detectResources, hostDetector, processDetector, resourceFromAttributes } from "@opentelemetry/resources";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_values = require('./values-DApyq53y.cjs');
3
- const require_sampling = require('./sampling.cjs');
4
- const require_functional = require('./functional-C2ONG9PK.cjs');
3
+ const require_init = require('./init-aTZKsAwy.cjs');
4
+ const require_functional = require('./functional-C925G95W.cjs');
5
5
  const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
6
6
  const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -531,7 +531,7 @@ async function extractAndAddLinks(ctx, config, args, linkStorage) {
531
531
  if (config.batchMode && Array.isArray(args[0])) {
532
532
  const messages = args[0];
533
533
  if (config.headersFrom) {
534
- const batchLinks = require_sampling.extractLinksFromBatch(messages.map((msg) => {
534
+ const batchLinks = require_init.extractLinksFromBatch(messages.map((msg) => {
535
535
  return { headers: extractHeaders(config.headersFrom, msg) };
536
536
  }), "headers");
537
537
  links.push(...batchLinks);
@@ -539,7 +539,7 @@ async function extractAndAddLinks(ctx, config, args, linkStorage) {
539
539
  if (config.customContextExtractor && config.headersFrom) for (const msg of messages) {
540
540
  const headers = extractHeaders(config.headersFrom, msg);
541
541
  if (headers) {
542
- if (!require_sampling.createLinkFromHeaders(headers)) {
542
+ if (!require_init.createLinkFromHeaders(headers)) {
543
543
  const customContext = config.customContextExtractor(headers);
544
544
  if (customContext) links.push({
545
545
  context: customContext,
@@ -553,7 +553,7 @@ async function extractAndAddLinks(ctx, config, args, linkStorage) {
553
553
  const msg = args[0];
554
554
  const headers = config.headersFrom ? extractHeaders(config.headersFrom, msg) : void 0;
555
555
  if (headers) {
556
- const w3cLink = require_sampling.createLinkFromHeaders(headers);
556
+ const w3cLink = require_init.createLinkFromHeaders(headers);
557
557
  if (w3cLink) links.push(w3cLink);
558
558
  else if (config.customContextExtractor) {
559
559
  const customContext = config.customContextExtractor(headers);
package/dist/messaging.js CHANGED
@@ -1,6 +1,6 @@
1
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 { createLinkFromHeaders, extractLinksFromBatch } from "./sampling.js";
3
- import { c as withTracing } from "./functional-nS5U4KCQ.js";
2
+ import { I as extractLinksFromBatch, P as createLinkFromHeaders } from "./init-DzAdgcFM.js";
3
+ import { c as withTracing } from "./functional-Doi0hFm3.js";
4
4
  import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
5
5
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
6
6
  import { SpanKind, context, propagation } from "@opentelemetry/api";
@@ -15,6 +15,23 @@ declare const AUTOTEL_SAMPLING_TAIL_EVALUATED = "autotel.sampling.tail.evaluated
15
15
  * attribute only when N exceeds 1, so fully captured spans stay clean.
16
16
  */
17
17
  declare const AUTOTEL_SAMPLING_RATE = "autotel.sampling.rate";
18
+ /**
19
+ * Spans an explicit `forceKeep()` claimed.
20
+ *
21
+ * The tracing wrapper writes the sampler's tail verdict once the body has
22
+ * run, which is after any `forceKeep()` inside it. Without this the verdict
23
+ * overwrites the override and the span the caller insisted on is dropped.
24
+ */
25
+ /**
26
+ * Baggage key that turns on full-fidelity capture for a request.
27
+ *
28
+ * Baggage arrives on the request and propagates, so a gateway, a proxy, a
29
+ * feature flag or a curl can turn this on for one user and it follows them
30
+ * across every service. Nobody deploys anything to debug a live problem.
31
+ */
32
+ declare const AUTOTEL_DEBUG_BAGGAGE_KEY = "autotel.debug";
33
+ declare function markForceKept(span: object): void;
34
+ declare function isForceKept(span: object): boolean;
18
35
  /**
19
36
  * Map a string to a stable, evenly spread position in the unit interval.
20
37
  *
@@ -462,5 +479,7 @@ declare function createLinkFromHeaders(headers: Record<string, string>, attribut
462
479
  * ```
463
480
  */
464
481
  declare function extractLinksFromBatch(messages: UnknownRecord[], headersKey?: string): Link[];
482
+ /** True when the request in flight asked for full-fidelity capture. */
483
+ declare function debugCaptureRequested(): boolean;
465
484
  //#endregion
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 };
485
+ export { markForceKept as C, isForceKept as S, samplingPresets as T, UserIdSampler as _, AdaptiveSampler as a, extractLinksFromBatch as b, DeterministicSampler as c, NeverSampler as d, OperationResult as f, SamplingPreset as g, SamplingContext as h, AUTOTEL_SAMPLING_TAIL_KEEP as i, FeatureFlagSampler as l, Sampler as m, AUTOTEL_SAMPLING_RATE as n, AlwaysSampler as o, RandomSampler as p, AUTOTEL_SAMPLING_TAIL_EVALUATED as r, CompositeSampler as s, AUTOTEL_DEBUG_BAGGAGE_KEY as t, KeyTargetRateSampler as u, createLinkFromHeaders as v, resolveSamplingPreset as w, hashUnitInterval as x, debugCaptureRequested as y };
@@ -15,6 +15,23 @@ declare const AUTOTEL_SAMPLING_TAIL_EVALUATED = "autotel.sampling.tail.evaluated
15
15
  * attribute only when N exceeds 1, so fully captured spans stay clean.
16
16
  */
17
17
  declare const AUTOTEL_SAMPLING_RATE = "autotel.sampling.rate";
18
+ /**
19
+ * Spans an explicit `forceKeep()` claimed.
20
+ *
21
+ * The tracing wrapper writes the sampler's tail verdict once the body has
22
+ * run, which is after any `forceKeep()` inside it. Without this the verdict
23
+ * overwrites the override and the span the caller insisted on is dropped.
24
+ */
25
+ /**
26
+ * Baggage key that turns on full-fidelity capture for a request.
27
+ *
28
+ * Baggage arrives on the request and propagates, so a gateway, a proxy, a
29
+ * feature flag or a curl can turn this on for one user and it follows them
30
+ * across every service. Nobody deploys anything to debug a live problem.
31
+ */
32
+ declare const AUTOTEL_DEBUG_BAGGAGE_KEY = "autotel.debug";
33
+ declare function markForceKept(span: object): void;
34
+ declare function isForceKept(span: object): boolean;
18
35
  /**
19
36
  * Map a string to a stable, evenly spread position in the unit interval.
20
37
  *
@@ -462,5 +479,7 @@ declare function createLinkFromHeaders(headers: Record<string, string>, attribut
462
479
  * ```
463
480
  */
464
481
  declare function extractLinksFromBatch(messages: UnknownRecord[], headersKey?: string): Link[];
482
+ /** True when the request in flight asked for full-fidelity capture. */
483
+ declare function debugCaptureRequested(): boolean;
465
484
  //#endregion
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 };
485
+ export { markForceKept as C, isForceKept as S, samplingPresets as T, UserIdSampler as _, AdaptiveSampler as a, extractLinksFromBatch as b, DeterministicSampler as c, NeverSampler as d, OperationResult as f, SamplingPreset as g, SamplingContext as h, AUTOTEL_SAMPLING_TAIL_KEEP as i, FeatureFlagSampler as l, Sampler as m, AUTOTEL_SAMPLING_RATE as n, AlwaysSampler as o, RandomSampler as p, AUTOTEL_SAMPLING_TAIL_EVALUATED as r, CompositeSampler as s, AUTOTEL_DEBUG_BAGGAGE_KEY as t, KeyTargetRateSampler as u, createLinkFromHeaders as v, resolveSamplingPreset as w, hashUnitInterval as x, debugCaptureRequested as y };