autotel 6.4.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -23
- package/dist/{attribute-redacting-processor-Pk7lAzWd.d.cts → attribute-redacting-processor-CvBE0z1p.d.cts} +33 -1
- package/dist/{attribute-redacting-processor-Pk7lAzWd.d.ts → attribute-redacting-processor-CvBE0z1p.d.ts} +33 -1
- package/dist/attribute-redacting-processor.cjs +34 -32
- package/dist/attribute-redacting-processor.d.cts +1 -1
- package/dist/attribute-redacting-processor.d.ts +1 -1
- package/dist/attribute-redacting-processor.js +35 -32
- package/dist/{attributes-aDmJYral.cjs → attributes-Cxys8tgr.cjs} +34 -35
- package/dist/{attributes-B7wix2VG.js → attributes-Dt4YUYbP.js} +34 -35
- package/dist/attributes.cjs +1 -1
- package/dist/attributes.d.cts +1 -1
- package/dist/attributes.d.ts +1 -1
- package/dist/attributes.js +1 -1
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/business-baggage.cjs +19 -12
- package/dist/business-baggage.d.cts +8 -3
- package/dist/business-baggage.d.ts +8 -3
- package/dist/business-baggage.js +19 -12
- package/dist/{canonical-log-line-processor-DxtBGZIi.cjs → canonical-log-line-processor-DolzdawH.cjs} +43 -32
- package/dist/{canonical-log-line-processor-B4WgG-VS.d.cts → canonical-log-line-processor-cPB4Axk-.d.ts} +4 -3
- package/dist/{canonical-log-line-processor-B0vq_QR6.js → canonical-log-line-processor-hFUmS__K.js} +43 -32
- package/dist/{canonical-log-line-processor-CL_J7gb5.d.ts → canonical-log-line-processor-l0Aqe6yp.d.cts} +4 -3
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{correlated-events-kSwLo3mi.cjs → correlated-events-CcuknWnU.cjs} +2 -1
- package/dist/{correlated-events-Bzh5y-UB.js → correlated-events-DwMMbItg.js} +3 -1
- package/dist/correlation-id.cjs +1 -1
- package/dist/correlation-id.js +1 -1
- package/dist/db.cjs +34 -19
- package/dist/db.js +34 -19
- package/dist/decorators.cjs +4 -2
- package/dist/decorators.d.cts +16 -11
- package/dist/decorators.d.ts +16 -11
- package/dist/decorators.js +4 -2
- package/dist/{define-event-CGG048HE.d.cts → define-event-BNeuKUPv.d.cts} +1 -1
- package/dist/{define-event-B2z1SBe7.d.ts → define-event-Bd8f8mST.d.ts} +1 -1
- package/dist/diagnostics.cjs +18 -16
- package/dist/diagnostics.d.cts +14 -10
- package/dist/diagnostics.d.ts +14 -10
- package/dist/diagnostics.js +18 -16
- package/dist/{event-subscriber-CWh8sTGh.d.cts → event-subscriber-DMACQA-1.d.cts} +19 -9
- package/dist/{event-subscriber-CWh8sTGh.d.ts → event-subscriber-DMACQA-1.d.ts} +19 -9
- package/dist/event-subscriber.d.cts +2 -2
- package/dist/event-subscriber.d.ts +2 -2
- package/dist/{event-testing-D0qWfqAy.d.cts → event-testing-CBtnJXE5.d.cts} +1 -1
- package/dist/{event-testing-CA2mIx1E.d.ts → event-testing-CkPgV3Ii.d.ts} +1 -1
- package/dist/event-testing.d.cts +1 -1
- package/dist/event-testing.d.ts +1 -1
- package/dist/event.cjs +1 -1
- package/dist/event.d.cts +5 -5
- package/dist/event.d.ts +5 -5
- package/dist/event.js +1 -1
- package/dist/exception-fingerprint.cjs +133 -0
- package/dist/exception-fingerprint.d.cts +51 -0
- package/dist/exception-fingerprint.d.ts +51 -0
- package/dist/exception-fingerprint.js +126 -0
- package/dist/{functional-AT22vCw6.d.ts → functional-CJn2zY4o.d.cts} +96 -39
- package/dist/{functional-e6jw5zQj.d.cts → functional-DXy1cHFF.d.ts} +96 -39
- package/dist/{functional-qZxRcIBp.cjs → functional-Da6Yv64r.cjs} +27 -15
- package/dist/{functional-0o9xSedq.js → functional-uSbNnnxK.js} +27 -15
- package/dist/functional.cjs +1 -1
- package/dist/functional.d.cts +2 -2
- package/dist/functional.d.ts +2 -2
- package/dist/functional.js +1 -1
- package/dist/http.cjs +11 -8
- package/dist/http.js +11 -8
- package/dist/{index-DolOVX6F.d.ts → index-CwrNAsgk.d.ts} +22 -26
- package/dist/{index-BPcxVucm.d.cts → index-DQHf4cNl.d.cts} +22 -26
- package/dist/index.cjs +41 -35
- package/dist/index.d.cts +45 -30
- package/dist/index.d.ts +45 -30
- package/dist/index.js +41 -35
- package/dist/{init-CsODvlau.d.ts → init-BgnYi2sm.d.ts} +94 -90
- package/dist/{init-BnxHAi2M.cjs → init-D4m5rCmD.cjs} +142 -123
- package/dist/{init-Cc7-vvzj.d.cts → init-DrlL1eis.d.cts} +94 -90
- package/dist/{init-BxfZ3Vbw.js → init-JtX-KKz_.js} +137 -124
- package/dist/instrumentation.cjs +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{logger-D3Ej3DII.js → logger-DdPp__xW.js} +63 -54
- package/dist/{logger-CN4xpzMd.d.cts → logger-S1Fgl0g3.d.cts} +0 -20
- package/dist/{logger-CN4xpzMd.d.ts → logger-S1Fgl0g3.d.ts} +0 -20
- package/dist/{logger-thMPLpOG.cjs → logger-Sm66cjKl.cjs} +63 -54
- package/dist/logger.cjs +1 -1
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +1 -1
- package/dist/messaging-adapters.cjs +26 -12
- package/dist/messaging-adapters.d.cts +0 -30
- package/dist/messaging-adapters.d.ts +0 -30
- package/dist/messaging-adapters.js +26 -12
- package/dist/messaging.cjs +37 -34
- package/dist/messaging.d.cts +21 -62
- package/dist/messaging.d.ts +21 -62
- package/dist/messaging.js +37 -34
- package/dist/{metric-testing-CpvP3ZIa.d.cts → metric-testing-86WO1wan.d.cts} +1 -1
- package/dist/{metric-testing-CWm6UhaR.d.ts → metric-testing-CbCxdPBp.d.ts} +1 -1
- package/dist/metric-testing.d.cts +1 -1
- package/dist/metric-testing.d.ts +1 -1
- package/dist/metric.d.cts +3 -3
- package/dist/metric.d.ts +3 -3
- package/dist/{node-require-vROmTeJ8.js → node-require-DSPjaw_l.js} +3 -2
- package/dist/{node-require-PFqDihze.cjs → node-require-EifOMikz.cjs} +3 -2
- package/dist/parse-error.cjs +18 -12
- package/dist/parse-error.d.cts +2 -1
- package/dist/parse-error.d.ts +2 -1
- package/dist/parse-error.js +19 -12
- package/dist/policy.cjs +0 -0
- package/dist/policy.js +0 -0
- package/dist/processors.cjs +1 -1
- package/dist/processors.d.cts +1 -1
- package/dist/processors.d.ts +1 -1
- package/dist/processors.js +1 -1
- package/dist/{sampling-BR9fkSwx.d.cts → sampling-CM5S2Lp3.d.ts} +5 -6
- package/dist/{sampling-CP3e7-Yr.d.ts → sampling-CmRdnXUi.d.cts} +5 -6
- package/dist/sampling.cjs +3 -2
- package/dist/sampling.d.cts +1 -1
- package/dist/sampling.d.ts +1 -1
- package/dist/sampling.js +3 -2
- package/dist/semantic-helpers.cjs +9 -9
- package/dist/semantic-helpers.d.cts +1 -1
- package/dist/semantic-helpers.d.ts +1 -1
- package/dist/semantic-helpers.js +9 -9
- package/dist/{stable-hash-ChFBIhNt.js → stable-hash-BkoAYVks.js} +4 -3
- package/dist/{stable-hash-CS9BxvVQ.cjs → stable-hash-C0pOegH_.cjs} +4 -3
- package/dist/{structured-error-CHg7DoIQ.cjs → structured-error--_wXpd_C.cjs} +34 -25
- package/dist/{structured-error-9--cxBay.js → structured-error-YIuka-FE.js} +34 -25
- package/dist/test-span-collector.cjs +15 -8
- package/dist/test-span-collector.js +15 -8
- package/dist/testing.cjs +16 -18
- package/dist/testing.d.cts +7 -6
- package/dist/testing.d.ts +7 -6
- package/dist/testing.js +16 -18
- package/dist/{trace-context-IuyoPyNq.d.cts → trace-context-C1Cn1q0y.d.cts} +8 -7
- package/dist/{trace-context-IuyoPyNq.d.ts → trace-context-f89xPJbK.d.ts} +8 -7
- package/dist/trace-helpers.cjs +16 -13
- package/dist/trace-helpers.d.cts +9 -4
- package/dist/trace-helpers.d.ts +9 -4
- package/dist/trace-helpers.js +16 -13
- package/dist/tracer-provider.cjs +8 -12
- package/dist/tracer-provider.js +8 -12
- package/dist/validate.cjs +22 -20
- package/dist/validate.d.cts +3 -2
- package/dist/validate.d.ts +3 -2
- package/dist/validate.js +22 -20
- package/dist/values-BenyvWKz.js +141 -0
- package/dist/values-CeMH-mYG.d.cts +8 -0
- package/dist/values-CeMH-mYG.d.ts +8 -0
- package/dist/values-DApyq53y.cjs +267 -0
- package/dist/webhook.cjs +3 -3
- package/dist/webhook.d.cts +1 -1
- package/dist/webhook.d.ts +1 -1
- package/dist/webhook.js +3 -3
- package/dist/workflow-distributed.cjs +9 -7
- package/dist/workflow-distributed.d.cts +9 -8
- package/dist/workflow-distributed.d.ts +9 -8
- package/dist/workflow-distributed.js +9 -7
- package/dist/workflow.cjs +26 -17
- package/dist/workflow.d.cts +1 -28
- package/dist/workflow.d.ts +1 -28
- package/dist/workflow.js +26 -17
- package/dist/yaml-config.cjs +26 -11
- package/dist/yaml-config.d.cts +9 -3
- package/dist/yaml-config.d.ts +9 -3
- package/dist/yaml-config.js +26 -11
- package/package.json +6 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
2
|
+
const require_values = require('./values-DApyq53y.cjs');
|
|
2
3
|
const require_tracer_provider = require('./tracer-provider.cjs');
|
|
3
4
|
const require_config = require('./config.cjs');
|
|
4
5
|
const require_sampling = require('./sampling.cjs');
|
|
5
|
-
const require_node_require = require('./node-require-
|
|
6
|
+
const require_node_require = require('./node-require-EifOMikz.cjs');
|
|
6
7
|
const require_tail_sampling_processor = require('./tail-sampling-processor.cjs');
|
|
7
8
|
const require_filtering_span_processor = require('./filtering-span-processor.cjs');
|
|
8
9
|
const require_policy = require('./policy.cjs');
|
|
@@ -10,8 +11,8 @@ const require_span_name_normalizer = require('./span-name-normalizer.cjs');
|
|
|
10
11
|
const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
|
|
11
12
|
const require_pretty_console_exporter = require('./pretty-console-exporter-CMzlrRNg.cjs');
|
|
12
13
|
const require_yaml_config = require('./yaml-config.cjs');
|
|
13
|
-
const require_canonical_log_line_processor = require('./canonical-log-line-processor-
|
|
14
|
-
const require_structured_error = require('./structured-error
|
|
14
|
+
const require_canonical_log_line_processor = require('./canonical-log-line-processor-DolzdawH.cjs');
|
|
15
|
+
const require_structured_error = require('./structured-error--_wXpd_C.cjs');
|
|
15
16
|
const require_metric = require('./metric.cjs');
|
|
16
17
|
let _opentelemetry_sdk_node = require("@opentelemetry/sdk-node");
|
|
17
18
|
let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
@@ -27,6 +28,37 @@ let _opentelemetry_exporter_metrics_otlp_http = require("@opentelemetry/exporter
|
|
|
27
28
|
let _opentelemetry_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
|
|
28
29
|
let _opentelemetry_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
|
|
29
30
|
|
|
31
|
+
//#region src/init-logger.ts
|
|
32
|
+
const LOG_LEVELS = {
|
|
33
|
+
debug: 0,
|
|
34
|
+
info: 1,
|
|
35
|
+
warn: 2,
|
|
36
|
+
error: 3
|
|
37
|
+
};
|
|
38
|
+
/** Silent logger used until and unless the application opts into diagnostics. */
|
|
39
|
+
const silentLogger = {
|
|
40
|
+
info: () => {},
|
|
41
|
+
warn: () => {},
|
|
42
|
+
error: () => {},
|
|
43
|
+
debug: () => {}
|
|
44
|
+
};
|
|
45
|
+
/** Apply the resolved silence and minimum-level settings to a logger. */
|
|
46
|
+
function wrapLogger(base, silent, minLevel) {
|
|
47
|
+
if (silent) return silentLogger;
|
|
48
|
+
const threshold = LOG_LEVELS[minLevel];
|
|
49
|
+
const wrap = (fn, level) => {
|
|
50
|
+
if (LOG_LEVELS[level] < threshold) return (() => {});
|
|
51
|
+
return ((...args) => fn(...args));
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
debug: wrap(base.debug, "debug"),
|
|
55
|
+
info: wrap(base.info, "info"),
|
|
56
|
+
warn: wrap(base.warn, "warn"),
|
|
57
|
+
error: wrap(base.error, "error")
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
30
62
|
//#region src/posthog-logs.ts
|
|
31
63
|
var RedactingLogRecordProcessor = class {
|
|
32
64
|
wrapped;
|
|
@@ -36,10 +68,15 @@ var RedactingLogRecordProcessor = class {
|
|
|
36
68
|
this.redact = redact;
|
|
37
69
|
}
|
|
38
70
|
onEmit(logRecord, context) {
|
|
39
|
-
|
|
40
|
-
if (logRecord.
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
const body = require_values.asString(logRecord.body);
|
|
72
|
+
if (body) logRecord.body = this.redact(body);
|
|
73
|
+
if (logRecord.attributes) for (const [key, value] of Object.entries(logRecord.attributes)) {
|
|
74
|
+
const text = require_values.asString(value);
|
|
75
|
+
if (text !== void 0) logRecord.attributes[key] = this.redact(text);
|
|
76
|
+
else if (Array.isArray(value)) logRecord.attributes[key] = value.map((item) => {
|
|
77
|
+
const entry = require_values.asString(item);
|
|
78
|
+
return entry === void 0 ? item : this.redact(entry);
|
|
79
|
+
});
|
|
43
80
|
}
|
|
44
81
|
this.wrapped.onEmit(logRecord, context);
|
|
45
82
|
}
|
|
@@ -535,6 +572,11 @@ var TokenBucketRateLimiter = class {
|
|
|
535
572
|
|
|
536
573
|
//#endregion
|
|
537
574
|
//#region src/trace-context.ts
|
|
575
|
+
const spansWithExplicitStatus = /* @__PURE__ */ new WeakSet();
|
|
576
|
+
/** Whether a TraceContext consumer explicitly chose this span's status. */
|
|
577
|
+
function hasExplicitSpanStatus(span) {
|
|
578
|
+
return spansWithExplicitStatus.has(span);
|
|
579
|
+
}
|
|
538
580
|
/**
|
|
539
581
|
* AsyncLocalStorage for storing the active context with baggage
|
|
540
582
|
* This allows setters to update the context and have it persist
|
|
@@ -588,7 +630,7 @@ function updateActiveContext(newContext) {
|
|
|
588
630
|
asyncLocal.enterWith(newContext);
|
|
589
631
|
return;
|
|
590
632
|
}
|
|
591
|
-
if (
|
|
633
|
+
if (require_values.isFunction(manager.with)) manager.with(newContext, () => {});
|
|
592
634
|
}
|
|
593
635
|
/**
|
|
594
636
|
* Create a TraceContext from an OpenTelemetry Span
|
|
@@ -611,15 +653,18 @@ function createTraceContext(span) {
|
|
|
611
653
|
correlationId: spanContext.traceId.slice(0, 16),
|
|
612
654
|
setAttribute: span.setAttribute.bind(span),
|
|
613
655
|
setAttributes: span.setAttributes.bind(span),
|
|
614
|
-
setStatus:
|
|
656
|
+
setStatus: (status) => {
|
|
657
|
+
spansWithExplicitStatus.add(span);
|
|
658
|
+
span.setStatus(status);
|
|
659
|
+
},
|
|
615
660
|
recordException: span.recordException.bind(span),
|
|
616
661
|
addEvent: span.addEvent.bind(span),
|
|
617
662
|
addLink: span.addLink.bind(span),
|
|
618
663
|
addLinks: span.addLinks.bind(span),
|
|
619
664
|
updateName: span.updateName.bind(span),
|
|
620
665
|
isRecording: span.isRecording.bind(span),
|
|
621
|
-
recordError: (
|
|
622
|
-
const err =
|
|
666
|
+
recordError: (cause) => {
|
|
667
|
+
const err = cause instanceof Error ? cause : new Error(String(cause));
|
|
623
668
|
require_structured_error.recordStructuredError(traceCtx, err);
|
|
624
669
|
},
|
|
625
670
|
track: (event, data) => {
|
|
@@ -669,12 +714,11 @@ function createTraceContext(span) {
|
|
|
669
714
|
}
|
|
670
715
|
if (!baggage) return;
|
|
671
716
|
const prefix = namespace ? `${namespace}.` : "";
|
|
672
|
-
const
|
|
673
|
-
for (const [key, entry] of baggage.getAllEntries()) if (namespace && key.startsWith(prefix))
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
717
|
+
const entries = [];
|
|
718
|
+
for (const [key, entry] of baggage.getAllEntries()) if (namespace && key.startsWith(prefix)) entries.push([key.slice(prefix.length), entry.value]);
|
|
719
|
+
else if (!namespace) entries.push([key, entry.value]);
|
|
720
|
+
const result = Object.fromEntries(entries);
|
|
721
|
+
return entries.length > 0 ? result : void 0;
|
|
678
722
|
}),
|
|
679
723
|
setTypedBaggage: ((namespace, value) => {
|
|
680
724
|
const currentContext = getActiveContextWithBaggage();
|
|
@@ -1380,7 +1424,7 @@ var ValidationError = class extends Error {
|
|
|
1380
1424
|
* Throws ValidationError if invalid
|
|
1381
1425
|
*/
|
|
1382
1426
|
function validateEventName(eventName, config = DEFAULT_CONFIG$1) {
|
|
1383
|
-
if (
|
|
1427
|
+
if (require_values.asString(eventName) === void 0) throw new ValidationError(`Event name must be a string, got ${require_values.describeValue(eventName)}`);
|
|
1384
1428
|
const trimmed = eventName.trim();
|
|
1385
1429
|
if (trimmed.length === 0) throw new ValidationError("Event name cannot be empty");
|
|
1386
1430
|
if (trimmed.length > config.maxEventNameLength) throw new ValidationError(`Event name too long (${trimmed.length} chars). Max: ${config.maxEventNameLength}`);
|
|
@@ -1393,14 +1437,14 @@ function validateEventName(eventName, config = DEFAULT_CONFIG$1) {
|
|
|
1393
1437
|
*/
|
|
1394
1438
|
function validateAttributes(attributes, config = DEFAULT_CONFIG$1) {
|
|
1395
1439
|
if (attributes === void 0 || attributes === null) return;
|
|
1396
|
-
if (
|
|
1440
|
+
if (!require_values.asRecord(attributes)) throw new ValidationError("Attributes must be an object");
|
|
1397
1441
|
const keys = Object.keys(attributes);
|
|
1398
1442
|
if (keys.length > config.maxAttributeCount) throw new ValidationError(`Too many attributes (${keys.length}). Max: ${config.maxAttributeCount}`);
|
|
1399
1443
|
const sanitized = {};
|
|
1400
1444
|
for (const key of keys) {
|
|
1401
1445
|
if (key.length > config.maxAttributeKeyLength) throw new ValidationError(`Attribute key too long: "${key.slice(0, 20)}..." (${key.length} chars). Max: ${config.maxAttributeKeyLength}`);
|
|
1402
1446
|
const value = attributes[key];
|
|
1403
|
-
if (
|
|
1447
|
+
if (isSensitiveString(key, value, config)) {
|
|
1404
1448
|
sanitized[key] = "[REDACTED]";
|
|
1405
1449
|
continue;
|
|
1406
1450
|
}
|
|
@@ -1409,29 +1453,35 @@ function validateAttributes(attributes, config = DEFAULT_CONFIG$1) {
|
|
|
1409
1453
|
return sanitized;
|
|
1410
1454
|
}
|
|
1411
1455
|
/**
|
|
1456
|
+
* Whether this key/value pair is a credential to redact. Strings only:
|
|
1457
|
+
* numeric and boolean values are not credentials, and replacing them with the
|
|
1458
|
+
* literal '[REDACTED]' leaks no signal while breaking every consumer that
|
|
1459
|
+
* treats them as a number.
|
|
1460
|
+
*/
|
|
1461
|
+
function isSensitiveString(key, value, config) {
|
|
1462
|
+
return require_values.asString(value) !== void 0 && config.sensitivePatterns.some((pattern) => pattern.test(key));
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1412
1465
|
* Sanitize attribute value (recursive)
|
|
1413
1466
|
*/
|
|
1414
1467
|
function sanitizeValue(value, config, depth) {
|
|
1415
1468
|
if (depth > config.maxNestingDepth) return "[MAX_DEPTH_EXCEEDED]";
|
|
1416
1469
|
if (value === null || value === void 0) return value;
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
if (typeof value === "number" || typeof value === "boolean") return value;
|
|
1470
|
+
const text = require_values.asString(value);
|
|
1471
|
+
if (text !== void 0) return text.length > config.maxAttributeValueLength ? text.slice(0, config.maxAttributeValueLength) + "..." : text;
|
|
1472
|
+
const scalar = require_values.asNumber(value) ?? require_values.asBoolean(value);
|
|
1473
|
+
if (scalar !== void 0) return scalar;
|
|
1422
1474
|
if (Array.isArray(value)) return value.map((item) => sanitizeValue(item, config, depth + 1));
|
|
1423
|
-
|
|
1424
|
-
|
|
1475
|
+
const record = require_values.asRecord(value);
|
|
1476
|
+
if (record) try {
|
|
1477
|
+
JSON.stringify(record);
|
|
1425
1478
|
const sanitized = {};
|
|
1426
|
-
for (const key
|
|
1427
|
-
const nested = value[key];
|
|
1428
|
-
sanitized[key] = typeof nested === "string" && config.sensitivePatterns.some((pattern) => pattern.test(key)) ? "[REDACTED]" : sanitizeValue(nested, config, depth + 1);
|
|
1429
|
-
}
|
|
1479
|
+
for (const [key, nested] of Object.entries(record)) sanitized[key] = isSensitiveString(key, nested, config) ? "[REDACTED]" : sanitizeValue(nested, config, depth + 1);
|
|
1430
1480
|
return sanitized;
|
|
1431
1481
|
} catch {
|
|
1432
1482
|
return "[CIRCULAR]";
|
|
1433
1483
|
}
|
|
1434
|
-
return `[${
|
|
1484
|
+
return `[${require_values.describeValue(value)}]`;
|
|
1435
1485
|
}
|
|
1436
1486
|
/**
|
|
1437
1487
|
* Validate and sanitize an events event
|
|
@@ -1792,7 +1842,7 @@ function hashValue(value) {
|
|
|
1792
1842
|
* @example Recommended: Configure subscribers in init(), use track() function
|
|
1793
1843
|
* ```typescript
|
|
1794
1844
|
* import { init, track } from 'autotel';
|
|
1795
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
1845
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
1796
1846
|
*
|
|
1797
1847
|
* init({
|
|
1798
1848
|
* service: 'my-app',
|
|
@@ -1815,7 +1865,7 @@ function hashValue(value) {
|
|
|
1815
1865
|
* @example Override subscribers for specific Event instance
|
|
1816
1866
|
* ```typescript
|
|
1817
1867
|
* import { Event } from 'autotel/event';
|
|
1818
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
1868
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
1819
1869
|
*
|
|
1820
1870
|
* // Override: use different subscribers for this instance
|
|
1821
1871
|
* const event = new Event('job-application', {
|
|
@@ -1848,7 +1898,7 @@ var Event = class {
|
|
|
1848
1898
|
* @example Recommended: Use track() with init()
|
|
1849
1899
|
* ```typescript
|
|
1850
1900
|
* import { init, track } from 'autotel';
|
|
1851
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
1901
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
1852
1902
|
*
|
|
1853
1903
|
* init({
|
|
1854
1904
|
* service: 'checkout',
|
|
@@ -1868,7 +1918,7 @@ var Event = class {
|
|
|
1868
1918
|
* @example Override subscribers for this instance
|
|
1869
1919
|
* ```typescript
|
|
1870
1920
|
* import { Event } from 'autotel/event';
|
|
1871
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
1921
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
1872
1922
|
*
|
|
1873
1923
|
* // Override: use different subscribers for this instance only
|
|
1874
1924
|
* const event = new Event('checkout', {
|
|
@@ -1946,7 +1996,7 @@ var Event = class {
|
|
|
1946
1996
|
if (traceState) {
|
|
1947
1997
|
let traceStateStr = "";
|
|
1948
1998
|
try {
|
|
1949
|
-
if (
|
|
1999
|
+
if (require_values.isFunction(traceState.serialize)) traceStateStr = traceState.serialize();
|
|
1950
2000
|
} catch {}
|
|
1951
2001
|
if (traceStateStr) autotelContext.trace_state = traceStateStr;
|
|
1952
2002
|
}
|
|
@@ -1995,9 +2045,8 @@ var Event = class {
|
|
|
1995
2045
|
const transform = enrichConfig.transform?.[key];
|
|
1996
2046
|
let transformedValue;
|
|
1997
2047
|
if (transform === "hash") transformedValue = hashValue(value);
|
|
1998
|
-
else if (transform ===
|
|
1999
|
-
else
|
|
2000
|
-
else transformedValue = value;
|
|
2048
|
+
else if (transform === void 0 || transform === "plain") transformedValue = value;
|
|
2049
|
+
else transformedValue = transform(value);
|
|
2001
2050
|
const valueBytes = new TextEncoder().encode(transformedValue).length;
|
|
2002
2051
|
if (byteCount + valueBytes > maxBytes) continue;
|
|
2003
2052
|
const enrichedKey = `${prefix}${key}`;
|
|
@@ -2320,14 +2369,16 @@ var Event = class {
|
|
|
2320
2369
|
stepNumber,
|
|
2321
2370
|
attributes: enrichedAttributes
|
|
2322
2371
|
}, "Funnel progression tracked");
|
|
2372
|
+
const stepAttributes = {
|
|
2373
|
+
...enrichedAttributes,
|
|
2374
|
+
step_name: stepName
|
|
2375
|
+
};
|
|
2376
|
+
if (stepNumber !== void 0) stepAttributes.step_number = stepNumber;
|
|
2377
|
+
const stepAsStatus = stepName;
|
|
2323
2378
|
this.collector?.recordFunnelStep({
|
|
2324
2379
|
funnel: funnelName,
|
|
2325
|
-
status:
|
|
2326
|
-
attributes:
|
|
2327
|
-
...enrichedAttributes,
|
|
2328
|
-
step_name: stepName,
|
|
2329
|
-
...stepNumber === void 0 ? {} : { step_number: stepNumber }
|
|
2330
|
-
},
|
|
2380
|
+
status: stepAsStatus,
|
|
2381
|
+
attributes: stepAttributes,
|
|
2331
2382
|
service: this.serviceName,
|
|
2332
2383
|
timestamp: Date.now()
|
|
2333
2384
|
});
|
|
@@ -2335,10 +2386,9 @@ var Event = class {
|
|
|
2335
2386
|
const autotelContext = this.buildAutotelContext();
|
|
2336
2387
|
const finalAttributes = this.enrichFromBaggage(enrichedAttributes);
|
|
2337
2388
|
this.notifySubscribers(async (subscriber) => {
|
|
2338
|
-
await (subscriber.trackFunnelProgression ? subscriber.trackFunnelProgression(funnelName, stepName, stepNumber, finalAttributes, { autotel: autotelContext }) : subscriber.trackFunnelStep(funnelName,
|
|
2389
|
+
await (subscriber.trackFunnelProgression ? subscriber.trackFunnelProgression(funnelName, stepName, stepNumber, finalAttributes, { autotel: autotelContext }) : subscriber.trackFunnelStep(funnelName, stepAsStatus, {
|
|
2339
2390
|
...finalAttributes,
|
|
2340
|
-
|
|
2341
|
-
...stepNumber === void 0 ? {} : { step_number: stepNumber }
|
|
2391
|
+
...stepAttributes
|
|
2342
2392
|
}, { autotel: autotelContext }));
|
|
2343
2393
|
});
|
|
2344
2394
|
}
|
|
@@ -2362,11 +2412,17 @@ var Event = class {
|
|
|
2362
2412
|
*/
|
|
2363
2413
|
trackBatch(events) {
|
|
2364
2414
|
for (const event of events) {
|
|
2365
|
-
const filteredAttributes = event.attributes ?
|
|
2415
|
+
const filteredAttributes = event.attributes ? definedAttributes(event.attributes) : void 0;
|
|
2366
2416
|
this.trackEvent(event.name, filteredAttributes);
|
|
2367
2417
|
}
|
|
2368
2418
|
}
|
|
2369
2419
|
};
|
|
2420
|
+
/** The attributes with the entries that carry nothing left out. */
|
|
2421
|
+
function definedAttributes(input) {
|
|
2422
|
+
const defined = {};
|
|
2423
|
+
for (const [key, value] of Object.entries(input)) if (value !== void 0 && value !== null) defined[key] = value;
|
|
2424
|
+
return defined;
|
|
2425
|
+
}
|
|
2370
2426
|
/**
|
|
2371
2427
|
* Global events instances (singleton pattern)
|
|
2372
2428
|
*/
|
|
@@ -2412,24 +2468,21 @@ const UNREACHABLE_ENDPOINT_CODES = /* @__PURE__ */ new Set([
|
|
|
2412
2468
|
"ENOTFOUND",
|
|
2413
2469
|
"EAI_AGAIN"
|
|
2414
2470
|
]);
|
|
2415
|
-
function errorCode(
|
|
2416
|
-
|
|
2417
|
-
const code = error.code;
|
|
2418
|
-
if (typeof code === "string") return code;
|
|
2419
|
-
}
|
|
2471
|
+
function errorCode(cause) {
|
|
2472
|
+
return require_values.asString(require_values.readProperty(cause, "code"));
|
|
2420
2473
|
}
|
|
2421
2474
|
/**
|
|
2422
2475
|
* True when the error (or every error it wraps) is an unreachable-endpoint
|
|
2423
2476
|
* failure. Traverses `AggregateError.errors` and the `cause` chain, since the
|
|
2424
2477
|
* SDK often wraps the underlying network error.
|
|
2425
2478
|
*/
|
|
2426
|
-
function isUnreachableEndpointError(
|
|
2427
|
-
if (depth > 5 ||
|
|
2428
|
-
if (
|
|
2429
|
-
const code = errorCode(
|
|
2479
|
+
function isUnreachableEndpointError(cause, depth = 0) {
|
|
2480
|
+
if (depth > 5 || require_values.asRecord(cause) === void 0) return false;
|
|
2481
|
+
if (cause instanceof AggregateError) return cause.errors.length > 0 && cause.errors.every((e) => isUnreachableEndpointError(e, depth + 1));
|
|
2482
|
+
const code = errorCode(cause);
|
|
2430
2483
|
if (code && UNREACHABLE_ENDPOINT_CODES.has(code)) return true;
|
|
2431
|
-
const
|
|
2432
|
-
return
|
|
2484
|
+
const wrapped = require_values.readProperty(cause, "cause");
|
|
2485
|
+
return wrapped !== void 0 && wrapped !== cause ? isUnreachableEndpointError(wrapped, depth + 1) : false;
|
|
2433
2486
|
}
|
|
2434
2487
|
/**
|
|
2435
2488
|
* Flush all pending telemetry
|
|
@@ -2530,7 +2583,7 @@ async function shutdown() {
|
|
|
2530
2583
|
uninstallProcessHandlers();
|
|
2531
2584
|
await _closeEmbeddedDevtools();
|
|
2532
2585
|
const eventsQueue = getEventQueue();
|
|
2533
|
-
if (eventsQueue
|
|
2586
|
+
if (require_values.isFunction(eventsQueue?.cleanup)) eventsQueue.cleanup();
|
|
2534
2587
|
resetEvents();
|
|
2535
2588
|
require_metric.resetMetrics();
|
|
2536
2589
|
resetEventQueue();
|
|
@@ -2810,14 +2863,17 @@ function detectHostname() {
|
|
|
2810
2863
|
function getInstrumentationNames(instrumentations) {
|
|
2811
2864
|
const names = /* @__PURE__ */ new Set();
|
|
2812
2865
|
if (!instrumentations) return names;
|
|
2813
|
-
for (const instrumentation of instrumentations)
|
|
2866
|
+
for (const instrumentation of instrumentations) {
|
|
2867
|
+
const className = require_values.asFunction(require_values.readProperty(instrumentation, "constructor"))?.name;
|
|
2868
|
+
if (className) names.add(className);
|
|
2869
|
+
}
|
|
2814
2870
|
return names;
|
|
2815
2871
|
}
|
|
2816
2872
|
/**
|
|
2817
2873
|
* Map common instrumentation class names to their package names
|
|
2818
2874
|
* Used to disable auto-instrumentations when user provides manual configs
|
|
2819
2875
|
*/
|
|
2820
|
-
const INSTRUMENTATION_CLASS_TO_PACKAGE = {
|
|
2876
|
+
const INSTRUMENTATION_CLASS_TO_PACKAGE = new Map(Object.entries({
|
|
2821
2877
|
HttpInstrumentation: "@opentelemetry/instrumentation-http",
|
|
2822
2878
|
HttpsInstrumentation: "@opentelemetry/instrumentation-http",
|
|
2823
2879
|
ExpressInstrumentation: "@opentelemetry/instrumentation-express",
|
|
@@ -2836,7 +2892,7 @@ const INSTRUMENTATION_CLASS_TO_PACKAGE = {
|
|
|
2836
2892
|
PgInstrumentation: "@opentelemetry/instrumentation-pg",
|
|
2837
2893
|
MySQLInstrumentation: "@opentelemetry/instrumentation-mysql",
|
|
2838
2894
|
MySQL2Instrumentation: "@opentelemetry/instrumentation-mysql2"
|
|
2839
|
-
};
|
|
2895
|
+
}));
|
|
2840
2896
|
/**
|
|
2841
2897
|
* Detect if we're running in ESM mode
|
|
2842
2898
|
*/
|
|
@@ -2889,7 +2945,7 @@ function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @
|
|
|
2889
2945
|
const getNodeAutoInstrumentations = _autoInstrumentationsLoader ? _autoInstrumentationsLoader() : loadNodeAutoInstrumentations();
|
|
2890
2946
|
const exclusionConfig = {};
|
|
2891
2947
|
for (const className of manualInstrumentationNames) {
|
|
2892
|
-
const packageName = INSTRUMENTATION_CLASS_TO_PACKAGE
|
|
2948
|
+
const packageName = INSTRUMENTATION_CLASS_TO_PACKAGE.get(className);
|
|
2893
2949
|
if (packageName) exclusionConfig[packageName] = { enabled: false };
|
|
2894
2950
|
}
|
|
2895
2951
|
if (integrations === true) {
|
|
@@ -2921,17 +2977,6 @@ function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @
|
|
|
2921
2977
|
* Replaces initInstrumentation() and separate events config.
|
|
2922
2978
|
*/
|
|
2923
2979
|
/**
|
|
2924
|
-
* Silent logger (no-op) - used as default when user doesn't provide one.
|
|
2925
|
-
* Internal autotel logs are silent by default to avoid spam.
|
|
2926
|
-
* Users can import { autotelLogger } from 'autotel/logger' to create their own.
|
|
2927
|
-
*/
|
|
2928
|
-
const silentLogger = {
|
|
2929
|
-
info: () => {},
|
|
2930
|
-
warn: () => {},
|
|
2931
|
-
error: () => {},
|
|
2932
|
-
debug: () => {}
|
|
2933
|
-
};
|
|
2934
|
-
/**
|
|
2935
2980
|
* Adapts an Autotel Sampler to the OTel SDK Sampler interface.
|
|
2936
2981
|
*/
|
|
2937
2982
|
function toOtelSampler(sampler) {
|
|
@@ -2944,10 +2989,9 @@ function toOtelSampler(sampler) {
|
|
|
2944
2989
|
};
|
|
2945
2990
|
const shouldTrace = sampler.shouldSample(samplingContext);
|
|
2946
2991
|
const rate = sampler.sampleRate?.(samplingContext);
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
};
|
|
2992
|
+
const result = { decision: shouldTrace ? _opentelemetry_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED : _opentelemetry_sdk_trace_base.SamplingDecision.NOT_RECORD };
|
|
2993
|
+
if (shouldTrace && rate !== void 0 && rate > 1) result.attributes = { [require_sampling.AUTOTEL_SAMPLING_RATE]: rate };
|
|
2994
|
+
return result;
|
|
2951
2995
|
},
|
|
2952
2996
|
toString() {
|
|
2953
2997
|
return `AutotelSamplerAdapter`;
|
|
@@ -2964,16 +3008,10 @@ let validationConfig = null;
|
|
|
2964
3008
|
let eventsConfig = null;
|
|
2965
3009
|
let _stringRedactor = null;
|
|
2966
3010
|
function acceptsStringRedactor(subscriber) {
|
|
2967
|
-
return
|
|
3011
|
+
return require_values.isFunction(require_values.readProperty(subscriber, "setStringRedactor")) ? subscriber : void 0;
|
|
2968
3012
|
}
|
|
2969
3013
|
let _optionalRequire = require_node_require.safeRequire;
|
|
2970
3014
|
let _devtoolsClose = null;
|
|
2971
|
-
const LOG_LEVELS = {
|
|
2972
|
-
debug: 0,
|
|
2973
|
-
info: 1,
|
|
2974
|
-
warn: 2,
|
|
2975
|
-
error: 3
|
|
2976
|
-
};
|
|
2977
3015
|
/**
|
|
2978
3016
|
* Lock the logger to prevent further `init()` calls.
|
|
2979
3017
|
* Use this when framework plugins set up instrumentation and you want
|
|
@@ -2988,28 +3026,6 @@ function lockLogger() {
|
|
|
2988
3026
|
function isLoggerLocked() {
|
|
2989
3027
|
return locked;
|
|
2990
3028
|
}
|
|
2991
|
-
function createSilentLogger() {
|
|
2992
|
-
return {
|
|
2993
|
-
info: () => {},
|
|
2994
|
-
warn: () => {},
|
|
2995
|
-
error: () => {},
|
|
2996
|
-
debug: () => {}
|
|
2997
|
-
};
|
|
2998
|
-
}
|
|
2999
|
-
function wrapLogger(base, silent, minLevel) {
|
|
3000
|
-
if (silent) return createSilentLogger();
|
|
3001
|
-
const threshold = LOG_LEVELS[minLevel];
|
|
3002
|
-
const wrap = (fn, level) => {
|
|
3003
|
-
if (LOG_LEVELS[level] < threshold) return (() => {});
|
|
3004
|
-
return ((...args) => fn(...args));
|
|
3005
|
-
};
|
|
3006
|
-
return {
|
|
3007
|
-
debug: wrap(base.debug, "debug"),
|
|
3008
|
-
info: wrap(base.info, "info"),
|
|
3009
|
-
warn: wrap(base.warn, "warn"),
|
|
3010
|
-
error: wrap(base.error, "error")
|
|
3011
|
-
};
|
|
3012
|
-
}
|
|
3013
3029
|
/**
|
|
3014
3030
|
* Initialize autotel - Write Once, Observe Everywhere
|
|
3015
3031
|
*
|
|
@@ -3023,7 +3039,7 @@ function wrapLogger(base, silent, minLevel) {
|
|
|
3023
3039
|
*
|
|
3024
3040
|
* @example With events (observe in PostHog, Mixpanel, etc.)
|
|
3025
3041
|
* ```typescript
|
|
3026
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
3042
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
3027
3043
|
*
|
|
3028
3044
|
* init({
|
|
3029
3045
|
* service: 'my-app',
|
|
@@ -3177,9 +3193,7 @@ function init(cfg) {
|
|
|
3177
3193
|
spanProcessors = spanProcessors.map((processor) => new require_attribute_redacting_processor.AttributeRedactingProcessor(processor, { redactor }));
|
|
3178
3194
|
}
|
|
3179
3195
|
if (mergedConfig.attributeRedactor) _stringRedactor = createStringRedactor(mergedConfig.attributeRedactor);
|
|
3180
|
-
if (_stringRedactor && mergedConfig.subscribers)
|
|
3181
|
-
for (const subscriber of mergedConfig.subscribers) if (acceptsStringRedactor(subscriber)) subscriber.setStringRedactor(_stringRedactor);
|
|
3182
|
-
}
|
|
3196
|
+
if (_stringRedactor && mergedConfig.subscribers) for (const subscriber of mergedConfig.subscribers) acceptsStringRedactor(subscriber)?.setStringRedactor(_stringRedactor);
|
|
3183
3197
|
if (mergedConfig.spanNameNormalizer && spanProcessors.length > 0) spanProcessors = spanProcessors.map((processor) => new require_span_name_normalizer.SpanNameNormalizingProcessor(processor, { normalizer: mergedConfig.spanNameNormalizer }));
|
|
3184
3198
|
if (mergedConfig.policies) {
|
|
3185
3199
|
if (typeof mergedConfig.policies === "string") require_policy.watchPolicyFile(mergedConfig.policies);
|
|
@@ -3188,6 +3202,7 @@ function init(cfg) {
|
|
|
3188
3202
|
mergedConfig.spanFilter = userSpanFilter ? (span) => userSpanFilter(span) && require_policy.policySpanFilter(span) : require_policy.policySpanFilter;
|
|
3189
3203
|
}
|
|
3190
3204
|
if (mergedConfig.spanFilter && spanProcessors.length > 0) spanProcessors = spanProcessors.map((processor) => new require_filtering_span_processor.FilteringSpanProcessor(processor, { filter: mergedConfig.spanFilter }));
|
|
3205
|
+
if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors.unshift(...mergedConfig.spanEnrichers);
|
|
3191
3206
|
const metricReaders = [];
|
|
3192
3207
|
if (configuredMetricReaders && configuredMetricReaders.length > 0) metricReaders.push(...configuredMetricReaders);
|
|
3193
3208
|
else if (metricsEnabled) for (const destination of otlpDestinations) {
|
|
@@ -3198,11 +3213,10 @@ function init(cfg) {
|
|
|
3198
3213
|
});
|
|
3199
3214
|
const exportIntervalMillis = readMillisEnv("OTEL_METRIC_EXPORT_INTERVAL");
|
|
3200
3215
|
const exportTimeoutMillis = readMillisEnv("OTEL_METRIC_EXPORT_TIMEOUT");
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
}));
|
|
3216
|
+
const readerOptions = { exporter: metricExporter };
|
|
3217
|
+
if (exportIntervalMillis !== void 0) readerOptions.exportIntervalMillis = exportIntervalMillis;
|
|
3218
|
+
if (exportTimeoutMillis !== void 0) readerOptions.exportTimeoutMillis = exportTimeoutMillis;
|
|
3219
|
+
metricReaders.push(new _opentelemetry_sdk_metrics.PeriodicExportingMetricReader(readerOptions));
|
|
3206
3220
|
}
|
|
3207
3221
|
let logRecordProcessors;
|
|
3208
3222
|
if (configuredLogRecordProcessors && configuredLogRecordProcessors.length > 0) logRecordProcessors = [...configuredLogRecordProcessors];
|
|
@@ -3260,11 +3274,10 @@ function init(cfg) {
|
|
|
3260
3274
|
const traceloop = _optionalRequire("@traceloop/node-server-sdk");
|
|
3261
3275
|
if (traceloop) {
|
|
3262
3276
|
const initOptions = { ...mergedConfig.openllmetry.options };
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
} catch {}
|
|
3277
|
+
const getTracerProvider = require_values.asFunction(require_values.readProperty(sdk, "getTracerProvider"));
|
|
3278
|
+
if (getTracerProvider) initOptions.tracerProvider = getTracerProvider.call(sdk);
|
|
3266
3279
|
if (configuredSpanExporters?.[0]) initOptions.exporter = configuredSpanExporters[0];
|
|
3267
|
-
if (
|
|
3280
|
+
if (require_values.isFunction(traceloop.initialize)) {
|
|
3268
3281
|
traceloop.initialize(initOptions);
|
|
3269
3282
|
logger.info({}, "[autotel] OpenLLMetry initialized successfully");
|
|
3270
3283
|
} else logger.warn({}, "[autotel] OpenLLMetry initialize function not found. Check @traceloop/node-server-sdk version.");
|
|
@@ -3453,6 +3466,12 @@ Object.defineProperty(exports, 'getSdk', {
|
|
|
3453
3466
|
return getSdk;
|
|
3454
3467
|
}
|
|
3455
3468
|
});
|
|
3469
|
+
Object.defineProperty(exports, 'hasExplicitSpanStatus', {
|
|
3470
|
+
enumerable: true,
|
|
3471
|
+
get: function () {
|
|
3472
|
+
return hasExplicitSpanStatus;
|
|
3473
|
+
}
|
|
3474
|
+
});
|
|
3456
3475
|
Object.defineProperty(exports, 'init', {
|
|
3457
3476
|
enumerable: true,
|
|
3458
3477
|
get: function () {
|