@autter/runtime-node 1.7.0 → 1.9.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 +103 -1
- package/dist/{chunk-HKVFURYT.cjs → chunk-AN45KLWD.cjs} +11 -11
- package/dist/{chunk-GYTQLITW.cjs → chunk-BHYHORUD.cjs} +58 -3
- package/dist/{chunk-KA4AOZX2.js → chunk-HHKQ3UCH.js} +571 -31
- package/dist/{chunk-QUC6OUE7.js → chunk-JSGGUWRD.js} +1 -1
- package/dist/{chunk-RV4MJNM2.cjs → chunk-YWTIKZSI.cjs} +631 -91
- package/dist/{chunk-LG52CW3V.js → chunk-ZKM76SDP.js} +58 -3
- package/dist/cli.cjs +8 -8
- package/dist/cli.js +2 -2
- package/dist/index.cjs +447 -210
- package/dist/index.d.cts +98 -3
- package/dist/index.d.ts +98 -3
- package/dist/index.js +253 -16
- package/dist/{sinks-CPGDyfU8.d.ts → sinks-CLtQFPnn.d.cts} +59 -3
- package/dist/{sinks-CPGDyfU8.d.cts → sinks-CLtQFPnn.d.ts} +59 -3
- 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 +7 -3
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, B as BreadcrumbInput } from './sinks-
|
|
3
|
-
export {
|
|
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-CLtQFPnn.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-CLtQFPnn.cjs';
|
|
4
4
|
import { Attributes } from '@opentelemetry/api';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -23,6 +23,37 @@ interface RelayOptions {
|
|
|
23
23
|
* `false` to disable (e.g. when a WAF already rate-limits).
|
|
24
24
|
*/
|
|
25
25
|
perIpRateLimit?: number | false;
|
|
26
|
+
/**
|
|
27
|
+
* How the per-client rate limit finds the visitor's address. A caller can
|
|
28
|
+
* write anything into `X-Forwarded-For`, so the relay never takes its
|
|
29
|
+
* first (leftmost) entry unless told to.
|
|
30
|
+
*
|
|
31
|
+
* - `"auto"` (default): works behind any load balancer, CDN or platform
|
|
32
|
+
* proxy without setup. Proxies append the address they saw to the right
|
|
33
|
+
* of the header (or overwrite it), so the relay reads it right to left
|
|
34
|
+
* and takes the first public address, skipping private and loopback
|
|
35
|
+
* hops. The Node handler only does this when the connection itself came
|
|
36
|
+
* from a private address (a proxy on your network); a public peer is the
|
|
37
|
+
* visitor and its header is ignored. On Cloudflare Workers it uses
|
|
38
|
+
* `CF-Connecting-IP`.
|
|
39
|
+
* - a number `n`: exactly `n` proxies you control sit in front; use the
|
|
40
|
+
* entry `n` from the right (Express `trust proxy` semantics). Use `1`
|
|
41
|
+
* for a Node origin behind Cloudflare with no load balancer.
|
|
42
|
+
* - `true`: every proxy in front is yours and strips client values; use
|
|
43
|
+
* the leftmost entry.
|
|
44
|
+
* - `false`: never read the header. The Node handler keys the socket peer;
|
|
45
|
+
* the fetch handler keys one shared bucket for the route.
|
|
46
|
+
*
|
|
47
|
+
* Strings from environment variables are read too (`"auto"`, `"true"`,
|
|
48
|
+
* `"false"`, `"0"`, `"2"`); anything else falls back to `"auto"`.
|
|
49
|
+
*/
|
|
50
|
+
trustProxy?: boolean | "auto" | number | string;
|
|
51
|
+
/**
|
|
52
|
+
* Return the visitor's address yourself (Deno's `info.remoteAddr`, Bun's
|
|
53
|
+
* `server.requestIP`, a header your edge sets). Wins over `trustProxy`
|
|
54
|
+
* when it returns a non-empty string.
|
|
55
|
+
*/
|
|
56
|
+
clientIp?: (request: Request | IncomingMessage) => string | null | undefined;
|
|
26
57
|
/** Called when the async forward fails (default: console.warn). */
|
|
27
58
|
onError?: (err: unknown) => void;
|
|
28
59
|
/**
|
|
@@ -167,6 +198,19 @@ declare const runtimeContext: {
|
|
|
167
198
|
warn(message: string, attributes?: RuntimeLogContext): void;
|
|
168
199
|
/** Log an error and attach it (code/why/fix) to the current summary. */
|
|
169
200
|
error(error: unknown, attributes?: RuntimeLogContext): void;
|
|
201
|
+
/**
|
|
202
|
+
* The app caught `error` and chose to continue on a fallback (RF-02):
|
|
203
|
+
*
|
|
204
|
+
* } catch (err) {
|
|
205
|
+
* runtimeContext.degraded(err, "pricing service down, using cached prices");
|
|
206
|
+
* }
|
|
207
|
+
*
|
|
208
|
+
* Recorded as an occurrence at `warning` severity, marked
|
|
209
|
+
* `autter.handling = "deliberate"` with the reason (grouped by its code
|
|
210
|
+
* when the error has one), never an incident. The current request or
|
|
211
|
+
* operation ends "degraded" unless it failed or set its outcome.
|
|
212
|
+
*/
|
|
213
|
+
degraded(error: unknown, reason: string, attributes?: RuntimeLogContext): void;
|
|
170
214
|
/** Current operation id. */
|
|
171
215
|
readonly id: string | undefined;
|
|
172
216
|
/** Current request id (inherited by child operations and forks). */
|
|
@@ -227,6 +271,25 @@ interface AutterServerOptions {
|
|
|
227
271
|
release?: string;
|
|
228
272
|
/** Head-sampling ratio for regular traces. Default 0.01 (1%). */
|
|
229
273
|
traceSampleRate?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Share of captured errors reported, 0..1 (default 1: all). Applies to
|
|
276
|
+
* `captureException`, error-severity `captureMessage` and `reportOutcome`.
|
|
277
|
+
* Never samples out a fatal message, a crash (uncaught exception) or an
|
|
278
|
+
* unhandled rejection; warnings and info are never sampled. One thrown
|
|
279
|
+
* value is decided once, however many hooks report it. What is sampled
|
|
280
|
+
* out is not counted anywhere: for counted volume control use
|
|
281
|
+
* suppression rules in Autter (ingester 1.9.0). Not `traceSampleRate`,
|
|
282
|
+
* which samples healthy traces.
|
|
283
|
+
*/
|
|
284
|
+
sampleRate?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Errors never reported: strings match when the error's type or message
|
|
287
|
+
* contains them (case-sensitive), RegExps are tested against the type,
|
|
288
|
+
* the message and `"<type>: <message>"`. Applies to every capture path,
|
|
289
|
+
* crashes included. A request that failed still records its failed
|
|
290
|
+
* span and summary: leave those out with a suppression rule in Autter.
|
|
291
|
+
*/
|
|
292
|
+
ignoreErrors?: IgnoreErrorPattern[];
|
|
230
293
|
/**
|
|
231
294
|
* Keep the FULL trace whenever it contains an error: an ERROR-status
|
|
232
295
|
* span (e.g. a 5xx request), a recorded exception, or a
|
|
@@ -249,6 +312,20 @@ interface AutterServerOptions {
|
|
|
249
312
|
* Default true; false turns both off.
|
|
250
313
|
*/
|
|
251
314
|
captureGlobalErrors?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Errors the app caught and logged count (RF-01): an `Error` passed to
|
|
317
|
+
* `console.error`, pino, winston, bunyan or `runtimeLogger.error` becomes
|
|
318
|
+
* an occurrence at `error` severity, marked `autter.handled` /
|
|
319
|
+
* `autter.handling: "caught"`, with the log line as context
|
|
320
|
+
* (`autter.log.source`, `autter.log.message`). Log lines without an error
|
|
321
|
+
* object are untouched; an error also passed to `captureException` in
|
|
322
|
+
* the same tick is reported once; a burst limit per error type and throw
|
|
323
|
+
* site keeps ten at once, then one every ten seconds (the count left out
|
|
324
|
+
* is reported). It never fails a request on its own. `false` turns it
|
|
325
|
+
* off; an object turns single loggers off, e.g. `{ console: false }`.
|
|
326
|
+
* Default true.
|
|
327
|
+
*/
|
|
328
|
+
captureLoggedErrors?: CaptureLoggedErrorsOption;
|
|
252
329
|
/**
|
|
253
330
|
* Record unhandled promise rejections as errors (severity "error",
|
|
254
331
|
* `autter.unhandled_rejection: true`). Never changes whether the process
|
|
@@ -598,6 +675,18 @@ interface RuntimeRequestOptions {
|
|
|
598
675
|
ignore?: string[];
|
|
599
676
|
/** Receives the log flush promise after the response (serverless `waitUntil`). */
|
|
600
677
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
678
|
+
/**
|
|
679
|
+
* Report thrown errors (default true): `false`, or a predicate per error.
|
|
680
|
+
* An error it turns down is rethrown untouched and does not fail the
|
|
681
|
+
* summary (Next.js `redirect()` / `notFound()` signals).
|
|
682
|
+
*/
|
|
683
|
+
capture?: boolean | ((error: unknown) => boolean);
|
|
684
|
+
/**
|
|
685
|
+
* Answer a thrown error with `toClientError` JSON and the error's own
|
|
686
|
+
* 4xx/5xx status (else 500) instead of rethrowing it, so a thrown 4xx is
|
|
687
|
+
* recorded with its stack and still answered as a 4xx. Default false.
|
|
688
|
+
*/
|
|
689
|
+
errorResponse?: boolean | ((error: unknown) => boolean);
|
|
601
690
|
}
|
|
602
691
|
/**
|
|
603
692
|
* Report an error that reached a request boundary — a framework error hook,
|
|
@@ -783,6 +872,12 @@ interface AutterLoggingOptions {
|
|
|
783
872
|
* (use when the app's own spans are not exported to Autter).
|
|
784
873
|
*/
|
|
785
874
|
exceptions?: "auto" | "log";
|
|
875
|
+
/** Same semantics as initAutterServer: share of captured errors reported (crashes never sampled). */
|
|
876
|
+
sampleRate?: number;
|
|
877
|
+
/** Same semantics as initAutterServer: errors never reported (type or message). */
|
|
878
|
+
ignoreErrors?: IgnoreErrorPattern[];
|
|
879
|
+
/** Same semantics as initAutterServer: errors logged through console.error, pino, winston, bunyan or runtimeLogger.error are occurrences. Default true. */
|
|
880
|
+
captureLoggedErrors?: CaptureLoggedErrorsOption;
|
|
786
881
|
}
|
|
787
882
|
interface AutterLogging {
|
|
788
883
|
captureException(error: unknown, attributes?: Attributes): void;
|
|
@@ -965,4 +1060,4 @@ declare function runDoctor(options?: DoctorOptions): Promise<DoctorReport>;
|
|
|
965
1060
|
*/
|
|
966
1061
|
declare function addBreadcrumb(input: BreadcrumbInput): void;
|
|
967
1062
|
|
|
968
|
-
export { type AutoFlushHandle, type AutoFlushOptions, type AutterErrorHandlerOptions, type AutterErrorResponseOptions, type AutterLogging, type AutterLoggingOptions, type AutterRequestsOptions, type AutterServer, type AutterServerOptions, type AutterSeverity, BreadcrumbInput, COMPAT_MANIFEST, type CompatIssue, type DoctorOptions, type DoctorReport, FileSinkOptions, type FlushTarget, INGESTER_VERSION_HEADER, type IngesterCompatInfo, type InstrumentLlmOptions, type LlmCallHandle, type LlmCallInfo, type LlmUsage, RedactOptions, type RelayOptions, RuntimeCarrier, type RuntimeContextHandle, type RuntimeEnrichContext, type RuntimeEnrichEvent, type RuntimeEnricher, RuntimeLogContext, RuntimeLogLevel, type RuntimeLoggingOptions, type RuntimeOperation, RuntimeOperationKind, type RuntimeOperationOptions, RuntimeOutcome, type RuntimeRequestOptions, RuntimeSink, SDK_IDENTITY, type SafeCapture, type SdkIdentity, type TrackedLlmCall, type UnhandledRejectionsMode, addBreadcrumb, autterErrorHandler, autterErrorResponse, autterFastify, autterFastifyErrors, autterKoa, autterRequests, captureException, captureMessage, captureRequestError, createBrowserRelayFetchHandler, createBrowserRelayHandler, createRuntimeLogger, emitLlmSelftestTrace, enrichDeployment, enrichEdgeGeo, enrichRequestSize, enrichUserAgent, evaluateCompat, fetchIngesterCompat, flushRuntimeLogs, initAutterLogging, initAutterServer, installAutterAutoFlush, instrumentLlmClient, makeSafeCapture, reportOutcome, runDoctor, runInBackground, runtimeContext, runtimeLogStats, runtimeLogger, sanitizeBrowserPayload, startCaughtExceptionSampler, trackLlmCall, unhandledRejectionsMode, withLlmCall, withProcessSpan, withRuntimeOperation, withRuntimeRequest };
|
|
1063
|
+
export { type AutoFlushHandle, type AutoFlushOptions, type AutterErrorHandlerOptions, type AutterErrorResponseOptions, type AutterLogging, type AutterLoggingOptions, type AutterRequestsOptions, type AutterServer, type AutterServerOptions, type AutterSeverity, BreadcrumbInput, COMPAT_MANIFEST, CaptureLoggedErrorsOption, type CompatIssue, type DoctorOptions, type DoctorReport, FileSinkOptions, type FlushTarget, INGESTER_VERSION_HEADER, type IngesterCompatInfo, type InstrumentLlmOptions, type LlmCallHandle, type LlmCallInfo, type LlmUsage, RedactOptions, type RelayOptions, RuntimeCarrier, type RuntimeContextHandle, type RuntimeEnrichContext, type RuntimeEnrichEvent, type RuntimeEnricher, RuntimeLogContext, RuntimeLogLevel, type RuntimeLoggingOptions, type RuntimeOperation, RuntimeOperationKind, type RuntimeOperationOptions, RuntimeOutcome, type RuntimeRequestOptions, RuntimeSink, SDK_IDENTITY, type SafeCapture, type SdkIdentity, type TrackedLlmCall, type UnhandledRejectionsMode, addBreadcrumb, autterErrorHandler, autterErrorResponse, autterFastify, autterFastifyErrors, autterKoa, autterRequests, captureException, captureMessage, captureRequestError, createBrowserRelayFetchHandler, createBrowserRelayHandler, createRuntimeLogger, emitLlmSelftestTrace, enrichDeployment, enrichEdgeGeo, enrichRequestSize, enrichUserAgent, evaluateCompat, fetchIngesterCompat, flushRuntimeLogs, initAutterLogging, initAutterServer, installAutterAutoFlush, instrumentLlmClient, makeSafeCapture, reportOutcome, runDoctor, runInBackground, runtimeContext, runtimeLogStats, runtimeLogger, sanitizeBrowserPayload, startCaughtExceptionSampler, trackLlmCall, unhandledRejectionsMode, withLlmCall, withProcessSpan, withRuntimeOperation, withRuntimeRequest };
|
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, B as BreadcrumbInput } from './sinks-
|
|
3
|
-
export {
|
|
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-CLtQFPnn.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-CLtQFPnn.js';
|
|
4
4
|
import { Attributes } from '@opentelemetry/api';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -23,6 +23,37 @@ interface RelayOptions {
|
|
|
23
23
|
* `false` to disable (e.g. when a WAF already rate-limits).
|
|
24
24
|
*/
|
|
25
25
|
perIpRateLimit?: number | false;
|
|
26
|
+
/**
|
|
27
|
+
* How the per-client rate limit finds the visitor's address. A caller can
|
|
28
|
+
* write anything into `X-Forwarded-For`, so the relay never takes its
|
|
29
|
+
* first (leftmost) entry unless told to.
|
|
30
|
+
*
|
|
31
|
+
* - `"auto"` (default): works behind any load balancer, CDN or platform
|
|
32
|
+
* proxy without setup. Proxies append the address they saw to the right
|
|
33
|
+
* of the header (or overwrite it), so the relay reads it right to left
|
|
34
|
+
* and takes the first public address, skipping private and loopback
|
|
35
|
+
* hops. The Node handler only does this when the connection itself came
|
|
36
|
+
* from a private address (a proxy on your network); a public peer is the
|
|
37
|
+
* visitor and its header is ignored. On Cloudflare Workers it uses
|
|
38
|
+
* `CF-Connecting-IP`.
|
|
39
|
+
* - a number `n`: exactly `n` proxies you control sit in front; use the
|
|
40
|
+
* entry `n` from the right (Express `trust proxy` semantics). Use `1`
|
|
41
|
+
* for a Node origin behind Cloudflare with no load balancer.
|
|
42
|
+
* - `true`: every proxy in front is yours and strips client values; use
|
|
43
|
+
* the leftmost entry.
|
|
44
|
+
* - `false`: never read the header. The Node handler keys the socket peer;
|
|
45
|
+
* the fetch handler keys one shared bucket for the route.
|
|
46
|
+
*
|
|
47
|
+
* Strings from environment variables are read too (`"auto"`, `"true"`,
|
|
48
|
+
* `"false"`, `"0"`, `"2"`); anything else falls back to `"auto"`.
|
|
49
|
+
*/
|
|
50
|
+
trustProxy?: boolean | "auto" | number | string;
|
|
51
|
+
/**
|
|
52
|
+
* Return the visitor's address yourself (Deno's `info.remoteAddr`, Bun's
|
|
53
|
+
* `server.requestIP`, a header your edge sets). Wins over `trustProxy`
|
|
54
|
+
* when it returns a non-empty string.
|
|
55
|
+
*/
|
|
56
|
+
clientIp?: (request: Request | IncomingMessage) => string | null | undefined;
|
|
26
57
|
/** Called when the async forward fails (default: console.warn). */
|
|
27
58
|
onError?: (err: unknown) => void;
|
|
28
59
|
/**
|
|
@@ -167,6 +198,19 @@ declare const runtimeContext: {
|
|
|
167
198
|
warn(message: string, attributes?: RuntimeLogContext): void;
|
|
168
199
|
/** Log an error and attach it (code/why/fix) to the current summary. */
|
|
169
200
|
error(error: unknown, attributes?: RuntimeLogContext): void;
|
|
201
|
+
/**
|
|
202
|
+
* The app caught `error` and chose to continue on a fallback (RF-02):
|
|
203
|
+
*
|
|
204
|
+
* } catch (err) {
|
|
205
|
+
* runtimeContext.degraded(err, "pricing service down, using cached prices");
|
|
206
|
+
* }
|
|
207
|
+
*
|
|
208
|
+
* Recorded as an occurrence at `warning` severity, marked
|
|
209
|
+
* `autter.handling = "deliberate"` with the reason (grouped by its code
|
|
210
|
+
* when the error has one), never an incident. The current request or
|
|
211
|
+
* operation ends "degraded" unless it failed or set its outcome.
|
|
212
|
+
*/
|
|
213
|
+
degraded(error: unknown, reason: string, attributes?: RuntimeLogContext): void;
|
|
170
214
|
/** Current operation id. */
|
|
171
215
|
readonly id: string | undefined;
|
|
172
216
|
/** Current request id (inherited by child operations and forks). */
|
|
@@ -227,6 +271,25 @@ interface AutterServerOptions {
|
|
|
227
271
|
release?: string;
|
|
228
272
|
/** Head-sampling ratio for regular traces. Default 0.01 (1%). */
|
|
229
273
|
traceSampleRate?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Share of captured errors reported, 0..1 (default 1: all). Applies to
|
|
276
|
+
* `captureException`, error-severity `captureMessage` and `reportOutcome`.
|
|
277
|
+
* Never samples out a fatal message, a crash (uncaught exception) or an
|
|
278
|
+
* unhandled rejection; warnings and info are never sampled. One thrown
|
|
279
|
+
* value is decided once, however many hooks report it. What is sampled
|
|
280
|
+
* out is not counted anywhere: for counted volume control use
|
|
281
|
+
* suppression rules in Autter (ingester 1.9.0). Not `traceSampleRate`,
|
|
282
|
+
* which samples healthy traces.
|
|
283
|
+
*/
|
|
284
|
+
sampleRate?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Errors never reported: strings match when the error's type or message
|
|
287
|
+
* contains them (case-sensitive), RegExps are tested against the type,
|
|
288
|
+
* the message and `"<type>: <message>"`. Applies to every capture path,
|
|
289
|
+
* crashes included. A request that failed still records its failed
|
|
290
|
+
* span and summary: leave those out with a suppression rule in Autter.
|
|
291
|
+
*/
|
|
292
|
+
ignoreErrors?: IgnoreErrorPattern[];
|
|
230
293
|
/**
|
|
231
294
|
* Keep the FULL trace whenever it contains an error: an ERROR-status
|
|
232
295
|
* span (e.g. a 5xx request), a recorded exception, or a
|
|
@@ -249,6 +312,20 @@ interface AutterServerOptions {
|
|
|
249
312
|
* Default true; false turns both off.
|
|
250
313
|
*/
|
|
251
314
|
captureGlobalErrors?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Errors the app caught and logged count (RF-01): an `Error` passed to
|
|
317
|
+
* `console.error`, pino, winston, bunyan or `runtimeLogger.error` becomes
|
|
318
|
+
* an occurrence at `error` severity, marked `autter.handled` /
|
|
319
|
+
* `autter.handling: "caught"`, with the log line as context
|
|
320
|
+
* (`autter.log.source`, `autter.log.message`). Log lines without an error
|
|
321
|
+
* object are untouched; an error also passed to `captureException` in
|
|
322
|
+
* the same tick is reported once; a burst limit per error type and throw
|
|
323
|
+
* site keeps ten at once, then one every ten seconds (the count left out
|
|
324
|
+
* is reported). It never fails a request on its own. `false` turns it
|
|
325
|
+
* off; an object turns single loggers off, e.g. `{ console: false }`.
|
|
326
|
+
* Default true.
|
|
327
|
+
*/
|
|
328
|
+
captureLoggedErrors?: CaptureLoggedErrorsOption;
|
|
252
329
|
/**
|
|
253
330
|
* Record unhandled promise rejections as errors (severity "error",
|
|
254
331
|
* `autter.unhandled_rejection: true`). Never changes whether the process
|
|
@@ -598,6 +675,18 @@ interface RuntimeRequestOptions {
|
|
|
598
675
|
ignore?: string[];
|
|
599
676
|
/** Receives the log flush promise after the response (serverless `waitUntil`). */
|
|
600
677
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
678
|
+
/**
|
|
679
|
+
* Report thrown errors (default true): `false`, or a predicate per error.
|
|
680
|
+
* An error it turns down is rethrown untouched and does not fail the
|
|
681
|
+
* summary (Next.js `redirect()` / `notFound()` signals).
|
|
682
|
+
*/
|
|
683
|
+
capture?: boolean | ((error: unknown) => boolean);
|
|
684
|
+
/**
|
|
685
|
+
* Answer a thrown error with `toClientError` JSON and the error's own
|
|
686
|
+
* 4xx/5xx status (else 500) instead of rethrowing it, so a thrown 4xx is
|
|
687
|
+
* recorded with its stack and still answered as a 4xx. Default false.
|
|
688
|
+
*/
|
|
689
|
+
errorResponse?: boolean | ((error: unknown) => boolean);
|
|
601
690
|
}
|
|
602
691
|
/**
|
|
603
692
|
* Report an error that reached a request boundary — a framework error hook,
|
|
@@ -783,6 +872,12 @@ interface AutterLoggingOptions {
|
|
|
783
872
|
* (use when the app's own spans are not exported to Autter).
|
|
784
873
|
*/
|
|
785
874
|
exceptions?: "auto" | "log";
|
|
875
|
+
/** Same semantics as initAutterServer: share of captured errors reported (crashes never sampled). */
|
|
876
|
+
sampleRate?: number;
|
|
877
|
+
/** Same semantics as initAutterServer: errors never reported (type or message). */
|
|
878
|
+
ignoreErrors?: IgnoreErrorPattern[];
|
|
879
|
+
/** Same semantics as initAutterServer: errors logged through console.error, pino, winston, bunyan or runtimeLogger.error are occurrences. Default true. */
|
|
880
|
+
captureLoggedErrors?: CaptureLoggedErrorsOption;
|
|
786
881
|
}
|
|
787
882
|
interface AutterLogging {
|
|
788
883
|
captureException(error: unknown, attributes?: Attributes): void;
|
|
@@ -965,4 +1060,4 @@ declare function runDoctor(options?: DoctorOptions): Promise<DoctorReport>;
|
|
|
965
1060
|
*/
|
|
966
1061
|
declare function addBreadcrumb(input: BreadcrumbInput): void;
|
|
967
1062
|
|
|
968
|
-
export { type AutoFlushHandle, type AutoFlushOptions, type AutterErrorHandlerOptions, type AutterErrorResponseOptions, type AutterLogging, type AutterLoggingOptions, type AutterRequestsOptions, type AutterServer, type AutterServerOptions, type AutterSeverity, BreadcrumbInput, COMPAT_MANIFEST, type CompatIssue, type DoctorOptions, type DoctorReport, FileSinkOptions, type FlushTarget, INGESTER_VERSION_HEADER, type IngesterCompatInfo, type InstrumentLlmOptions, type LlmCallHandle, type LlmCallInfo, type LlmUsage, RedactOptions, type RelayOptions, RuntimeCarrier, type RuntimeContextHandle, type RuntimeEnrichContext, type RuntimeEnrichEvent, type RuntimeEnricher, RuntimeLogContext, RuntimeLogLevel, type RuntimeLoggingOptions, type RuntimeOperation, RuntimeOperationKind, type RuntimeOperationOptions, RuntimeOutcome, type RuntimeRequestOptions, RuntimeSink, SDK_IDENTITY, type SafeCapture, type SdkIdentity, type TrackedLlmCall, type UnhandledRejectionsMode, addBreadcrumb, autterErrorHandler, autterErrorResponse, autterFastify, autterFastifyErrors, autterKoa, autterRequests, captureException, captureMessage, captureRequestError, createBrowserRelayFetchHandler, createBrowserRelayHandler, createRuntimeLogger, emitLlmSelftestTrace, enrichDeployment, enrichEdgeGeo, enrichRequestSize, enrichUserAgent, evaluateCompat, fetchIngesterCompat, flushRuntimeLogs, initAutterLogging, initAutterServer, installAutterAutoFlush, instrumentLlmClient, makeSafeCapture, reportOutcome, runDoctor, runInBackground, runtimeContext, runtimeLogStats, runtimeLogger, sanitizeBrowserPayload, startCaughtExceptionSampler, trackLlmCall, unhandledRejectionsMode, withLlmCall, withProcessSpan, withRuntimeOperation, withRuntimeRequest };
|
|
1063
|
+
export { type AutoFlushHandle, type AutoFlushOptions, type AutterErrorHandlerOptions, type AutterErrorResponseOptions, type AutterLogging, type AutterLoggingOptions, type AutterRequestsOptions, type AutterServer, type AutterServerOptions, type AutterSeverity, BreadcrumbInput, COMPAT_MANIFEST, CaptureLoggedErrorsOption, type CompatIssue, type DoctorOptions, type DoctorReport, FileSinkOptions, type FlushTarget, INGESTER_VERSION_HEADER, type IngesterCompatInfo, type InstrumentLlmOptions, type LlmCallHandle, type LlmCallInfo, type LlmUsage, RedactOptions, type RelayOptions, RuntimeCarrier, type RuntimeContextHandle, type RuntimeEnrichContext, type RuntimeEnrichEvent, type RuntimeEnricher, RuntimeLogContext, RuntimeLogLevel, type RuntimeLoggingOptions, type RuntimeOperation, RuntimeOperationKind, type RuntimeOperationOptions, RuntimeOutcome, type RuntimeRequestOptions, RuntimeSink, SDK_IDENTITY, type SafeCapture, type SdkIdentity, type TrackedLlmCall, type UnhandledRejectionsMode, addBreadcrumb, autterErrorHandler, autterErrorResponse, autterFastify, autterFastifyErrors, autterKoa, autterRequests, captureException, captureMessage, captureRequestError, createBrowserRelayFetchHandler, createBrowserRelayHandler, createRuntimeLogger, emitLlmSelftestTrace, enrichDeployment, enrichEdgeGeo, enrichRequestSize, enrichUserAgent, evaluateCompat, fetchIngesterCompat, flushRuntimeLogs, initAutterLogging, initAutterServer, installAutterAutoFlush, instrumentLlmClient, makeSafeCapture, reportOutcome, runDoctor, runInBackground, runtimeContext, runtimeLogStats, runtimeLogger, sanitizeBrowserPayload, startCaughtExceptionSampler, trackLlmCall, unhandledRejectionsMode, withLlmCall, withProcessSpan, withRuntimeOperation, withRuntimeRequest };
|