autotel 5.0.0 → 6.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 (85) hide show
  1. package/dist/auto.cjs +1 -1
  2. package/dist/auto.js +1 -1
  3. package/dist/correlation-id.cjs +9 -9
  4. package/dist/correlation-id.js +1 -1
  5. package/dist/decorators.cjs +2 -2
  6. package/dist/decorators.cjs.map +1 -1
  7. package/dist/decorators.js +1 -1
  8. package/dist/event.cjs +4 -4
  9. package/dist/event.js +1 -1
  10. package/dist/{functional-Bit6noRu.js → functional-BnDUxnSl.js} +2 -4
  11. package/dist/{functional-Bit6noRu.js.map → functional-BnDUxnSl.js.map} +1 -1
  12. package/dist/{functional-Cj7PSItS.cjs → functional-DcLBuCPz.cjs} +12 -14
  13. package/dist/{functional-Cj7PSItS.cjs.map → functional-DcLBuCPz.cjs.map} +1 -1
  14. package/dist/functional.cjs +1 -1
  15. package/dist/functional.js +1 -1
  16. package/dist/http.cjs +2 -2
  17. package/dist/http.cjs.map +1 -1
  18. package/dist/http.js +1 -1
  19. package/dist/index.cjs +23 -164
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +2 -2
  22. package/dist/index.d.cts.map +1 -1
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +4 -145
  26. package/dist/index.js.map +1 -1
  27. package/dist/init-C3RApHKJ.cjs +3371 -0
  28. package/dist/init-C3RApHKJ.cjs.map +1 -0
  29. package/dist/{init-CTyqG9qR.d.ts → init-D6n2diBy.d.ts} +21 -2
  30. package/dist/init-D6n2diBy.d.ts.map +1 -0
  31. package/dist/init-R-gSEXkJ.js +3190 -0
  32. package/dist/init-R-gSEXkJ.js.map +1 -0
  33. package/dist/{init-a4yPDYqC.d.cts → init-XzXzrarP.d.cts} +21 -2
  34. package/dist/init-XzXzrarP.d.cts.map +1 -0
  35. package/dist/instrumentation.cjs +1 -1
  36. package/dist/instrumentation.js +1 -1
  37. package/dist/messaging.cjs +1 -1
  38. package/dist/messaging.js +1 -1
  39. package/dist/semantic-helpers.cjs +1 -1
  40. package/dist/semantic-helpers.js +1 -1
  41. package/dist/webhook.cjs +1 -1
  42. package/dist/webhook.js +1 -1
  43. package/dist/workflow-distributed.cjs +1 -1
  44. package/dist/workflow-distributed.js +1 -1
  45. package/dist/workflow.cjs +1 -1
  46. package/dist/workflow.js +1 -1
  47. package/dist/yaml-config.d.cts +1 -1
  48. package/dist/yaml-config.d.ts +1 -1
  49. package/package.json +2 -3
  50. package/dist/event-CwIpFdoY.cjs +0 -778
  51. package/dist/event-CwIpFdoY.cjs.map +0 -1
  52. package/dist/event-pLMF5b3d.js +0 -761
  53. package/dist/event-pLMF5b3d.js.map +0 -1
  54. package/dist/init-B2uvZReD.cjs +0 -1120
  55. package/dist/init-B2uvZReD.cjs.map +0 -1
  56. package/dist/init-CTyqG9qR.d.ts.map +0 -1
  57. package/dist/init-CdEWjhvl.js +0 -1043
  58. package/dist/init-CdEWjhvl.js.map +0 -1
  59. package/dist/init-a4yPDYqC.d.cts.map +0 -1
  60. package/dist/operation-context-CKBoA4Qy.js +0 -59
  61. package/dist/operation-context-CKBoA4Qy.js.map +0 -1
  62. package/dist/operation-context-hzKbTKnt.cjs +0 -72
  63. package/dist/operation-context-hzKbTKnt.cjs.map +0 -1
  64. package/dist/track-BBcxEJEC.js +0 -1110
  65. package/dist/track-BBcxEJEC.js.map +0 -1
  66. package/dist/track-BI6dmZ2X.cjs +0 -1207
  67. package/dist/track-BI6dmZ2X.cjs.map +0 -1
  68. package/skills/analyze-traces/SKILL.md +0 -209
  69. package/skills/autotel-core/SKILL.md +0 -166
  70. package/skills/autotel-events/SKILL.md +0 -84
  71. package/skills/autotel-frameworks/SKILL.md +0 -125
  72. package/skills/autotel-instrumentation/SKILL.md +0 -150
  73. package/skills/autotel-request-logging/SKILL.md +0 -99
  74. package/skills/autotel-structured-errors/SKILL.md +0 -125
  75. package/skills/build-audit-trails/SKILL.md +0 -460
  76. package/skills/build-audit-trails/references/audit-queries.md +0 -73
  77. package/skills/build-audit-trails/references/framework-wiring.md +0 -196
  78. package/skills/debug-missing-spans/SKILL.md +0 -250
  79. package/skills/migrate-to-autotel/SKILL.md +0 -269
  80. package/skills/review-otel-patterns/SKILL.md +0 -540
  81. package/skills/review-otel-patterns/references/code-review.md +0 -76
  82. package/skills/review-otel-patterns/references/processor-pipeline.md +0 -205
  83. package/skills/review-otel-patterns/references/structured-errors.md +0 -102
  84. package/skills/review-otel-patterns/references/wide-spans.md +0 -85
  85. package/skills/tune-sampling/SKILL.md +0 -290
