@autter/runtime-node 1.9.0 → 1.9.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/dist/{chunk-BHYHORUD.cjs → chunk-3P573RHA.cjs} +1 -1
- package/dist/{chunk-HHKQ3UCH.js → chunk-D3PJ7TQ4.js} +18 -6
- package/dist/{chunk-YWTIKZSI.cjs → chunk-FV64SIRQ.cjs} +26 -14
- package/dist/{chunk-JSGGUWRD.js → chunk-FYMEBULO.js} +4 -3
- package/dist/{chunk-AN45KLWD.cjs → chunk-LYXQC4FI.cjs} +14 -13
- package/dist/{chunk-ZKM76SDP.js → chunk-VIP2EL47.js} +1 -1
- package/dist/cli.cjs +8 -8
- package/dist/cli.js +2 -2
- package/dist/index.cjs +269 -247
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +35 -13
- package/dist/{sinks-CLtQFPnn.d.ts → sinks-BfUoE96B.d.cts} +3 -1
- package/dist/{sinks-CLtQFPnn.d.cts → sinks-BfUoE96B.d.ts} +3 -1
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { b as RedactOptions, c as Redactor$1, d as RuntimeLogLevel, e as RuntimeOperationKind, f as RuntimeSink, F as FileSinkOptions, g as RuntimeLogContext, a as RuntimeOutcome, h as RuntimeCarrier, I as IgnoreErrorPattern, i as CaptureLoggedErrorsOption, B as BreadcrumbInput } from './sinks-
|
|
3
|
-
export { j as Breadcrumb, k as BreadcrumbLevel, l as BreadcrumbType, n as CODE_PATTERN, o as ClientErrorBody, p as ConsoleSinkOptions, L as LoggedErrorSource, O as OtlpSinkOptions, q as RuntimeError, r as RuntimeErrorCatalog, s as RuntimeErrorDefinition, t as RuntimeErrorExtras, u as RuntimeErrorFactory, v as RuntimeErrorLike, w as RuntimeErrorOptions, R as RuntimeEvent, x as RuntimeLogContextValue, y as RuntimeSinkContext, z as consoleSink, A as defineRuntimeErrors, D as errorAttributes, E as fileSink, G as isRuntimeErrorLike, H as otlpSink, J as redactAttributes, K as redactText, N as toClientError } from './sinks-
|
|
2
|
+
import { b as RedactOptions, c as Redactor$1, d as RuntimeLogLevel, e as RuntimeOperationKind, f as RuntimeSink, F as FileSinkOptions, g as RuntimeLogContext, a as RuntimeOutcome, h as RuntimeCarrier, I as IgnoreErrorPattern, i as CaptureLoggedErrorsOption, B as BreadcrumbInput } from './sinks-BfUoE96B.cjs';
|
|
3
|
+
export { j as Breadcrumb, k as BreadcrumbLevel, l as BreadcrumbType, n as CODE_PATTERN, o as ClientErrorBody, p as ConsoleSinkOptions, L as LoggedErrorSource, O as OtlpSinkOptions, q as RuntimeError, r as RuntimeErrorCatalog, s as RuntimeErrorDefinition, t as RuntimeErrorExtras, u as RuntimeErrorFactory, v as RuntimeErrorLike, w as RuntimeErrorOptions, R as RuntimeEvent, x as RuntimeLogContextValue, y as RuntimeSinkContext, z as consoleSink, A as defineRuntimeErrors, D as errorAttributes, E as fileSink, G as isRuntimeErrorLike, H as otlpSink, J as redactAttributes, K as redactText, N as toClientError } from './sinks-BfUoE96B.cjs';
|
|
4
4
|
import { Attributes } from '@opentelemetry/api';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1040,7 +1040,7 @@ interface DoctorReport {
|
|
|
1040
1040
|
sdks: SdkIdentity[];
|
|
1041
1041
|
ingester: IngesterCompatInfo | null;
|
|
1042
1042
|
ingesterError?: string;
|
|
1043
|
-
key?: "accepted" | "rejected" | "client_key" | "storage_unavailable" | "unknown";
|
|
1043
|
+
key?: "accepted" | "rejected" | "client_key" | "storage_unavailable" | "unverified" | "unknown";
|
|
1044
1044
|
features: Array<{
|
|
1045
1045
|
id: string;
|
|
1046
1046
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { b as RedactOptions, c as Redactor$1, d as RuntimeLogLevel, e as RuntimeOperationKind, f as RuntimeSink, F as FileSinkOptions, g as RuntimeLogContext, a as RuntimeOutcome, h as RuntimeCarrier, I as IgnoreErrorPattern, i as CaptureLoggedErrorsOption, B as BreadcrumbInput } from './sinks-
|
|
3
|
-
export { j as Breadcrumb, k as BreadcrumbLevel, l as BreadcrumbType, n as CODE_PATTERN, o as ClientErrorBody, p as ConsoleSinkOptions, L as LoggedErrorSource, O as OtlpSinkOptions, q as RuntimeError, r as RuntimeErrorCatalog, s as RuntimeErrorDefinition, t as RuntimeErrorExtras, u as RuntimeErrorFactory, v as RuntimeErrorLike, w as RuntimeErrorOptions, R as RuntimeEvent, x as RuntimeLogContextValue, y as RuntimeSinkContext, z as consoleSink, A as defineRuntimeErrors, D as errorAttributes, E as fileSink, G as isRuntimeErrorLike, H as otlpSink, J as redactAttributes, K as redactText, N as toClientError } from './sinks-
|
|
2
|
+
import { b as RedactOptions, c as Redactor$1, d as RuntimeLogLevel, e as RuntimeOperationKind, f as RuntimeSink, F as FileSinkOptions, g as RuntimeLogContext, a as RuntimeOutcome, h as RuntimeCarrier, I as IgnoreErrorPattern, i as CaptureLoggedErrorsOption, B as BreadcrumbInput } from './sinks-BfUoE96B.js';
|
|
3
|
+
export { j as Breadcrumb, k as BreadcrumbLevel, l as BreadcrumbType, n as CODE_PATTERN, o as ClientErrorBody, p as ConsoleSinkOptions, L as LoggedErrorSource, O as OtlpSinkOptions, q as RuntimeError, r as RuntimeErrorCatalog, s as RuntimeErrorDefinition, t as RuntimeErrorExtras, u as RuntimeErrorFactory, v as RuntimeErrorLike, w as RuntimeErrorOptions, R as RuntimeEvent, x as RuntimeLogContextValue, y as RuntimeSinkContext, z as consoleSink, A as defineRuntimeErrors, D as errorAttributes, E as fileSink, G as isRuntimeErrorLike, H as otlpSink, J as redactAttributes, K as redactText, N as toClientError } from './sinks-BfUoE96B.js';
|
|
4
4
|
import { Attributes } from '@opentelemetry/api';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1040,7 +1040,7 @@ interface DoctorReport {
|
|
|
1040
1040
|
sdks: SdkIdentity[];
|
|
1041
1041
|
ingester: IngesterCompatInfo | null;
|
|
1042
1042
|
ingesterError?: string;
|
|
1043
|
-
key?: "accepted" | "rejected" | "client_key" | "storage_unavailable" | "unknown";
|
|
1043
|
+
key?: "accepted" | "rejected" | "client_key" | "storage_unavailable" | "unverified" | "unknown";
|
|
1044
1044
|
features: Array<{
|
|
1045
1045
|
id: string;
|
|
1046
1046
|
title: string;
|
package/dist/index.js
CHANGED
|
@@ -51,10 +51,10 @@ import {
|
|
|
51
51
|
stopLoggedErrorCapture,
|
|
52
52
|
toClientError,
|
|
53
53
|
withRuntimeOperation
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-D3PJ7TQ4.js";
|
|
55
55
|
import {
|
|
56
56
|
runDoctor
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-FYMEBULO.js";
|
|
58
58
|
import {
|
|
59
59
|
COMPAT_MANIFEST,
|
|
60
60
|
CountingExporter,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
sharedSlot,
|
|
77
77
|
telemetryStats,
|
|
78
78
|
unregisterFlushTargets
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-VIP2EL47.js";
|
|
80
80
|
|
|
81
81
|
// src/relay.ts
|
|
82
82
|
var IpWindow = class {
|
|
@@ -401,20 +401,38 @@ function sanitizeBrowserPayload(raw, redactor = defaultRelayRedactor) {
|
|
|
401
401
|
events
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
|
+
var FORWARD_ATTEMPTS = 3;
|
|
405
|
+
var FORWARD_MAX_WAIT_MS = 1e4;
|
|
404
406
|
function forward(payload, opts) {
|
|
405
407
|
const endpoint = (opts.endpoint ?? DEFAULT_ENDPOINT).replace(/\/$/, "");
|
|
406
408
|
const url = `${endpoint}/v1/browser`;
|
|
407
409
|
const compat = opts.compatCheck !== false;
|
|
408
410
|
if (compat) ensureCompatConfigured(endpoint);
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
411
|
+
const body = JSON.stringify(payload);
|
|
412
|
+
const attempt = async (n) => {
|
|
413
|
+
let response;
|
|
414
|
+
try {
|
|
415
|
+
response = await fetch(url, {
|
|
416
|
+
method: "POST",
|
|
417
|
+
headers: {
|
|
418
|
+
"content-type": "application/json",
|
|
419
|
+
authorization: `Bearer ${opts.apiKey}`
|
|
420
|
+
},
|
|
421
|
+
body,
|
|
422
|
+
signal: AbortSignal.timeout(1e4)
|
|
423
|
+
});
|
|
424
|
+
} catch (err) {
|
|
425
|
+
if (n >= FORWARD_ATTEMPTS) throw err;
|
|
426
|
+
await sleep(1e3 * 2 ** (n - 1));
|
|
427
|
+
return attempt(n + 1);
|
|
428
|
+
}
|
|
429
|
+
if ((response.status === 429 || response.status >= 500) && n < FORWARD_ATTEMPTS) {
|
|
430
|
+
const seconds = Number(response.headers.get("retry-after"));
|
|
431
|
+
await response.body?.cancel().catch(() => {
|
|
432
|
+
});
|
|
433
|
+
await sleep(seconds > 0 ? Math.min(seconds * 1e3, FORWARD_MAX_WAIT_MS) : 1e3 * 2 ** (n - 1));
|
|
434
|
+
return attempt(n + 1);
|
|
435
|
+
}
|
|
418
436
|
if (!compat) return;
|
|
419
437
|
const types = new Set(
|
|
420
438
|
(payload.events ?? []).map((e) => String(e.type))
|
|
@@ -425,12 +443,16 @@ function forward(payload, opts) {
|
|
|
425
443
|
noteCompatFeature("browser_trace_propagation");
|
|
426
444
|
}
|
|
427
445
|
noteRelayRejection(types, response.status, response.headers);
|
|
428
|
-
}
|
|
446
|
+
};
|
|
447
|
+
void attempt(1).catch((err) => {
|
|
429
448
|
(opts.onError ?? ((e) => console.warn("autter relay forward failed:", e)))(
|
|
430
449
|
err
|
|
431
450
|
);
|
|
432
451
|
});
|
|
433
452
|
}
|
|
453
|
+
function sleep(ms) {
|
|
454
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
455
|
+
}
|
|
434
456
|
function createBrowserRelayFetchHandler(opts) {
|
|
435
457
|
const maxBody = opts.maxBodyBytes ?? DEFAULT_MAX_BODY;
|
|
436
458
|
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor : makeRedactor(opts.redact);
|
|
@@ -355,7 +355,9 @@ interface OtlpSinkOptions {
|
|
|
355
355
|
* OTLP/HTTP JSON export to `${endpoint}/v1/logs`. Bounded exactly like
|
|
356
356
|
* 1.4.0: 1000 records / 4 MiB buffered, 256 KiB per record, batches of 50
|
|
357
357
|
* (≤ 512 KiB), 3 attempts within a 10 s deadline, exponential back-off
|
|
358
|
-
* on failure, undelivered records reported at shutdown.
|
|
358
|
+
* on failure, undelivered records reported at shutdown. A 429 or 5xx is
|
|
359
|
+
* retried after its Retry-After (else 500 ms, 1 s); any other 4xx is not
|
|
360
|
+
* retried within the flush.
|
|
359
361
|
*/
|
|
360
362
|
declare function otlpSink(options?: OtlpSinkOptions): RuntimeSink;
|
|
361
363
|
interface ConsoleSinkOptions {
|
|
@@ -355,7 +355,9 @@ interface OtlpSinkOptions {
|
|
|
355
355
|
* OTLP/HTTP JSON export to `${endpoint}/v1/logs`. Bounded exactly like
|
|
356
356
|
* 1.4.0: 1000 records / 4 MiB buffered, 256 KiB per record, batches of 50
|
|
357
357
|
* (≤ 512 KiB), 3 attempts within a 10 s deadline, exponential back-off
|
|
358
|
-
* on failure, undelivered records reported at shutdown.
|
|
358
|
+
* on failure, undelivered records reported at shutdown. A 429 or 5xx is
|
|
359
|
+
* retried after its Retry-After (else 500 ms, 1 s); any other 4xx is not
|
|
360
|
+
* retried within the flush.
|
|
359
361
|
*/
|
|
360
362
|
declare function otlpSink(options?: OtlpSinkOptions): RuntimeSink;
|
|
361
363
|
interface ConsoleSinkOptions {
|
package/dist/testing.cjs
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkFV64SIRQcjs = require('./chunk-FV64SIRQ.cjs');
|
|
6
|
+
require('./chunk-3P573RHA.cjs');
|
|
7
7
|
|
|
8
8
|
// src/testing.ts
|
|
9
9
|
function captureRuntime() {
|
|
10
|
-
const sink =
|
|
11
|
-
const remove =
|
|
10
|
+
const sink = _chunkFV64SIRQcjs.memorySink.call(void 0, );
|
|
11
|
+
const remove = _chunkFV64SIRQcjs.addRuntimeSink.call(void 0, sink);
|
|
12
12
|
return {
|
|
13
13
|
get events() {
|
|
14
14
|
return [...sink.events];
|
|
15
15
|
},
|
|
16
16
|
get operations() {
|
|
17
|
-
return sink.events.filter(
|
|
17
|
+
return sink.events.filter(_chunkFV64SIRQcjs.isSummary);
|
|
18
18
|
},
|
|
19
19
|
get logs() {
|
|
20
|
-
return sink.events.filter((event) => !
|
|
20
|
+
return sink.events.filter((event) => !_chunkFV64SIRQcjs.isSummary.call(void 0, event));
|
|
21
21
|
},
|
|
22
22
|
get exceptions() {
|
|
23
23
|
return [...sink.exceptions];
|
|
@@ -98,7 +98,7 @@ var OperationExpectation = class {
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
function expectOperation(source, name) {
|
|
101
|
-
const events = Array.isArray(source) ? source.filter(
|
|
101
|
+
const events = Array.isArray(source) ? source.filter(_chunkFV64SIRQcjs.isSummary) : source.operations;
|
|
102
102
|
const matches = events.filter((event2) => {
|
|
103
103
|
const actual = String(_nullishCoalesce(event2.attributes["autter.operation.name"], () => ( "")));
|
|
104
104
|
return typeof name === "string" ? actual === name : name.test(actual);
|
|
@@ -118,4 +118,4 @@ function expectOperation(source, name) {
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
exports.captureRuntime = captureRuntime; exports.expectOperation = expectOperation; exports.memorySink =
|
|
121
|
+
exports.captureRuntime = captureRuntime; exports.expectOperation = expectOperation; exports.memorySink = _chunkFV64SIRQcjs.memorySink;
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-
|
|
2
|
-
export { M as MemorySink, m as memorySink } from './sinks-
|
|
1
|
+
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-BfUoE96B.cjs';
|
|
2
|
+
export { M as MemorySink, m as memorySink } from './sinks-BfUoE96B.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test helpers — `@autter/runtime-node/testing`. No ingester, no network:
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-
|
|
2
|
-
export { M as MemorySink, m as memorySink } from './sinks-
|
|
1
|
+
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-BfUoE96B.js';
|
|
2
|
+
export { M as MemorySink, m as memorySink } from './sinks-BfUoE96B.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test helpers — `@autter/runtime-node/testing`. No ingester, no network:
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autter/runtime-node",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Autter Runtime for Node.js: request wide events, coded errors, operation logging, same-origin browser relay and a curated OpenTelemetry server tracker",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|