autotel 6.5.0 → 7.0.1
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-C0uAZq2X.cjs → functional-C2ONG9PK.cjs} +27 -15
- package/dist/{functional-e6jw5zQj.d.cts → functional-CJn2zY4o.d.cts} +96 -39
- package/dist/{functional-AT22vCw6.d.ts → functional-DXy1cHFF.d.ts} +96 -39
- package/dist/{functional-DX7Zvag0.js → functional-nS5U4KCQ.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-pPI3JRRf.d.ts → init-BgnYi2sm.d.ts} +6 -6
- package/dist/{init-CTtHITlX.cjs → init-C5aHRqi2.cjs} +111 -85
- package/dist/{init-WHYwyItd.js → init-DDyaLzeg.js} +106 -86
- package/dist/{init-ncTMKZ-s.d.cts → init-DrlL1eis.d.cts} +6 -6
- 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
package/dist/diagnostics.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_values = require('./values-DApyq53y.cjs');
|
|
3
|
+
const require_node_require = require('./node-require-EifOMikz.cjs');
|
|
3
4
|
let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
4
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
5
6
|
let _opentelemetry_api_logs = require("@opentelemetry/api-logs");
|
|
@@ -37,12 +38,13 @@ function diagnosticsChannelAvailable() {
|
|
|
37
38
|
function subscribeChannel(name, handler) {
|
|
38
39
|
const dc = loadDiagnosticsChannel();
|
|
39
40
|
if (!dc?.subscribe) return () => {};
|
|
40
|
-
|
|
41
|
+
const listener = handler;
|
|
42
|
+
dc.subscribe(name, listener);
|
|
41
43
|
let active = true;
|
|
42
44
|
return () => {
|
|
43
45
|
if (!active) return;
|
|
44
46
|
active = false;
|
|
45
|
-
dc.unsubscribe?.(name,
|
|
47
|
+
dc.unsubscribe?.(name, listener);
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
@@ -53,12 +55,13 @@ function subscribeChannel(name, handler) {
|
|
|
53
55
|
function subscribeTracingChannel(name, handlers) {
|
|
54
56
|
const channel = loadDiagnosticsChannel()?.tracingChannel?.(name);
|
|
55
57
|
if (!channel) return () => {};
|
|
56
|
-
|
|
58
|
+
const subset = handlers;
|
|
59
|
+
channel.subscribe(subset);
|
|
57
60
|
let active = true;
|
|
58
61
|
return () => {
|
|
59
62
|
if (!active) return;
|
|
60
63
|
active = false;
|
|
61
|
-
channel.unsubscribe(
|
|
64
|
+
channel.unsubscribe(subset);
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
67
|
|
|
@@ -93,27 +96,26 @@ const ALL_LEVELS = [
|
|
|
93
96
|
"warn",
|
|
94
97
|
"error"
|
|
95
98
|
];
|
|
96
|
-
const SEVERITY =
|
|
97
|
-
debug
|
|
98
|
-
log
|
|
99
|
-
info
|
|
100
|
-
warn
|
|
101
|
-
error
|
|
102
|
-
|
|
99
|
+
const SEVERITY = /* @__PURE__ */ new Map([
|
|
100
|
+
["debug", _opentelemetry_api_logs.SeverityNumber.DEBUG],
|
|
101
|
+
["log", _opentelemetry_api_logs.SeverityNumber.INFO],
|
|
102
|
+
["info", _opentelemetry_api_logs.SeverityNumber.INFO],
|
|
103
|
+
["warn", _opentelemetry_api_logs.SeverityNumber.WARN],
|
|
104
|
+
["error", _opentelemetry_api_logs.SeverityNumber.ERROR]
|
|
105
|
+
]);
|
|
103
106
|
/**
|
|
104
107
|
* Node publishes `console.*` channel messages as the raw argument array
|
|
105
108
|
* (e.g. `console.warn('a', 1)` → `['a', 1]`); some publishers use the
|
|
106
109
|
* `{ args: [...] }` object shape instead. Accept both.
|
|
107
110
|
*/
|
|
108
111
|
function messageArgs(message) {
|
|
109
|
-
|
|
110
|
-
return message?.args ?? [];
|
|
112
|
+
return Array.isArray(message) ? message : message?.args ?? [];
|
|
111
113
|
}
|
|
112
114
|
const nodeUtil = require_node_require.safeRequire("node:util");
|
|
113
115
|
/** Format console arguments the way `console` itself would (printf + inspect). */
|
|
114
116
|
function formatArgs(args) {
|
|
115
117
|
if (nodeUtil?.format) return nodeUtil.format(...args);
|
|
116
|
-
return args.map((a) =>
|
|
118
|
+
return args.map((a) => require_values.asString(a) ?? safeStringify(a)).join(" ");
|
|
117
119
|
}
|
|
118
120
|
function safeStringify(value) {
|
|
119
121
|
try {
|
|
@@ -144,7 +146,7 @@ function captureConsole(options = {}) {
|
|
|
144
146
|
...options.attributes
|
|
145
147
|
};
|
|
146
148
|
if (toLog) logger.emit({
|
|
147
|
-
severityNumber: SEVERITY
|
|
149
|
+
severityNumber: SEVERITY.get(level),
|
|
148
150
|
severityText: level.toUpperCase(),
|
|
149
151
|
body,
|
|
150
152
|
attributes
|
package/dist/diagnostics.d.cts
CHANGED
|
@@ -17,27 +17,31 @@ import { Attributes, Tracer } from "@opentelemetry/api";
|
|
|
17
17
|
*/
|
|
18
18
|
/** Whether Node's `diagnostics_channel` is available in this runtime. */
|
|
19
19
|
declare function diagnosticsChannelAvailable(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Handler for a plain named channel. `TMessage` is whatever the publisher on
|
|
22
|
+
* that channel sends - a subscriber that knows the channel says so; one that
|
|
23
|
+
* does not gets `unknown` and decodes it itself.
|
|
24
|
+
*/
|
|
25
|
+
type ChannelMessageHandler<TMessage = unknown> = (message: TMessage, name: string | symbol) => void;
|
|
22
26
|
/**
|
|
23
27
|
* Subscribe to a named diagnostics channel. Returns an idempotent unsubscribe
|
|
24
28
|
* function; a no-op (that still returns a disposer) on unsupported runtimes.
|
|
25
29
|
*/
|
|
26
|
-
declare function subscribeChannel(name: string, handler: ChannelMessageHandler): () => void;
|
|
30
|
+
declare function subscribeChannel<TMessage = unknown>(name: string, handler: ChannelMessageHandler<TMessage>): () => void;
|
|
27
31
|
/** Subscriber set for a {@link https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel TracingChannel}. */
|
|
28
|
-
interface TracingChannelHandlers {
|
|
29
|
-
start?(message:
|
|
30
|
-
end?(message:
|
|
31
|
-
asyncStart?(message:
|
|
32
|
-
asyncEnd?(message:
|
|
33
|
-
error?(message:
|
|
32
|
+
interface TracingChannelHandlers<TMessage = unknown> {
|
|
33
|
+
start?(message: TMessage): void;
|
|
34
|
+
end?(message: TMessage): void;
|
|
35
|
+
asyncStart?(message: TMessage): void;
|
|
36
|
+
asyncEnd?(message: TMessage): void;
|
|
37
|
+
error?(message: TMessage): void;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Subscribe to a `tracingChannel` (the `tracing:${name}:{start,end,…}` set).
|
|
37
41
|
* Returns an idempotent unsubscribe; a no-op on runtimes without
|
|
38
42
|
* `tracingChannel` support.
|
|
39
43
|
*/
|
|
40
|
-
declare function subscribeTracingChannel(name: string, handlers: TracingChannelHandlers): () => void;
|
|
44
|
+
declare function subscribeTracingChannel<TMessage = unknown>(name: string, handlers: TracingChannelHandlers<TMessage>): () => void;
|
|
41
45
|
//#endregion
|
|
42
46
|
//#region src/diagnostics/console.d.ts
|
|
43
47
|
/** Console methods that publish a diagnostics channel. */
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -17,27 +17,31 @@ import { Attributes, Tracer } from "@opentelemetry/api";
|
|
|
17
17
|
*/
|
|
18
18
|
/** Whether Node's `diagnostics_channel` is available in this runtime. */
|
|
19
19
|
declare function diagnosticsChannelAvailable(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Handler for a plain named channel. `TMessage` is whatever the publisher on
|
|
22
|
+
* that channel sends - a subscriber that knows the channel says so; one that
|
|
23
|
+
* does not gets `unknown` and decodes it itself.
|
|
24
|
+
*/
|
|
25
|
+
type ChannelMessageHandler<TMessage = unknown> = (message: TMessage, name: string | symbol) => void;
|
|
22
26
|
/**
|
|
23
27
|
* Subscribe to a named diagnostics channel. Returns an idempotent unsubscribe
|
|
24
28
|
* function; a no-op (that still returns a disposer) on unsupported runtimes.
|
|
25
29
|
*/
|
|
26
|
-
declare function subscribeChannel(name: string, handler: ChannelMessageHandler): () => void;
|
|
30
|
+
declare function subscribeChannel<TMessage = unknown>(name: string, handler: ChannelMessageHandler<TMessage>): () => void;
|
|
27
31
|
/** Subscriber set for a {@link https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel TracingChannel}. */
|
|
28
|
-
interface TracingChannelHandlers {
|
|
29
|
-
start?(message:
|
|
30
|
-
end?(message:
|
|
31
|
-
asyncStart?(message:
|
|
32
|
-
asyncEnd?(message:
|
|
33
|
-
error?(message:
|
|
32
|
+
interface TracingChannelHandlers<TMessage = unknown> {
|
|
33
|
+
start?(message: TMessage): void;
|
|
34
|
+
end?(message: TMessage): void;
|
|
35
|
+
asyncStart?(message: TMessage): void;
|
|
36
|
+
asyncEnd?(message: TMessage): void;
|
|
37
|
+
error?(message: TMessage): void;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Subscribe to a `tracingChannel` (the `tracing:${name}:{start,end,…}` set).
|
|
37
41
|
* Returns an idempotent unsubscribe; a no-op on runtimes without
|
|
38
42
|
* `tracingChannel` support.
|
|
39
43
|
*/
|
|
40
|
-
declare function subscribeTracingChannel(name: string, handlers: TracingChannelHandlers): () => void;
|
|
44
|
+
declare function subscribeTracingChannel<TMessage = unknown>(name: string, handlers: TracingChannelHandlers<TMessage>): () => void;
|
|
41
45
|
//#endregion
|
|
42
46
|
//#region src/diagnostics/console.d.ts
|
|
43
47
|
/** Console methods that publish a diagnostics channel. */
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as asString } from "./values-BenyvWKz.js";
|
|
2
|
+
import { n as safeRequire } from "./node-require-DSPjaw_l.js";
|
|
2
3
|
import { ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_NETWORK_PROTOCOL_VERSION, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, ATTR_URL_PATH, ATTR_URL_SCHEME, ATTR_USER_AGENT_ORIGINAL } from "@opentelemetry/semantic-conventions";
|
|
3
4
|
import { SpanKind, SpanStatusCode, context, defaultTextMapGetter, defaultTextMapSetter, propagation, trace } from "@opentelemetry/api";
|
|
4
5
|
import { SeverityNumber, logs } from "@opentelemetry/api-logs";
|
|
@@ -36,12 +37,13 @@ function diagnosticsChannelAvailable() {
|
|
|
36
37
|
function subscribeChannel(name, handler) {
|
|
37
38
|
const dc = loadDiagnosticsChannel();
|
|
38
39
|
if (!dc?.subscribe) return () => {};
|
|
39
|
-
|
|
40
|
+
const listener = handler;
|
|
41
|
+
dc.subscribe(name, listener);
|
|
40
42
|
let active = true;
|
|
41
43
|
return () => {
|
|
42
44
|
if (!active) return;
|
|
43
45
|
active = false;
|
|
44
|
-
dc.unsubscribe?.(name,
|
|
46
|
+
dc.unsubscribe?.(name, listener);
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
@@ -52,12 +54,13 @@ function subscribeChannel(name, handler) {
|
|
|
52
54
|
function subscribeTracingChannel(name, handlers) {
|
|
53
55
|
const channel = loadDiagnosticsChannel()?.tracingChannel?.(name);
|
|
54
56
|
if (!channel) return () => {};
|
|
55
|
-
|
|
57
|
+
const subset = handlers;
|
|
58
|
+
channel.subscribe(subset);
|
|
56
59
|
let active = true;
|
|
57
60
|
return () => {
|
|
58
61
|
if (!active) return;
|
|
59
62
|
active = false;
|
|
60
|
-
channel.unsubscribe(
|
|
63
|
+
channel.unsubscribe(subset);
|
|
61
64
|
};
|
|
62
65
|
}
|
|
63
66
|
|
|
@@ -92,27 +95,26 @@ const ALL_LEVELS = [
|
|
|
92
95
|
"warn",
|
|
93
96
|
"error"
|
|
94
97
|
];
|
|
95
|
-
const SEVERITY =
|
|
96
|
-
debug
|
|
97
|
-
log
|
|
98
|
-
info
|
|
99
|
-
warn
|
|
100
|
-
error
|
|
101
|
-
|
|
98
|
+
const SEVERITY = /* @__PURE__ */ new Map([
|
|
99
|
+
["debug", SeverityNumber.DEBUG],
|
|
100
|
+
["log", SeverityNumber.INFO],
|
|
101
|
+
["info", SeverityNumber.INFO],
|
|
102
|
+
["warn", SeverityNumber.WARN],
|
|
103
|
+
["error", SeverityNumber.ERROR]
|
|
104
|
+
]);
|
|
102
105
|
/**
|
|
103
106
|
* Node publishes `console.*` channel messages as the raw argument array
|
|
104
107
|
* (e.g. `console.warn('a', 1)` → `['a', 1]`); some publishers use the
|
|
105
108
|
* `{ args: [...] }` object shape instead. Accept both.
|
|
106
109
|
*/
|
|
107
110
|
function messageArgs(message) {
|
|
108
|
-
|
|
109
|
-
return message?.args ?? [];
|
|
111
|
+
return Array.isArray(message) ? message : message?.args ?? [];
|
|
110
112
|
}
|
|
111
113
|
const nodeUtil = safeRequire("node:util");
|
|
112
114
|
/** Format console arguments the way `console` itself would (printf + inspect). */
|
|
113
115
|
function formatArgs(args) {
|
|
114
116
|
if (nodeUtil?.format) return nodeUtil.format(...args);
|
|
115
|
-
return args.map((a) =>
|
|
117
|
+
return args.map((a) => asString(a) ?? safeStringify(a)).join(" ");
|
|
116
118
|
}
|
|
117
119
|
function safeStringify(value) {
|
|
118
120
|
try {
|
|
@@ -143,7 +145,7 @@ function captureConsole(options = {}) {
|
|
|
143
145
|
...options.attributes
|
|
144
146
|
};
|
|
145
147
|
if (toLog) logger.emit({
|
|
146
|
-
severityNumber: SEVERITY
|
|
148
|
+
severityNumber: SEVERITY.get(level),
|
|
147
149
|
severityText: level.toUpperCase(),
|
|
148
150
|
body,
|
|
149
151
|
attributes
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @example Use pre-built subscribers
|
|
24
24
|
* ```typescript
|
|
25
25
|
* import { Event } from 'autotel/event';
|
|
26
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
26
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
27
27
|
* import { MixpanelSubscriber } from 'autotel-subscribers/mixpanel';
|
|
28
28
|
*
|
|
29
29
|
* const event =new Event('checkout', {
|
|
@@ -35,13 +35,23 @@
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* A JSON-serializable value: what an event attribute can hold.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* Attributes are serialized by every subscriber - to a webhook body, a Loki
|
|
41
|
+
* line, a Mixpanel property - so a value that cannot survive JSON has no
|
|
42
|
+
* meaning here. Naming that is what lets a subscriber read an attribute
|
|
43
|
+
* without asserting its shape first.
|
|
43
44
|
*/
|
|
44
|
-
type
|
|
45
|
+
type EventAttributeValue = string | number | boolean | null | undefined | Date | Array<EventAttributeValue> | {
|
|
46
|
+
[key: string]: EventAttributeValue;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Event attributes (any JSON-serializable values)
|
|
50
|
+
*
|
|
51
|
+
* Flat primitives for most events; nested objects and arrays for subscribers
|
|
52
|
+
* that send JSON payloads (e.g., WebhookSubscriber).
|
|
53
|
+
*/
|
|
54
|
+
type EventAttributes = Record<string, EventAttributeValue>;
|
|
45
55
|
/**
|
|
46
56
|
* Permissive input type for event attributes
|
|
47
57
|
*
|
|
@@ -73,7 +83,7 @@ type OutcomeStatus = 'success' | 'failure' | 'partial';
|
|
|
73
83
|
* This structured object contains trace context and correlation IDs.
|
|
74
84
|
* Subscribers decide how to map/flatten these for their platform.
|
|
75
85
|
*/
|
|
76
|
-
|
|
86
|
+
type AutotelEventContext = {
|
|
77
87
|
/** Trace ID (32 hex chars) - present when inside a trace */
|
|
78
88
|
trace_id?: string;
|
|
79
89
|
/** Span ID (16 hex chars) - present when inside a span */
|
|
@@ -92,7 +102,7 @@ interface AutotelEventContext {
|
|
|
92
102
|
linked_trace_id_hash?: string;
|
|
93
103
|
/** Full array of linked trace IDs (only if includeLinkedTraceIds: true) */
|
|
94
104
|
linked_trace_ids?: string[];
|
|
95
|
-
}
|
|
105
|
+
};
|
|
96
106
|
/**
|
|
97
107
|
* Optional machine-readable schema metadata attached to an event payload.
|
|
98
108
|
* Intended for contract-aware subscribers (e.g. architecture snapshot capture).
|
|
@@ -219,4 +229,4 @@ interface EventSubscriber {
|
|
|
219
229
|
readonly version?: string;
|
|
220
230
|
}
|
|
221
231
|
//#endregion
|
|
222
|
-
export {
|
|
232
|
+
export { EventSchemaMetadata as a, FunnelStatus as c, EventAttributesInput as i, OutcomeStatus as l, EventAttributeValue as n, EventSubscriber as o, EventAttributes as r, EventTrackingOptions as s, AutotelEventContext as t };
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @example Use pre-built subscribers
|
|
24
24
|
* ```typescript
|
|
25
25
|
* import { Event } from 'autotel/event';
|
|
26
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
26
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
27
27
|
* import { MixpanelSubscriber } from 'autotel-subscribers/mixpanel';
|
|
28
28
|
*
|
|
29
29
|
* const event =new Event('checkout', {
|
|
@@ -35,13 +35,23 @@
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* A JSON-serializable value: what an event attribute can hold.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* Attributes are serialized by every subscriber - to a webhook body, a Loki
|
|
41
|
+
* line, a Mixpanel property - so a value that cannot survive JSON has no
|
|
42
|
+
* meaning here. Naming that is what lets a subscriber read an attribute
|
|
43
|
+
* without asserting its shape first.
|
|
43
44
|
*/
|
|
44
|
-
type
|
|
45
|
+
type EventAttributeValue = string | number | boolean | null | undefined | Date | Array<EventAttributeValue> | {
|
|
46
|
+
[key: string]: EventAttributeValue;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Event attributes (any JSON-serializable values)
|
|
50
|
+
*
|
|
51
|
+
* Flat primitives for most events; nested objects and arrays for subscribers
|
|
52
|
+
* that send JSON payloads (e.g., WebhookSubscriber).
|
|
53
|
+
*/
|
|
54
|
+
type EventAttributes = Record<string, EventAttributeValue>;
|
|
45
55
|
/**
|
|
46
56
|
* Permissive input type for event attributes
|
|
47
57
|
*
|
|
@@ -73,7 +83,7 @@ type OutcomeStatus = 'success' | 'failure' | 'partial';
|
|
|
73
83
|
* This structured object contains trace context and correlation IDs.
|
|
74
84
|
* Subscribers decide how to map/flatten these for their platform.
|
|
75
85
|
*/
|
|
76
|
-
|
|
86
|
+
type AutotelEventContext = {
|
|
77
87
|
/** Trace ID (32 hex chars) - present when inside a trace */
|
|
78
88
|
trace_id?: string;
|
|
79
89
|
/** Span ID (16 hex chars) - present when inside a span */
|
|
@@ -92,7 +102,7 @@ interface AutotelEventContext {
|
|
|
92
102
|
linked_trace_id_hash?: string;
|
|
93
103
|
/** Full array of linked trace IDs (only if includeLinkedTraceIds: true) */
|
|
94
104
|
linked_trace_ids?: string[];
|
|
95
|
-
}
|
|
105
|
+
};
|
|
96
106
|
/**
|
|
97
107
|
* Optional machine-readable schema metadata attached to an event payload.
|
|
98
108
|
* Intended for contract-aware subscribers (e.g. architecture snapshot capture).
|
|
@@ -219,4 +229,4 @@ interface EventSubscriber {
|
|
|
219
229
|
readonly version?: string;
|
|
220
230
|
}
|
|
221
231
|
//#endregion
|
|
222
|
-
export {
|
|
232
|
+
export { EventSchemaMetadata as a, FunnelStatus as c, EventAttributesInput as i, OutcomeStatus as l, EventAttributeValue as n, EventSubscriber as o, EventAttributes as r, EventTrackingOptions as s, AutotelEventContext as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AutotelEventContext, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
|
|
1
|
+
import { a as EventSchemaMetadata, c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.cjs";
|
|
2
|
+
export { AutotelEventContext, EventAttributeValue, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AutotelEventContext, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
|
|
1
|
+
import { a as EventSchemaMetadata, c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.js";
|
|
2
|
+
export { AutotelEventContext, EventAttributeValue, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as FunnelStatus, l as OutcomeStatus, r as EventAttributes } from "./event-subscriber-DMACQA-1.cjs";
|
|
2
2
|
//#region src/event-testing.d.ts
|
|
3
3
|
interface EventData {
|
|
4
4
|
event: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as FunnelStatus, l as OutcomeStatus, r as EventAttributes } from "./event-subscriber-DMACQA-1.js";
|
|
2
2
|
//#region src/event-testing.d.ts
|
|
3
3
|
interface EventData {
|
|
4
4
|
event: string;
|
package/dist/event-testing.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-
|
|
1
|
+
import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-CBtnJXE5.cjs";
|
|
2
2
|
export { EventCollector, EventData, EventsFunnelStep, EventsOutcome, EventsValue, assertEventTracked, assertOutcomeTracked, createEventCollector };
|
package/dist/event-testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-
|
|
1
|
+
import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-CkPgV3Ii.js";
|
|
2
2
|
export { EventCollector, EventData, EventsFunnelStep, EventsOutcome, EventsValue, assertEventTracked, assertOutcomeTracked, createEventCollector };
|
package/dist/event.cjs
CHANGED
package/dist/event.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as Logger } from "./logger-
|
|
2
|
-
import {
|
|
3
|
-
import { t as EventCollector } from "./event-testing-
|
|
1
|
+
import { s as Logger } from "./logger-S1Fgl0g3.cjs";
|
|
2
|
+
import { c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, o as EventSubscriber, r as EventAttributes } from "./event-subscriber-DMACQA-1.cjs";
|
|
3
|
+
import { t as EventCollector } from "./event-testing-CBtnJXE5.cjs";
|
|
4
4
|
//#region src/event.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Events class for tracking user behavior and product events
|
|
@@ -58,7 +58,7 @@ declare class Event {
|
|
|
58
58
|
* @example Recommended: Use track() with init()
|
|
59
59
|
* ```typescript
|
|
60
60
|
* import { init, track } from 'autotel';
|
|
61
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
61
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
62
62
|
*
|
|
63
63
|
* init({
|
|
64
64
|
* service: 'checkout',
|
|
@@ -78,7 +78,7 @@ declare class Event {
|
|
|
78
78
|
* @example Override subscribers for this instance
|
|
79
79
|
* ```typescript
|
|
80
80
|
* import { Event } from 'autotel/event';
|
|
81
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
81
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
82
82
|
*
|
|
83
83
|
* // Override: use different subscribers for this instance only
|
|
84
84
|
* const event = new Event('checkout', {
|
package/dist/event.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as Logger } from "./logger-
|
|
2
|
-
import {
|
|
3
|
-
import { t as EventCollector } from "./event-testing-
|
|
1
|
+
import { s as Logger } from "./logger-S1Fgl0g3.js";
|
|
2
|
+
import { c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, o as EventSubscriber, r as EventAttributes } from "./event-subscriber-DMACQA-1.js";
|
|
3
|
+
import { t as EventCollector } from "./event-testing-CkPgV3Ii.js";
|
|
4
4
|
//#region src/event.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Events class for tracking user behavior and product events
|
|
@@ -58,7 +58,7 @@ declare class Event {
|
|
|
58
58
|
* @example Recommended: Use track() with init()
|
|
59
59
|
* ```typescript
|
|
60
60
|
* import { init, track } from 'autotel';
|
|
61
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
61
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
62
62
|
*
|
|
63
63
|
* init({
|
|
64
64
|
* service: 'checkout',
|
|
@@ -78,7 +78,7 @@ declare class Event {
|
|
|
78
78
|
* @example Override subscribers for this instance
|
|
79
79
|
* ```typescript
|
|
80
80
|
* import { Event } from 'autotel/event';
|
|
81
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
81
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
82
82
|
*
|
|
83
83
|
* // Override: use different subscribers for this instance only
|
|
84
84
|
* const event = new Event('checkout', {
|
package/dist/event.js
CHANGED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_values = require('./values-DApyq53y.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/exception-fingerprint.ts
|
|
5
|
+
/** Attribute the fingerprint is written to. */
|
|
6
|
+
const EXCEPTION_FINGERPRINT_ATTRIBUTE = "exception.fingerprint";
|
|
7
|
+
/**
|
|
8
|
+
* Frames deep enough to separate two different bugs, shallow enough that the
|
|
9
|
+
* same bug reached through different callers still groups.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_FRAMES = 5;
|
|
12
|
+
const NODE_FRAME = /^at\s+(.+?)\s+\((.+?):(\d+):\d+\)$/;
|
|
13
|
+
const ANON_FRAME = /^at\s+(.+?):(\d+):\d+$/;
|
|
14
|
+
const BROWSER_FRAME = /^(.+?)@(.+?):(\d+):\d+$/;
|
|
15
|
+
/**
|
|
16
|
+
* Collapse a path to the part that identifies the code rather than the machine
|
|
17
|
+
* it ran on: a dependency becomes its package name, and an absolute path
|
|
18
|
+
* becomes the project-relative one. Without this, the same error fingerprints
|
|
19
|
+
* differently in CI, in Docker, and on a laptop.
|
|
20
|
+
*/
|
|
21
|
+
function normalizeFilePath(filePath) {
|
|
22
|
+
const nodeModulesMatch = filePath.match(/node_modules\/(@[^/]+\/[^/]+|[^/]+)/);
|
|
23
|
+
if (nodeModulesMatch) return `[npm]/${nodeModulesMatch[1]}`;
|
|
24
|
+
return filePath.replace(/^.*?\/src\//, "src/").replace(/^.*?\/dist\//, "dist/").replace(/^.*?\/lib\//, "lib/").replace(/^file:\/\//, "");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Strip the parts of a message that change on every occurrence, so
|
|
28
|
+
* `timeout after 341ms` and `timeout after 78ms` are one issue rather than two.
|
|
29
|
+
*/
|
|
30
|
+
function normalizeMessage(message) {
|
|
31
|
+
return message.replaceAll(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, "[UUID]").replaceAll(/\b[0-9a-f]{16,}\b/gi, "[ID]").replaceAll(/\d+/g, "[N]").replaceAll(/"[^"]*"/g, "\"[STR]\"").replaceAll(/'[^']*'/g, "'[STR]'").slice(0, 200);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `function@normalized-path` for the top N frames. Line and column are
|
|
35
|
+
* deliberately dropped: an edit one line above the throw is the same bug.
|
|
36
|
+
*/
|
|
37
|
+
function normalizeStackFrames(stack, count) {
|
|
38
|
+
const frames = [];
|
|
39
|
+
for (const line of stack.split("\n")) {
|
|
40
|
+
if (frames.length >= count) break;
|
|
41
|
+
const trimmed = line.trim();
|
|
42
|
+
const node = NODE_FRAME.exec(trimmed);
|
|
43
|
+
if (node) {
|
|
44
|
+
frames.push(`${node[1] ?? "anonymous"}@${normalizeFilePath(node[2] ?? "")}`);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const anon = ANON_FRAME.exec(trimmed);
|
|
48
|
+
if (anon) {
|
|
49
|
+
frames.push(`anonymous@${normalizeFilePath(anon[1] ?? "")}`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const browser = BROWSER_FRAME.exec(trimmed);
|
|
53
|
+
if (browser) frames.push(`${browser[1] ?? "anonymous"}@${normalizeFilePath(browser[2] ?? "")}`);
|
|
54
|
+
}
|
|
55
|
+
return frames;
|
|
56
|
+
}
|
|
57
|
+
/** 32-bit djb2-style hash, rendered as 8 hex characters. */
|
|
58
|
+
function hashFingerprintParts(parts) {
|
|
59
|
+
const value = parts.join("|");
|
|
60
|
+
let hash = 0;
|
|
61
|
+
for (let index = 0; index < value.length; index++) {
|
|
62
|
+
hash = (hash << 5) - hash + value.charCodeAt(index);
|
|
63
|
+
hash = hash & hash;
|
|
64
|
+
}
|
|
65
|
+
return Math.abs(hash).toString(16).padStart(8, "0");
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Group key for an exception. Returns `undefined` when there is nothing to
|
|
69
|
+
* group on, so callers never write an attribute that means "no information".
|
|
70
|
+
*/
|
|
71
|
+
function fingerprintException(input, frames = DEFAULT_FRAMES) {
|
|
72
|
+
const stackFrames = input.stack ? normalizeStackFrames(input.stack, frames) : [];
|
|
73
|
+
if (stackFrames.length === 0 && !input.message && !input.type) return;
|
|
74
|
+
const parts = [input.type || "Error"];
|
|
75
|
+
if (stackFrames.length > 0) parts.push(...stackFrames);
|
|
76
|
+
else if (input.message) parts.push(normalizeMessage(input.message));
|
|
77
|
+
return hashFingerprintParts(parts);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read the error off a finished span, wherever it was recorded: the OTel
|
|
81
|
+
* `exception` event, the `exception.*` attributes autotel-web sets, or the
|
|
82
|
+
* `error.*` attributes structured errors write instead of an event.
|
|
83
|
+
*/
|
|
84
|
+
function readException(span) {
|
|
85
|
+
const { attributes } = span;
|
|
86
|
+
const event = span.events?.find((e) => e.name === "exception");
|
|
87
|
+
const eventAttributes = event?.attributes ?? {};
|
|
88
|
+
const type = require_values.nonEmptyString(attributes["exception.type"]) ?? require_values.nonEmptyString(attributes["error.type"]) ?? require_values.nonEmptyString(eventAttributes["exception.type"]);
|
|
89
|
+
const stack = require_values.nonEmptyString(attributes["exception.stacktrace"]) ?? require_values.nonEmptyString(attributes["exception.stack"]) ?? require_values.nonEmptyString(attributes["error.stack"]) ?? require_values.nonEmptyString(eventAttributes["exception.stacktrace"]) ?? require_values.nonEmptyString(eventAttributes["exception.stack"]);
|
|
90
|
+
if (!type && !stack && !event) return void 0;
|
|
91
|
+
return {
|
|
92
|
+
type,
|
|
93
|
+
message: require_values.nonEmptyString(attributes["exception.message"]) ?? require_values.nonEmptyString(attributes["error.message"]) ?? require_values.nonEmptyString(eventAttributes["exception.message"]) ?? require_values.nonEmptyString(span.status.message),
|
|
94
|
+
stack
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Span enricher that stamps {@link EXCEPTION_FINGERPRINT_ATTRIBUTE} on every
|
|
99
|
+
* span that recorded an exception.
|
|
100
|
+
*
|
|
101
|
+
* Pass it to `init({ spanEnrichers: [...] })` rather than `spanProcessors`:
|
|
102
|
+
* enrichers add to the pipeline instead of replacing it, and sit outside the
|
|
103
|
+
* redaction wrapper so the attribute reaches every exporter.
|
|
104
|
+
*/
|
|
105
|
+
function exceptionFingerprint(options = {}) {
|
|
106
|
+
const frames = options.frames ?? DEFAULT_FRAMES;
|
|
107
|
+
return {
|
|
108
|
+
onStart(_span, _context) {},
|
|
109
|
+
onEnd(span) {
|
|
110
|
+
const { attributes } = span;
|
|
111
|
+
if (attributes["exception.fingerprint"] !== void 0) return;
|
|
112
|
+
const exception = readException(span);
|
|
113
|
+
if (!exception) return;
|
|
114
|
+
const fingerprint = fingerprintException(exception, frames);
|
|
115
|
+
if (fingerprint) attributes[EXCEPTION_FINGERPRINT_ATTRIBUTE] = fingerprint;
|
|
116
|
+
},
|
|
117
|
+
forceFlush() {
|
|
118
|
+
return Promise.resolve();
|
|
119
|
+
},
|
|
120
|
+
shutdown() {
|
|
121
|
+
return Promise.resolve();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
exports.EXCEPTION_FINGERPRINT_ATTRIBUTE = EXCEPTION_FINGERPRINT_ATTRIBUTE;
|
|
128
|
+
exports.exceptionFingerprint = exceptionFingerprint;
|
|
129
|
+
exports.fingerprintException = fingerprintException;
|
|
130
|
+
exports.hashFingerprintParts = hashFingerprintParts;
|
|
131
|
+
exports.normalizeFilePath = normalizeFilePath;
|
|
132
|
+
exports.normalizeMessage = normalizeMessage;
|
|
133
|
+
exports.normalizeStackFrames = normalizeStackFrames;
|