@@ -1,1110 +0,0 @@
1
- import { getConfig } from "./config.js";
2
- import { c as isInitialized, d as warnIfNotInitialized, i as getLogger, n as getConfig$1, o as getValidationConfig, r as getEventsConfig } from "./init-CdEWjhvl.js";
3
- import { r as recordStructuredError } from "./structured-error-9--cxBay.js";
4
- import { context, propagation, trace } from "@opentelemetry/api";
5
- import * as nodeAsyncHooks from "node:async_hooks";
6
-
7
- //#region src/rate-limiter.ts
8
- /**
9
- * Token bucket rate limiter
10
- *
11
- * Allows bursts up to burstCapacity, then smooths to maxEventsPerSecond.
12
- * Thread-safe for async operations.
13
- */
14
- var TokenBucketRateLimiter = class {
15
- tokens;
16
- maxTokens;
17
- refillRate;
18
- lastRefill;
19
- constructor(config) {
20
- this.maxTokens = config.burstCapacity || config.maxEventsPerSecond * 2;
21
- this.tokens = this.maxTokens;
22
- this.refillRate = config.maxEventsPerSecond / 1e3;
23
- this.lastRefill = Date.now();
24
- }
25
- /**
26
- * Try to consume a token (allow an event)
27
- * Returns true if allowed, false if rate limit exceeded
28
- */
29
- tryConsume(count = 1) {
30
- this.refill();
31
- if (this.tokens >= count) {
32
- this.tokens -= count;
33
- return true;
34
- }
35
- return false;
36
- }
37
- /**
38
- * Wait until a token is available (async rate limiting)
39
- * Returns a promise that resolves when the event can be processed
40
- */
41
- async waitForToken(count = 1) {
42
- this.refill();
43
- if (this.tokens >= count) {
44
- this.tokens -= count;
45
- return;
46
- }
47
- const tokensNeeded = count - this.tokens;
48
- const waitMs = Math.ceil(tokensNeeded / this.refillRate);
49
- await new Promise((resolve) => setTimeout(resolve, waitMs));
50
- return this.waitForToken(count);
51
- }
52
- /**
53
- * Refill tokens based on elapsed time
54
- */
55
- refill() {
56
- const now = Date.now();
57
- const tokensToAdd = (now - this.lastRefill) * this.refillRate;
58
- this.tokens = Math.min(this.maxTokens, this.tokens + tokensToAdd);
59
- this.lastRefill = now;
60
- }
61
- /**
62
- * Get current available tokens (for testing/debugging)
63
- */
64
- getAvailableTokens() {
65
- this.refill();
66
- return Math.floor(this.tokens);
67
- }
68
- /**
69
- * Reset the rate limiter (for testing)
70
- */
71
- reset() {
72
- this.tokens = this.maxTokens;
73
- this.lastRefill = Date.now();
74
- }
75
- };
76
-
77
- //#endregion
78
- //#region src/trace-context.ts
79
- /**
80
- * AsyncLocalStorage for storing the active context with baggage
81
- * This allows setters to update the context and have it persist
82
- */
83
- const contextStorage = new nodeAsyncHooks.AsyncLocalStorage();
84
- /**
85
- * Get the context storage instance (for initialization in functional.ts)
86
- */
87
- function getContextStorage() {
88
- return contextStorage;
89
- }
90
- /**
91
- * Get the active context, checking our stored context first
92
- * This ensures baggage setters work with OpenTelemetry's propagation
93
- */
94
- function getActiveContextWithBaggage() {
95
- return contextStorage.getStore()?.value ?? context.active();
96
- }
97
- /**
98
- * Set a value in AsyncLocalStorage, preferring enterWith() when available
99
- * (Node.js) and falling back to run() for environments that only support
100
- * run() (e.g. Cloudflare Workers).
101
- *
102
- * On runtimes without enterWith() we mutate the existing run() scope when one
103
- * exists. This is what allows baggage/correlation updates to remain visible
104
- * for the rest of the traced callback in Workers.
105
- */
106
- function enterOrRun(storage, value) {
107
- const existingStore = storage.getStore();
108
- if (existingStore) {
109
- existingStore.value = value;
110
- return;
111
- }
112
- const boxedValue = { value };
113
- try {
114
- storage.enterWith(boxedValue);
115
- } catch {
116
- storage.run(boxedValue, () => {});
117
- }
118
- }
119
- function updateActiveContext(newContext) {
120
- enterOrRun(contextStorage, newContext);
121
- const manager = context._getContextManager?.();
122
- if (!manager) return;
123
- const asyncLocal = manager._asyncLocalStorage ?? void 0;
124
- if (asyncLocal?.enterWith) {
125
- asyncLocal.enterWith(newContext);
126
- return;
127
- }
128
- if (typeof manager.with === "function") manager.with(newContext, () => {});
129
- }
130
- /**
131
- * Create a TraceContext from an OpenTelemetry Span
132
- *
133
- * This utility extracts trace context information from a span
134
- * and provides span manipulation methods and baggage operations in a consistent format.
135
- *
136
- * Note: Baggage methods always operate on the currently active context,
137
- * which may differ from the context when createTraceContext was called.
138
- */
139
- function createTraceContext(span) {
140
- const spanContext = span.spanContext();
141
- if (!contextStorage.getStore()?.value) {
142
- const activeContext = context.active();
143
- enterOrRun(contextStorage, activeContext);
144
- }
145
- const traceCtx = {
146
- traceId: spanContext.traceId,
147
- spanId: spanContext.spanId,
148
- correlationId: spanContext.traceId.slice(0, 16),
149
- setAttribute: span.setAttribute.bind(span),
150
- setAttributes: span.setAttributes.bind(span),
151
- setStatus: span.setStatus.bind(span),
152
- recordException: span.recordException.bind(span),
153
- addEvent: span.addEvent.bind(span),
154
- addLink: span.addLink.bind(span),
155
- addLinks: span.addLinks.bind(span),
156
- updateName: span.updateName.bind(span),
157
- isRecording: span.isRecording.bind(span),
158
- recordError: (error) => {
159
- const err = error instanceof Error ? error : new Error(String(error));
160
- recordStructuredError(traceCtx, err);
161
- },
162
- track: (event, data) => {
163
- track(event, data);
164
- },
165
- getBaggage(key) {
166
- const activeCtx = context.active();
167
- let baggage = propagation.getBaggage(activeCtx);
168
- if (!baggage) {
169
- const storedContext = contextStorage.getStore()?.value;
170
- if (storedContext) baggage = propagation.getBaggage(storedContext);
171
- }
172
- return baggage?.getEntry(key)?.value;
173
- },
174
- setBaggage(key, value) {
175
- const activeCtx = context.active();
176
- const currentContext = contextStorage.getStore()?.value ?? activeCtx;
177
- const updated = (propagation.getBaggage(currentContext) ?? propagation.createBaggage()).setEntry(key, { value });
178
- updateActiveContext(propagation.setBaggage(currentContext, updated));
179
- return value;
180
- },
181
- deleteBaggage(key) {
182
- const activeCtx = context.active();
183
- const currentContext = contextStorage.getStore()?.value ?? activeCtx;
184
- const baggage = propagation.getBaggage(currentContext);
185
- if (baggage) {
186
- const updated = baggage.removeEntry(key);
187
- updateActiveContext(propagation.setBaggage(currentContext, updated));
188
- }
189
- },
190
- getAllBaggage() {
191
- const activeCtx = context.active();
192
- let baggage = propagation.getBaggage(activeCtx);
193
- if (!baggage) {
194
- const storedContext = contextStorage.getStore()?.value;
195
- if (storedContext) baggage = propagation.getBaggage(storedContext);
196
- }
197
- if (!baggage) return /* @__PURE__ */ new Map();
198
- const entries = /* @__PURE__ */ new Map();
199
- for (const [key, entry] of baggage.getAllEntries()) entries.set(key, entry);
200
- return entries;
201
- },
202
- getTypedBaggage: ((namespace) => {
203
- const activeCtx = context.active();
204
- let baggage = propagation.getBaggage(activeCtx);
205
- if (!baggage) {
206
- const storedContext = contextStorage.getStore()?.value;
207
- if (storedContext) baggage = propagation.getBaggage(storedContext);
208
- }
209
- if (!baggage) return;
210
- const prefix = namespace ? `${namespace}.` : "";
211
- const result = {};
212
- for (const [key, entry] of baggage.getAllEntries()) if (namespace && key.startsWith(prefix)) {
213
- const fieldName = key.slice(prefix.length);
214
- result[fieldName] = entry.value;
215
- } else if (!namespace) result[key] = entry.value;
216
- return Object.keys(result).length > 0 ? result : void 0;
217
- }),
218
- setTypedBaggage: ((namespace, value) => {
219
- const activeCtx = context.active();
220
- const currentContext = contextStorage.getStore()?.value ?? activeCtx;
221
- let baggage = propagation.getBaggage(currentContext) ?? propagation.createBaggage();
222
- const prefix = namespace ? `${namespace}.` : "";
223
- for (const [key, val] of Object.entries(value)) if (val !== void 0) {
224
- const baggageKey = `${prefix}${key}`;
225
- baggage = baggage.setEntry(baggageKey, { value: String(val) });
226
- }
227
- updateActiveContext(propagation.setBaggage(currentContext, baggage));
228
- })
229
- };
230
- return traceCtx;
231
- }
232
- /**
233
- * Define a typed baggage schema for type-safe baggage operations
234
- *
235
- * This helper provides a type-safe API for working with baggage entries.
236
- * The namespace parameter is optional and prefixes all keys to avoid collisions.
237
- *
238
- * @template T - The baggage schema type (all fields are treated as optional)
239
- * @param namespace - Optional namespace to prefix baggage keys
240
- *
241
- * @example Basic usage
242
- * ```typescript
243
- * type TenantBaggage = { tenantId: string; region?: string };
244
- * const tenantBaggage = defineBaggageSchema<TenantBaggage>('tenant');
245
- *
246
- * export const handler = trace<TenantBaggage>((ctx) => async () => {
247
- * // Get typed baggage
248
- * const tenant = tenantBaggage.get(ctx);
249
- * if (tenant?.tenantId) {
250
- * console.log('Tenant:', tenant.tenantId);
251
- * }
252
- *
253
- * // Set typed baggage
254
- * tenantBaggage.set(ctx, { tenantId: 't1', region: 'us-east-1' });
255
- * });
256
- * ```
257
- *
258
- * @example With withBaggage helper
259
- * ```typescript
260
- * const tenantBaggage = defineBaggageSchema<TenantBaggage>('tenant');
261
- *
262
- * export const handler = trace<TenantBaggage>((ctx) => async () => {
263
- * return await tenantBaggage.with(ctx, { tenantId: 't1' }, async () => {
264
- * // Baggage is available here and in child spans
265
- * const tenant = tenantBaggage.get(ctx);
266
- * });
267
- * });
268
- * ```
269
- */
270
- function defineBaggageSchema(namespace) {
271
- return {
272
- /**
273
- * Get typed baggage from context
274
- * @param ctx - Trace context
275
- * @returns Partial baggage object or undefined if no baggage is set
276
- */
277
- get: (ctx) => {
278
- if (!ctx.getTypedBaggage) return void 0;
279
- return ctx.getTypedBaggage(namespace);
280
- },
281
- /**
282
- * Set typed baggage in context
283
- *
284
- * Note: For proper scoping across async boundaries, use the `with` method instead
285
- *
286
- * @param ctx - Trace context
287
- * @param value - Partial baggage object to set
288
- */
289
- set: (ctx, value) => {
290
- if (!ctx.setTypedBaggage) return;
291
- ctx.setTypedBaggage(namespace, value);
292
- },
293
- /**
294
- * Run a function with typed baggage properly scoped
295
- *
296
- * This is the recommended way to set baggage as it ensures proper
297
- * scoping across async boundaries.
298
- *
299
- * @param ctx - Trace context (can be omitted, will use active context)
300
- * @param value - Partial baggage object to set
301
- * @param fn - Function to execute with the baggage
302
- */
303
- with: (ctxOrValue, valueOrFn, maybeFn) => {
304
- const value = maybeFn ? valueOrFn : ctxOrValue;
305
- const fn = maybeFn || valueOrFn;
306
- const prefix = namespace ? `${namespace}.` : "";
307
- const flatBaggage = {};
308
- for (const [key, val] of Object.entries(value)) if (val !== void 0) flatBaggage[`${prefix}${key}`] = String(val);
309
- const currentContext = context.active();
310
- let baggage = propagation.getBaggage(currentContext) ?? propagation.createBaggage();
311
- for (const [key, val] of Object.entries(flatBaggage)) baggage = baggage.setEntry(key, { value: val });
312
- const newContext = propagation.setBaggage(currentContext, baggage);
313
- return context.with(newContext, fn);
314
- }
315
- };
316
- }
317
-
318
- //#endregion
319
- //#region src/correlation-id.ts
320
- /**
321
- * Correlation ID utilities for event-driven observability
322
- *
323
- * Provides a stable join key across events, logs, and spans even when traces fragment.
324
- * Format: 16 hex chars (64 bits), crypto-random, URL-safe.
325
- *
326
- * Lifecycle:
327
- * 1. Generated at boundary root (HTTP server span, message process span, cron job span)
328
- * 2. Reused within context (nested work shares it via AsyncLocalStorage)
329
- * 3. Propagated via baggage (optional, default OFF to avoid header bloat)
330
- *
331
- * @example Basic usage
332
- * ```typescript
333
- * import { generateCorrelationId, getCorrelationId } from 'autotel/correlation-id';
334
- *
335
- * // Generate a new correlation ID
336
- * const id = generateCorrelationId();
337
- * // Returns: 'a1b2c3d4e5f67890'
338
- *
339
- * // Get current correlation ID from context
340
- * const currentId = getCorrelationId();
341
- * ```
342
- */
343
- /**
344
- * AsyncLocalStorage for storing correlation ID
345
- * This allows correlation IDs to persist across async boundaries
346
- */
347
- const correlationStorage = new nodeAsyncHooks.AsyncLocalStorage();
348
- /**
349
- * Baggage key for correlation ID propagation
350
- */
351
- const CORRELATION_ID_BAGGAGE_KEY = "autotel.correlation_id";
352
- /**
353
- * Generate a new correlation ID
354
- *
355
- * Format: 16 hex chars (64 bits), crypto-random, URL-safe
356
- *
357
- * @returns A new correlation ID
358
- *
359
- * @example
360
- * ```typescript
361
- * const id = generateCorrelationId();
362
- * // Returns: 'a1b2c3d4e5f67890'
363
- * ```
364
- */
365
- function generateCorrelationId() {
366
- const bytes = /* @__PURE__ */ new Uint8Array(8);
367
- crypto.getRandomValues(bytes);
368
- return [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");
369
- }
370
- /**
371
- * Get the current correlation ID from context
372
- *
373
- * Resolution order:
374
- * 1. AsyncLocalStorage (from explicit setCorrelationId or runWithCorrelationId)
375
- * 2. Baggage (if propagated from upstream)
376
- * 3. Active span's trace ID (first 16 chars as fallback)
377
- * 4. undefined (if not in any context)
378
- *
379
- * @returns Current correlation ID or undefined
380
- *
381
- * @example
382
- * ```typescript
383
- * const id = getCorrelationId();
384
- * if (id) {
385
- * console.log('Correlation ID:', id);
386
- * }
387
- * ```
388
- */
389
- function getCorrelationId() {
390
- const storedId = correlationStorage.getStore()?.value;
391
- if (storedId) return storedId;
392
- const activeContext = context.active();
393
- const baggageEntry = propagation.getBaggage(activeContext)?.getEntry(CORRELATION_ID_BAGGAGE_KEY);
394
- if (baggageEntry?.value) return baggageEntry.value;
395
- const span = trace.getActiveSpan();
396
- if (span) return span.spanContext().traceId.slice(0, 16);
397
- }
398
- /**
399
- * Get or create a correlation ID
400
- *
401
- * If a correlation ID exists in the current context, returns it.
402
- * Otherwise, generates a new one.
403
- *
404
- * @returns Existing or new correlation ID
405
- *
406
- * @example
407
- * ```typescript
408
- * const id = getOrCreateCorrelationId();
409
- * // Always returns a valid correlation ID
410
- * ```
411
- */
412
- function getOrCreateCorrelationId() {
413
- return getCorrelationId() ?? generateCorrelationId();
414
- }
415
- /**
416
- * Run a function with a specific correlation ID in context
417
- *
418
- * The correlation ID will be available via getCorrelationId() throughout
419
- * the execution of the function and any async operations it spawns.
420
- *
421
- * @param correlationId - Correlation ID to use
422
- * @param fn - Function to execute
423
- * @returns The return value of the function
424
- *
425
- * @example
426
- * ```typescript
427
- * await runWithCorrelationId('abc123', async () => {
428
- * // getCorrelationId() returns 'abc123' here
429
- * await processRequest();
430
- * });
431
- * ```
432
- */
433
- function runWithCorrelationId(correlationId, fn) {
434
- return correlationStorage.run({ value: correlationId }, fn);
435
- }
436
- /**
437
- * Set correlation ID in the current context (mutates context)
438
- *
439
- * Note: This updates the AsyncLocalStorage context. For proper scoping
440
- * across async boundaries, prefer runWithCorrelationId() instead.
441
- *
442
- * @param correlationId - Correlation ID to set
443
- *
444
- * @example
445
- * ```typescript
446
- * setCorrelationId('abc123');
447
- * // Now getCorrelationId() returns 'abc123'
448
- * ```
449
- */
450
- function setCorrelationId(correlationId) {
451
- enterOrRun(correlationStorage, correlationId);
452
- }
453
- /**
454
- * Set correlation ID in baggage for propagation
455
- *
456
- * This adds the correlation ID to the W3C baggage header, allowing it
457
- * to be propagated to downstream services.
458
- *
459
- * Note: Only use this when you explicitly want cross-service propagation.
460
- * Default is OFF to avoid header bloat.
461
- *
462
- * @param correlationId - Correlation ID to propagate
463
- * @returns New context with baggage set
464
- *
465
- * @example
466
- * ```typescript
467
- * const newContext = setCorrelationIdInBaggage('abc123');
468
- * context.with(newContext, () => {
469
- * // Baggage will be propagated in outgoing requests
470
- * });
471
- * ```
472
- */
473
- function setCorrelationIdInBaggage(correlationId) {
474
- const activeContext = context.active();
475
- let baggage = propagation.getBaggage(activeContext) ?? propagation.createBaggage();
476
- baggage = baggage.setEntry(CORRELATION_ID_BAGGAGE_KEY, { value: correlationId });
477
- return propagation.setBaggage(activeContext, baggage);
478
- }
479
- /**
480
- * Get the correlation storage instance (for internal use in init/shutdown)
481
- */
482
- function getCorrelationStorage() {
483
- return correlationStorage;
484
- }
485
-
486
- //#endregion
487
- //#region src/event-queue.ts
488
- const DEFAULT_CONFIG$1 = {
489
- maxSize: 5e4,
490
- batchSize: 100,
491
- flushInterval: 1e4,
492
- maxRetries: 3,
493
- rateLimit: {
494
- maxEventsPerSecond: 100,
495
- burstCapacity: 200
496
- }
497
- };
498
- /**
499
- * Get subscriber name for metrics (stable, low-cardinality)
500
- *
501
- * Priority:
502
- * 1. Explicit config: subscriber.name
503
- * 2. Class static property (if available)
504
- * 3. Fallback: lowercase class name without "Subscriber" suffix
505
- */
506
- function getSubscriberName(subscriber) {
507
- if (subscriber.name) return subscriber.name.toLowerCase();
508
- return (subscriber.constructor?.name || "unknown").replace(/Subscriber$/i, "").toLowerCase();
509
- }
510
- /**
511
- * Events queue with batching and backpressure
512
- *
513
- * Features:
514
- * - Batches events for efficient sending
515
- * - Bounded queue with drop-oldest policy (prod) or blocking (dev)
516
- * - Exponential backoff retry
517
- * - Rate limiting to prevent overwhelming subscribers
518
- * - Graceful flush on shutdown
519
- */
520
- var EventQueue = class {
521
- queue = [];
522
- flushTimer = null;
523
- config;
524
- subscribers;
525
- rateLimiter;
526
- flushPromise = null;
527
- isShuttingDown = false;
528
- metrics = null;
529
- observableCleanups = [];
530
- subscriberHealthy = /* @__PURE__ */ new Map();
531
- constructor(subscribers, config) {
532
- this.subscribers = subscribers;
533
- this.config = {
534
- ...DEFAULT_CONFIG$1,
535
- ...config
536
- };
537
- this.rateLimiter = this.config.rateLimit ? new TokenBucketRateLimiter(this.config.rateLimit) : null;
538
- for (const subscriber of subscribers) {
539
- const name = getSubscriberName(subscriber);
540
- this.subscriberHealthy.set(name, true);
541
- }
542
- this.initMetrics();
543
- }
544
- /**
545
- * Initialize OTel metrics for queue observability
546
- */
547
- initMetrics() {
548
- const meter = getConfig().meter;
549
- const queueSize = meter.createObservableGauge("autotel.event_delivery.queue.size", {
550
- description: "Current number of events in the delivery queue",
551
- unit: "count"
552
- });
553
- const queueSizeCallback = (observableResult) => {
554
- observableResult.observe(this.queue.length);
555
- };
556
- queueSize.addCallback(queueSizeCallback);
557
- this.observableCleanups.push(() => queueSize.removeCallback(queueSizeCallback));
558
- const oldestAge = meter.createObservableGauge("autotel.event_delivery.queue.oldest_age_ms", {
559
- description: "Age of the oldest event in the queue in milliseconds",
560
- unit: "ms"
561
- });
562
- const oldestAgeCallback = (observableResult) => {
563
- if (this.queue.length > 0) {
564
- const oldest = this.queue[0];
565
- const ageMs = Date.now() - oldest.timestamp;
566
- observableResult.observe(ageMs);
567
- } else observableResult.observe(0);
568
- };
569
- oldestAge.addCallback(oldestAgeCallback);
570
- this.observableCleanups.push(() => oldestAge.removeCallback(oldestAgeCallback));
571
- const delivered = meter.createCounter("autotel.event_delivery.queue.delivered", {
572
- description: "Number of events successfully delivered to subscribers",
573
- unit: "count"
574
- });
575
- const failed = meter.createCounter("autotel.event_delivery.queue.failed", {
576
- description: "Number of events that failed delivery after all retry attempts",
577
- unit: "count"
578
- });
579
- const dropped = meter.createCounter("autotel.event_delivery.queue.dropped", {
580
- description: "Number of events dropped from the queue",
581
- unit: "count"
582
- });
583
- const latency = meter.createHistogram("autotel.event_delivery.queue.latency_ms", {
584
- description: "Event delivery latency from enqueue to successful send",
585
- unit: "ms"
586
- });
587
- const subscriberHealth = meter.createObservableGauge("autotel.event_delivery.subscriber.health", {
588
- description: "Subscriber health status (1=healthy, 0=unhealthy)",
589
- unit: "1"
590
- });
591
- const subscriberHealthCallback = (observableResult) => {
592
- for (const [subscriberName, isHealthy] of this.subscriberHealthy) observableResult.observe(isHealthy ? 1 : 0, { subscriber: subscriberName });
593
- };
594
- subscriberHealth.addCallback(subscriberHealthCallback);
595
- this.observableCleanups.push(() => subscriberHealth.removeCallback(subscriberHealthCallback));
596
- this.metrics = {
597
- queueSize,
598
- oldestAge,
599
- delivered,
600
- failed,
601
- dropped,
602
- latency,
603
- subscriberHealth
604
- };
605
- }
606
- /**
607
- * Record a dropped event with reason and emit debug breadcrumb
608
- */
609
- recordDropped(reason, event, subscriberName) {
610
- const attrs = { reason };
611
- if (subscriberName) attrs.subscriber = subscriberName;
612
- this.metrics?.dropped.add(1, attrs);
613
- const logLevel = reason === "payload_invalid" ? "error" : "warn";
614
- const logger = getLogger();
615
- if (logLevel === "error") logger.error({
616
- eventName: event?.name,
617
- subscriber: subscriberName,
618
- reason,
619
- correlationId: event?._correlationId,
620
- traceId: event?._traceId
621
- }, `[autotel] Event dropped: ${reason}`);
622
- else logger.warn({
623
- eventName: event?.name,
624
- subscriber: subscriberName,
625
- reason,
626
- correlationId: event?._correlationId,
627
- traceId: event?._traceId
628
- }, `[autotel] Event dropped: ${reason}`);
629
- }
630
- /**
631
- * Record permanent delivery failure (after all retries exhausted)
632
- * Increments failed counter and logs error
633
- */
634
- recordFailed(event, subscriberName, error) {
635
- this.metrics?.failed.add(1, { subscriber: subscriberName });
636
- this.subscriberHealthy.set(subscriberName, false);
637
- getLogger().error({
638
- eventName: event.name,
639
- subscriber: subscriberName,
640
- correlationId: event._correlationId,
641
- traceId: event._traceId,
642
- err: error
643
- }, `[autotel] Event delivery failed after all retries`);
644
- }
645
- /**
646
- * Mark subscriber as unhealthy on transient failure (without incrementing failed counter)
647
- * Used during retry attempts - only recordFailed should increment the counter
648
- */
649
- markSubscriberUnhealthy(subscriberName) {
650
- this.subscriberHealthy.set(subscriberName, false);
651
- }
652
- /**
653
- * Record successful delivery
654
- */
655
- recordDelivered(event, subscriberName, startTime) {
656
- const latencyMs = Date.now() - startTime;
657
- this.metrics?.delivered.add(1, { subscriber: subscriberName });
658
- this.metrics?.latency.record(latencyMs, { subscriber: subscriberName });
659
- this.subscriberHealthy.set(subscriberName, true);
660
- }
661
- /**
662
- * Enqueue an event for sending
663
- *
664
- * Backpressure policy:
665
- * - Drops oldest event and logs warning if queue is full (same behavior in all environments)
666
- */
667
- enqueue(event) {
668
- if (this.isShuttingDown) {
669
- this.recordDropped("shutdown", event);
670
- return;
671
- }
672
- if (this.queue.length >= this.config.maxSize) {
673
- const droppedEvent = this.queue.shift();
674
- this.recordDropped("rate_limit", droppedEvent);
675
- getLogger().warn({ droppedEvent: droppedEvent?.name }, `[autotel] Events queue full (${this.config.maxSize} events). Dropping oldest event. Events are being produced faster than they can be sent. Check your subscribers or reduce tracking frequency.`);
676
- }
677
- const enrichedEvent = {
678
- ...event,
679
- _correlationId: event._correlationId || getOrCreateCorrelationId()
680
- };
681
- this.queue.push(enrichedEvent);
682
- this.scheduleBatchFlush();
683
- }
684
- /**
685
- * Schedule a batch flush if not already scheduled
686
- */
687
- scheduleBatchFlush() {
688
- if (this.flushTimer || this.flushPromise) return;
689
- this.flushTimer = setTimeout(() => {
690
- this.flushTimer = null;
691
- this.flushBatch();
692
- }, this.config.flushInterval);
693
- }
694
- /**
695
- * Flush a batch of events
696
- * Uses promise-based concurrency control to prevent race conditions
697
- */
698
- async flushBatch() {
699
- if (this.queue.length === 0) return;
700
- if (this.flushPromise) {
701
- await this.flushPromise;
702
- return;
703
- }
704
- this.flushPromise = this.doFlushBatch();
705
- try {
706
- await this.flushPromise;
707
- } finally {
708
- this.flushPromise = null;
709
- if (this.queue.length > 0) this.scheduleBatchFlush();
710
- }
711
- }
712
- /**
713
- * Internal flush implementation
714
- */
715
- async doFlushBatch() {
716
- const batch = this.queue.splice(0, this.config.batchSize);
717
- await this.sendWithRetry(batch, this.config.maxRetries);
718
- }
719
- /**
720
- * Send events with exponential backoff retry
721
- * Tracks per-event, per-subscriber failures so failed counter reflects actual failed deliveries.
722
- * On retry, only failed (event, subscriber) pairs are re-sent to avoid double-counting delivered.
723
- */
724
- async sendWithRetry(events, retriesLeft, subscribersByEventIndex) {
725
- const failedDeliveries = await this.sendToSubscribers(events, subscribersByEventIndex);
726
- if (failedDeliveries.length > 0) if (retriesLeft > 0) {
727
- const failedEventIndicesOrdered = [...new Set(failedDeliveries.map((f) => f.eventIndex))].toSorted((a, b) => a - b);
728
- const eventsToRetry = failedEventIndicesOrdered.map((i) => events[i]);
729
- const failedSubscribersByRetryIndex = /* @__PURE__ */ new Map();
730
- for (const [j, origIndex] of failedEventIndicesOrdered.entries()) {
731
- const set = /* @__PURE__ */ new Set();
732
- for (const { eventIndex, subscriberName } of failedDeliveries) if (eventIndex === origIndex) set.add(subscriberName);
733
- failedSubscribersByRetryIndex.set(j, set);
734
- }
735
- const delay = Math.pow(2, this.config.maxRetries - retriesLeft) * 1e3;
736
- await new Promise((resolve) => setTimeout(resolve, delay));
737
- return this.sendWithRetry(eventsToRetry, retriesLeft - 1, failedSubscribersByRetryIndex);
738
- } else {
739
- for (const { eventIndex, subscriberName, error } of failedDeliveries) {
740
- const event = events[eventIndex];
741
- if (event) this.recordFailed(event, subscriberName, error);
742
- }
743
- const failedSubscriberNames = [...new Set(failedDeliveries.map((f) => f.subscriberName))];
744
- getLogger().error({
745
- failedSubscribers: failedSubscriberNames,
746
- retriesAttempted: this.config.maxRetries
747
- }, "[autotel] Failed to send events after retries");
748
- }
749
- }
750
- /**
751
- * Send events to configured subscribers with rate limiting and metrics.
752
- * When subscribersByEventIndex is provided (retry path), only those subscribers are tried per event.
753
- * Returns per-event, per-subscriber failures (empty if all succeeded).
754
- */
755
- async sendToSubscribers(events, subscribersByEventIndex) {
756
- const failedDeliveries = [];
757
- const sendOne = async (event, eventIndex) => {
758
- const subscriberNames = subscribersByEventIndex?.get(eventIndex);
759
- const failures = await this.sendEventToSubscribers(event, subscriberNames ?? void 0);
760
- for (const failure of failures) failedDeliveries.push({
761
- eventIndex,
762
- subscriberName: failure.subscriberName,
763
- error: failure.error
764
- });
765
- };
766
- if (!this.rateLimiter) {
767
- for (const [i, event] of events.entries()) if (event) await sendOne(event, i);
768
- return failedDeliveries;
769
- }
770
- for (const [i, event] of events.entries()) {
771
- await this.rateLimiter.waitForToken();
772
- if (event) await sendOne(event, i);
773
- }
774
- return failedDeliveries;
775
- }
776
- /**
777
- * Send a single event to subscribers.
778
- * - When subscriberNames is undefined (initial attempt): send to all subscribers.
779
- * - When subscriberNames is provided (retry): send only to those subscribers (never re-send to healthy ones).
780
- * Returns list of subscribers that failed (empty if all succeeded).
781
- */
782
- async sendEventToSubscribers(event, subscriberNames) {
783
- const startTime = event.timestamp;
784
- const failures = [];
785
- const subscribersToTry = subscriberNames === void 0 ? this.subscribers : this.subscribers.filter((s) => subscriberNames.has(getSubscriberName(s)));
786
- const results = await Promise.allSettled(subscribersToTry.map(async (subscriber) => {
787
- const subscriberName = getSubscriberName(subscriber);
788
- try {
789
- await subscriber.trackEvent(event.name, event.attributes, {
790
- autotel: event.autotel,
791
- schema: event.schema
792
- });
793
- this.recordDelivered(event, subscriberName, startTime);
794
- return {
795
- subscriberName,
796
- success: true
797
- };
798
- } catch (error) {
799
- this.markSubscriberUnhealthy(subscriberName);
800
- return {
801
- subscriberName,
802
- success: false,
803
- error: error instanceof Error ? error : void 0
804
- };
805
- }
806
- }));
807
- for (const result of results) if (result.status === "fulfilled" && !result.value.success) failures.push({
808
- subscriberName: result.value.subscriberName,
809
- error: result.value.error
810
- });
811
- return failures;
812
- }
813
- /**
814
- * Flush all remaining events. Queue remains usable after flush (e.g. for
815
- * auto-flush at root span end). Use shutdown() when tearing down the queue.
816
- */
817
- async flush() {
818
- if (this.flushTimer) {
819
- clearTimeout(this.flushTimer);
820
- this.flushTimer = null;
821
- }
822
- if (this.flushPromise) await this.flushPromise;
823
- while (this.queue.length > 0) await this.doFlushBatch();
824
- }
825
- /**
826
- * Flush remaining events and permanently disable the queue (reject new events).
827
- * Use for process/SDK shutdown; use flush() for periodic or span-end drain.
828
- */
829
- async shutdown() {
830
- this.isShuttingDown = true;
831
- await this.flush();
832
- }
833
- /**
834
- * Cleanup observable metric callbacks to prevent memory leaks
835
- * Call this when destroying the EventQueue instance
836
- */
837
- cleanup() {
838
- for (const cleanupFn of this.observableCleanups) try {
839
- cleanupFn();
840
- } catch {}
841
- this.observableCleanups = [];
842
- }
843
- /**
844
- * Get queue size (for testing/debugging)
845
- */
846
- size() {
847
- return this.queue.length;
848
- }
849
- /**
850
- * Get subscriber health status (for testing/debugging)
851
- */
852
- getSubscriberHealth() {
853
- return new Map(this.subscriberHealthy);
854
- }
855
- /**
856
- * Check if a specific subscriber is healthy
857
- */
858
- isSubscriberHealthy(subscriberName) {
859
- return this.subscriberHealthy.get(subscriberName.toLowerCase()) ?? true;
860
- }
861
- /**
862
- * Manually mark a subscriber as healthy or unhealthy
863
- * (used for circuit breaker integration)
864
- */
865
- setSubscriberHealth(subscriberName, healthy) {
866
- this.subscriberHealthy.set(subscriberName.toLowerCase(), healthy);
867
- }
868
- };
869
-
870
- //#endregion
871
- //#region src/validation.ts
872
- const DEFAULT_CONFIG = {
873
- maxEventNameLength: 100,
874
- maxAttributeKeyLength: 100,
875
- maxAttributeValueLength: 1e3,
876
- maxAttributeCount: 50,
877
- maxNestingDepth: 3,
878
- sensitivePatterns: [
879
- /password/i,
880
- /secret/i,
881
- /token/i,
882
- /api[_-]?key/i,
883
- /access[_-]?key/i,
884
- /private[_-]?key/i,
885
- /auth/i,
886
- /credential/i,
887
- /ssn/i,
888
- /credit[_-]?card/i
889
- ]
890
- };
891
- var ValidationError = class extends Error {
892
- constructor(message) {
893
- super(message);
894
- this.name = "ValidationError";
895
- }
896
- };
897
- /**
898
- * Validate and sanitize event name
899
- * Throws ValidationError if invalid
900
- */
901
- function validateEventName(eventName, config = DEFAULT_CONFIG) {
902
- if (typeof eventName !== "string") throw new ValidationError(`Event name must be a string, got ${typeof eventName}`);
903
- const trimmed = eventName.trim();
904
- if (trimmed.length === 0) throw new ValidationError("Event name cannot be empty");
905
- if (trimmed.length > config.maxEventNameLength) throw new ValidationError(`Event name too long (${trimmed.length} chars). Max: ${config.maxEventNameLength}`);
906
- if (!/^[a-zA-Z0-9._-]+$/.test(trimmed)) throw new ValidationError(`Event name contains invalid characters: "${trimmed}". Use only letters, numbers, dots, underscores, and hyphens.`);
907
- return trimmed;
908
- }
909
- /**
910
- * Validate and sanitize attributes
911
- * Returns sanitized attributes (sensitive data redacted)
912
- */
913
- function validateAttributes(attributes, config = DEFAULT_CONFIG) {
914
- if (attributes === void 0 || attributes === null) return;
915
- if (typeof attributes !== "object" || Array.isArray(attributes)) throw new ValidationError("Attributes must be an object");
916
- const keys = Object.keys(attributes);
917
- if (keys.length > config.maxAttributeCount) throw new ValidationError(`Too many attributes (${keys.length}). Max: ${config.maxAttributeCount}`);
918
- const sanitized = {};
919
- for (const key of keys) {
920
- if (key.length > config.maxAttributeKeyLength) throw new ValidationError(`Attribute key too long: "${key.slice(0, 20)}..." (${key.length} chars). Max: ${config.maxAttributeKeyLength}`);
921
- const value = attributes[key];
922
- if (typeof value === "string" && config.sensitivePatterns.some((pattern) => pattern.test(key))) {
923
- sanitized[key] = "[REDACTED]";
924
- continue;
925
- }
926
- sanitized[key] = sanitizeValue(value, config, 1);
927
- }
928
- return sanitized;
929
- }
930
- /**
931
- * Sanitize attribute value (recursive)
932
- */
933
- function sanitizeValue(value, config, depth) {
934
- if (depth > config.maxNestingDepth) return "[MAX_DEPTH_EXCEEDED]";
935
- if (value === null || value === void 0) return value;
936
- if (typeof value === "string") {
937
- if (value.length > config.maxAttributeValueLength) return value.slice(0, config.maxAttributeValueLength) + "...";
938
- return value;
939
- }
940
- if (typeof value === "number" || typeof value === "boolean") return value;
941
- if (Array.isArray(value)) return value.map((item) => sanitizeValue(item, config, depth + 1));
942
- if (typeof value === "object") try {
943
- JSON.stringify(value);
944
- const sanitized = {};
945
- for (const key in value) if (Object.prototype.hasOwnProperty.call(value, key)) {
946
- const nested = value[key];
947
- sanitized[key] = typeof nested === "string" && config.sensitivePatterns.some((pattern) => pattern.test(key)) ? "[REDACTED]" : sanitizeValue(nested, config, depth + 1);
948
- }
949
- return sanitized;
950
- } catch {
951
- return "[CIRCULAR]";
952
- }
953
- return `[${typeof value}]`;
954
- }
955
- /**
956
- * Validate and sanitize an events event
957
- * Returns { eventName, attributes } with sanitized values
958
- */
959
- function validateEvent(eventName, attributes, config) {
960
- const fullConfig = {
961
- ...DEFAULT_CONFIG,
962
- ...config
963
- };
964
- return {
965
- eventName: validateEventName(eventName, fullConfig),
966
- attributes: validateAttributes(attributes, fullConfig)
967
- };
968
- }
969
-
970
- //#endregion
971
- //#region src/track.ts
972
- /**
973
- * Global track() function for business events
974
- *
975
- * Simple, no instantiation needed, auto-attaches trace context
976
- */
977
- let eventsQueue = null;
978
- /**
979
- * Build autotel event context for trace correlation
980
- *
981
- * Works in multiple contexts:
982
- * 1. Inside a span → use current span's trace_id + span_id
983
- * 2. Outside span → use correlation_id only
984
- * 3. With trace URL config → include clickable trace URL
985
- */
986
- function buildAutotelContext(span) {
987
- const eventsConfig = getEventsConfig();
988
- const config = getConfig$1();
989
- const correlationId = getOrCreateCorrelationId();
990
- if (!eventsConfig?.includeTraceContext) return { correlation_id: correlationId };
991
- const autotelContext = { correlation_id: correlationId };
992
- const spanContext = span?.spanContext();
993
- if (spanContext) {
994
- autotelContext.trace_id = spanContext.traceId;
995
- autotelContext.span_id = spanContext.spanId;
996
- autotelContext.trace_flags = spanContext.traceFlags.toString(16).padStart(2, "0");
997
- const traceState = spanContext.traceState;
998
- if (traceState) try {
999
- if (typeof traceState.serialize === "function") {
1000
- const traceStateStr = traceState.serialize();
1001
- if (traceStateStr) autotelContext.trace_state = traceStateStr;
1002
- }
1003
- } catch {}
1004
- if (eventsConfig.traceUrl && config) {
1005
- const traceUrl = eventsConfig.traceUrl({
1006
- traceId: spanContext.traceId,
1007
- spanId: spanContext.spanId,
1008
- correlationId,
1009
- serviceName: config.service,
1010
- environment: config.environment
1011
- });
1012
- if (traceUrl) autotelContext.trace_url = traceUrl;
1013
- }
1014
- } else if (eventsConfig.traceUrl && config) {
1015
- const traceUrl = eventsConfig.traceUrl({
1016
- correlationId,
1017
- serviceName: config.service,
1018
- environment: config.environment
1019
- });
1020
- if (traceUrl) autotelContext.trace_url = traceUrl;
1021
- }
1022
- return autotelContext;
1023
- }
1024
- /**
1025
- * Initialize events queue lazily
1026
- */
1027
- function getOrCreateQueue() {
1028
- if (!isInitialized()) {
1029
- warnIfNotInitialized("track()");
1030
- return null;
1031
- }
1032
- if (!eventsQueue) {
1033
- const config = getConfig$1();
1034
- if (!config?.subscribers || config.subscribers.length === 0) return null;
1035
- eventsQueue = new EventQueue(config.subscribers);
1036
- }
1037
- return eventsQueue;
1038
- }
1039
- /**
1040
- * Track a business events event
1041
- *
1042
- * Features:
1043
- * - Auto-attaches traceId and spanId if in active span
1044
- * - Batched sending with retry
1045
- * - Type-safe with optional generic
1046
- * - No-op if init() not called or no subscribers configured
1047
- *
1048
- * @example Basic usage
1049
- * ```typescript
1050
- * track('user.signup', { userId: '123', plan: 'pro' })
1051
- * ```
1052
- *
1053
- * @example With type safety
1054
- * ```typescript
1055
- * interface EventDatas {
1056
- * 'user.signup': { userId: string; plan: string }
1057
- * 'plan.upgraded': { userId: string; revenue: number }
1058
- * }
1059
- *
1060
- * track<EventDatas>('user.signup', { userId: '123', plan: 'pro' })
1061
- * ```
1062
- *
1063
- * @example Trace correlation (automatic)
1064
- * ```typescript
1065
- * @Instrumented()
1066
- * class UserService {
1067
- * async createUser(data: CreateUserData) {
1068
- * // This track call automatically includes traceId + spanId
1069
- * track('user.signup', { userId: data.id })
1070
- * }
1071
- * }
1072
- * ```
1073
- */
1074
- function track(event, data, options) {
1075
- const queue = getOrCreateQueue();
1076
- if (!queue) return;
1077
- const validated = validateEvent(event, data, getValidationConfig() || void 0);
1078
- const span = trace.getActiveSpan();
1079
- const enrichedData = span ? {
1080
- ...validated.attributes,
1081
- traceId: span.spanContext().traceId,
1082
- spanId: span.spanContext().spanId
1083
- } : validated.attributes;
1084
- const autotelContext = buildAutotelContext(span);
1085
- queue.enqueue({
1086
- name: validated.eventName,
1087
- attributes: enrichedData,
1088
- timestamp: Date.now(),
1089
- autotel: autotelContext,
1090
- schema: options?.schema
1091
- });
1092
- }
1093
- /**
1094
- * Get events queue (for flush/shutdown)
1095
- * @internal
1096
- */
1097
- function getEventQueue() {
1098
- return eventsQueue;
1099
- }
1100
- /**
1101
- * Reset events queue (for shutdown/cleanup)
1102
- * @internal
1103
- */
1104
- function resetEventQueue() {
1105
- eventsQueue = null;
1106
- }
1107
-
1108
- //#endregion
1109
- export { CORRELATION_ID_BAGGAGE_KEY as a, getCorrelationStorage as c, setCorrelationId as d, setCorrelationIdInBaggage as f, getContextStorage as g, getActiveContextWithBaggage as h, validateEvent as i, getOrCreateCorrelationId as l, defineBaggageSchema as m, resetEventQueue as n, generateCorrelationId as o, createTraceContext as p, track as r, getCorrelationId as s, getEventQueue as t, runWithCorrelationId as u };
1110
- //# sourceMappingURL=track-BBcxEJEC.js.map