autotel 6.5.0 → 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-e6jw5zQj.d.cts → functional-CJn2zY4o.d.cts} +96 -39
- package/dist/{functional-AT22vCw6.d.ts → functional-DXy1cHFF.d.ts} +96 -39
- package/dist/{functional-C0uAZq2X.cjs → functional-Da6Yv64r.cjs} +27 -15
- package/dist/{functional-DX7Zvag0.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-pPI3JRRf.d.ts → init-BgnYi2sm.d.ts} +6 -6
- package/dist/{init-CTtHITlX.cjs → init-D4m5rCmD.cjs} +110 -84
- package/dist/{init-ncTMKZ-s.d.cts → init-DrlL1eis.d.cts} +6 -6
- package/dist/{init-WHYwyItd.js → init-JtX-KKz_.js} +105 -85
- 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/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-
|
|
2
|
-
import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-
|
|
3
|
-
import {
|
|
1
|
+
import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-CvBE0z1p.js";
|
|
2
|
+
import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-CwrNAsgk.js";
|
|
3
|
+
import { t as UnknownRecord } from "./values-CeMH-mYG.js";
|
|
4
|
+
import { n as TraceContext$1, r as defineBaggageSchema, t as AttributeValue$2 } from "./trace-context-f89xPJbK.js";
|
|
4
5
|
import { BaggageError, BaggageFieldDefinition, BaggageFieldType, BusinessBaggage, BusinessBaggageValues, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema } from "./business-baggage.js";
|
|
5
6
|
import { CORRELATION_ID_BAGGAGE_KEY, generateCorrelationId, getCorrelationId, getOrCreateCorrelationId, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage } from "./correlation-id.js";
|
|
6
|
-
import { _ as createLinkFromHeaders, a as AlwaysSampler, b as resolveSamplingPreset, f as RandomSampler, g as UserIdSampler, h as SamplingPreset, i as AdaptiveSampler, m as SamplingContext, n as AUTOTEL_SAMPLING_TAIL_EVALUATED, p as Sampler, r as AUTOTEL_SAMPLING_TAIL_KEEP, u as NeverSampler, v as extractLinksFromBatch, x as samplingPresets } from "./sampling-
|
|
7
|
-
import { a as getActiveTraceContext, c as trace$2, d as withTracing, f as InstrumentOptions, i as ctx, l as withBaggage, n as WithBaggageOptions, o as instrument, p as SingleInstrumentOptions, r as WithNewContextOptions, s as span, t as SpanOptions, u as withNewContext } from "./functional-
|
|
7
|
+
import { _ as createLinkFromHeaders, a as AlwaysSampler, b as resolveSamplingPreset, f as RandomSampler, g as UserIdSampler, h as SamplingPreset, i as AdaptiveSampler, m as SamplingContext, n as AUTOTEL_SAMPLING_TAIL_EVALUATED, p as Sampler, r as AUTOTEL_SAMPLING_TAIL_KEEP, u as NeverSampler, v as extractLinksFromBatch, x as samplingPresets } from "./sampling-CM5S2Lp3.js";
|
|
8
|
+
import { a as getActiveTraceContext, c as trace$2, d as withTracing, f as InstrumentOptions, i as ctx, l as withBaggage, n as WithBaggageOptions, o as instrument, p as SingleInstrumentOptions, r as WithNewContextOptions, s as span, t as SpanOptions, u as withNewContext } from "./functional-DXy1cHFF.js";
|
|
8
9
|
import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./drain-pipeline.js";
|
|
9
|
-
import { a as
|
|
10
|
+
import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.js";
|
|
10
11
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.js";
|
|
11
12
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.js";
|
|
12
|
-
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-
|
|
13
|
+
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-BgnYi2sm.js";
|
|
13
14
|
import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-CN1-8C76.js";
|
|
14
|
-
import "./canonical-log-line-processor-
|
|
15
|
-
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-
|
|
15
|
+
import "./canonical-log-line-processor-cPB4Axk-.js";
|
|
16
|
+
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-Bd8f8mST.js";
|
|
16
17
|
import { ParsedError, parseError } from "./parse-error.js";
|
|
17
18
|
import { Metric, MetricsOptions, getMetrics, resetMetrics } from "./metric.js";
|
|
18
19
|
import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js";
|
|
@@ -390,14 +391,14 @@ declare function shutdown(): Promise<void>;
|
|
|
390
391
|
//#region src/request-logger.d.ts
|
|
391
392
|
declare function runWithRequestContext<T>(ctx: TraceContext$1, fn: () => T): T;
|
|
392
393
|
interface RequestLogger {
|
|
393
|
-
set(fields:
|
|
394
|
+
set(fields: UnknownRecord): void;
|
|
394
395
|
/** Set snapshot severity without adding a log event or exception. */
|
|
395
396
|
setLevel(level: RequestLogLevel): void;
|
|
396
|
-
info(message: string, fields?:
|
|
397
|
-
warn(message: string, fields?:
|
|
398
|
-
error(error: Error | string, fields?:
|
|
399
|
-
getContext():
|
|
400
|
-
emitNow(overrides?:
|
|
397
|
+
info(message: string, fields?: UnknownRecord): void;
|
|
398
|
+
warn(message: string, fields?: UnknownRecord): void;
|
|
399
|
+
error(error: Error | string, fields?: UnknownRecord): void;
|
|
400
|
+
getContext(): UnknownRecord;
|
|
401
|
+
emitNow(overrides?: UnknownRecord): RequestLogSnapshot;
|
|
401
402
|
fork(label: string, fn: () => void | Promise<void>, options?: ForkOptions): void;
|
|
402
403
|
}
|
|
403
404
|
type RequestLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
@@ -406,7 +407,7 @@ interface RequestLogSnapshot {
|
|
|
406
407
|
traceId: string;
|
|
407
408
|
spanId: string;
|
|
408
409
|
correlationId: string;
|
|
409
|
-
context:
|
|
410
|
+
context: UnknownRecord;
|
|
410
411
|
}
|
|
411
412
|
interface RequestLoggerOptions {
|
|
412
413
|
/** Callback invoked by emitNow() for manual fan-out. */
|
|
@@ -457,10 +458,10 @@ interface StructuredErrorInput {
|
|
|
457
458
|
code?: string | number;
|
|
458
459
|
status?: number;
|
|
459
460
|
cause?: unknown;
|
|
460
|
-
details?:
|
|
461
|
+
details?: UnknownRecord;
|
|
461
462
|
name?: string;
|
|
462
463
|
/** Backend-only context. Omitted from toJSON() and never serialized to clients. */
|
|
463
|
-
internal?:
|
|
464
|
+
internal?: UnknownRecord;
|
|
464
465
|
}
|
|
465
466
|
interface StructuredError extends Error {
|
|
466
467
|
why?: string;
|
|
@@ -468,16 +469,24 @@ interface StructuredError extends Error {
|
|
|
468
469
|
link?: string;
|
|
469
470
|
code?: string | number;
|
|
470
471
|
status?: number;
|
|
471
|
-
details?:
|
|
472
|
+
details?: UnknownRecord;
|
|
472
473
|
/** Backend-only context. Omitted from toJSON() and never serialized to clients. */
|
|
473
|
-
readonly internal?:
|
|
474
|
+
readonly internal?: UnknownRecord;
|
|
474
475
|
}
|
|
475
476
|
declare function createStructuredError(input: StructuredErrorInput): StructuredError;
|
|
476
|
-
declare function structuredErrorToJSON(error: StructuredError):
|
|
477
|
-
|
|
477
|
+
declare function structuredErrorToJSON(error: StructuredError): UnknownRecord;
|
|
478
|
+
/** The `error.*` attributes a failure contributes to a span. */
|
|
479
|
+
type ErrorAttributes = Record<string, AttributeValue$2>;
|
|
480
|
+
declare function getStructuredErrorAttributes(error: Error): ErrorAttributes;
|
|
478
481
|
declare function recordStructuredError(ctx: Pick<TraceContext$1, 'setAttributes' | 'setStatus'>, error: Error): void;
|
|
479
482
|
//#endregion
|
|
480
483
|
//#region src/error-catalog.d.ts
|
|
484
|
+
/**
|
|
485
|
+
* Structured fields attached to a log line or an error. They are serialized by
|
|
486
|
+
* whatever sink receives them, so a value that cannot survive JSON has no
|
|
487
|
+
* meaning here - which is what EventAttributeValue names.
|
|
488
|
+
*/
|
|
489
|
+
type LogFields = Record<string, EventAttributeValue>;
|
|
481
490
|
/** Definition of a single error in a catalog. */
|
|
482
491
|
interface ErrorCatalogEntry {
|
|
483
492
|
/**
|
|
@@ -501,9 +510,9 @@ interface ErrorCatalogEntry {
|
|
|
501
510
|
/** Per-call options passed alongside (or instead of) typed params. */
|
|
502
511
|
interface ErrorBuildOptions {
|
|
503
512
|
cause?: unknown;
|
|
504
|
-
details?:
|
|
513
|
+
details?: LogFields;
|
|
505
514
|
/** Backend-only context. Never serialized to clients. */
|
|
506
|
-
internal?:
|
|
515
|
+
internal?: LogFields;
|
|
507
516
|
}
|
|
508
517
|
type ParamsOf<E> = E extends {
|
|
509
518
|
message: (params: infer P) => string;
|
|
@@ -563,15 +572,21 @@ declare function defineAuditCatalog<const T extends Record<string, AuditCatalogE
|
|
|
563
572
|
//#endregion
|
|
564
573
|
//#region src/flatten-attributes.d.ts
|
|
565
574
|
/**
|
|
566
|
-
* Convert
|
|
567
|
-
* Returns undefined when the value cannot be represented
|
|
575
|
+
* Convert a value that arrived from outside to an OTel-compatible
|
|
576
|
+
* AttributeValue. Returns undefined when the value cannot be represented -
|
|
577
|
+
* which is how flattenToAttributes below learns it has an object to descend
|
|
578
|
+
* into rather than a leaf to record.
|
|
568
579
|
*/
|
|
569
580
|
declare function toAttributeValue(value: unknown): AttributeValue$2 | undefined;
|
|
581
|
+
/** A flat, dot-notation attribute bag: what a nested object flattens to. */
|
|
582
|
+
interface FlatAttributes {
|
|
583
|
+
[key: string]: AttributeValue$2;
|
|
584
|
+
}
|
|
570
585
|
/**
|
|
571
586
|
* Recursively flatten a nested object into dot-notation OTel attributes.
|
|
572
587
|
* Includes circular reference protection via WeakSet.
|
|
573
588
|
*/
|
|
574
|
-
declare function flattenToAttributes(fields:
|
|
589
|
+
declare function flattenToAttributes(fields: UnknownRecord, prefix?: string): FlatAttributes;
|
|
575
590
|
//#endregion
|
|
576
591
|
//#region src/drain-toolkit.d.ts
|
|
577
592
|
interface DrainOptions<TContext, TConfig, TPayload = TContext> {
|
|
@@ -600,7 +615,7 @@ declare function defineDrain<TContext, TConfig, TPayload = TContext>(options: Dr
|
|
|
600
615
|
declare function defineHttpDrain<TContext, TConfig, TPayload = TContext>(options: HttpDrainOptions<TContext, TConfig, TPayload>): (ctx: TContext | TContext[]) => Promise<void>;
|
|
601
616
|
//#endregion
|
|
602
617
|
//#region src/enricher-toolkit.d.ts
|
|
603
|
-
interface EnrichContext<TEvent extends
|
|
618
|
+
interface EnrichContext<TEvent extends UnknownRecord> {
|
|
604
619
|
event: TEvent;
|
|
605
620
|
request?: {
|
|
606
621
|
method?: string;
|
|
@@ -612,7 +627,7 @@ interface EnrichContext<TEvent extends Record<string, unknown>> {
|
|
|
612
627
|
};
|
|
613
628
|
headers?: Record<string, string>;
|
|
614
629
|
}
|
|
615
|
-
interface EnricherDefinition<TEvent extends
|
|
630
|
+
interface EnricherDefinition<TEvent extends UnknownRecord, TValue extends object> {
|
|
616
631
|
/** Stable identifier used in error logs. */
|
|
617
632
|
name: string;
|
|
618
633
|
/** Top-level field to merge computed values into. */
|
|
@@ -624,7 +639,7 @@ interface EnricherOptions {
|
|
|
624
639
|
/** Replace existing field value instead of merge. Default false. */
|
|
625
640
|
overwrite?: boolean;
|
|
626
641
|
}
|
|
627
|
-
declare function defineEnricher<TEvent extends
|
|
642
|
+
declare function defineEnricher<TEvent extends UnknownRecord, TValue extends object>(def: EnricherDefinition<TEvent, TValue>, options?: EnricherOptions): (ctx: EnrichContext<TEvent>) => void;
|
|
628
643
|
//#endregion
|
|
629
644
|
//#region src/pretty-log-formatter.d.ts
|
|
630
645
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import { g as nonEmptyString, i as asNumber, l as asString, r as asFunction, s as asRecord, x as toError } from "./values-BenyvWKz.js";
|
|
1
2
|
import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
|
|
2
3
|
import { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, extractLinksFromBatch, resolveSamplingPreset, samplingPresets } from "./sampling.js";
|
|
3
|
-
import { A as
|
|
4
|
+
import { A as createStringRedactor, C as setCorrelationId, E as defineBaggageSchema, S as runWithCorrelationId, T as createTraceContext, _ as CORRELATION_ID_BAGGAGE_KEY, a as isInitialized, c as flush, d as getEvents, f as resetEvents, g as track, h as getEventQueue, i as init, j as BaggageSpanProcessor, l as shutdown, m as runInOperationContext, o as isLoggerLocked, p as getOperationContext, s as lockLogger, u as Event, v as generateCorrelationId, w as setCorrelationIdInBaggage, x as getOrCreateCorrelationId, y as getCorrelationId } from "./init-JtX-KKz_.js";
|
|
4
5
|
import { FilteringSpanProcessor } from "./filtering-span-processor.js";
|
|
5
6
|
import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
6
7
|
import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
7
|
-
import { n as formatDuration } from "./canonical-log-line-processor-
|
|
8
|
-
import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-
|
|
8
|
+
import { n as formatDuration } from "./canonical-log-line-processor-hFUmS__K.js";
|
|
9
|
+
import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-YIuka-FE.js";
|
|
9
10
|
import { Metric, getMetrics, resetMetrics } from "./metric.js";
|
|
10
11
|
import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
|
|
11
|
-
import { a as trace$2, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-
|
|
12
|
-
import { t as hashJson } from "./stable-hash-
|
|
13
|
-
import { t as emitCorrelatedEvent } from "./correlated-events-
|
|
12
|
+
import { a as trace$2, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-uSbNnnxK.js";
|
|
13
|
+
import { t as hashJson } from "./stable-hash-BkoAYVks.js";
|
|
14
|
+
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
14
15
|
import { parseError } from "./parse-error.js";
|
|
15
16
|
import { createDrainPipeline } from "./drain-pipeline.js";
|
|
16
17
|
import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js";
|
|
17
18
|
import { traceDB, traceHTTP, traceMessaging } from "./semantic-helpers.js";
|
|
18
19
|
import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-DVSmWg6Y.js";
|
|
19
20
|
import { httpRequestHeaderAttribute, httpResponseHeaderAttribute } from "./semantic-conventions.js";
|
|
20
|
-
import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-
|
|
21
|
+
import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-Dt4YUYbP.js";
|
|
21
22
|
import { traceConsumer, traceProducer } from "./messaging.js";
|
|
22
23
|
import { BusinessBaggage, createSafeBaggageSchema } from "./business-baggage.js";
|
|
23
24
|
import { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js";
|
|
@@ -83,7 +84,9 @@ function mergeInto$1(target, source) {
|
|
|
83
84
|
const sourceVal = source[key];
|
|
84
85
|
if (sourceVal === void 0) continue;
|
|
85
86
|
const targetVal = target[key];
|
|
86
|
-
|
|
87
|
+
const sourceRecord = asRecord(sourceVal);
|
|
88
|
+
const targetRecord = asRecord(targetVal);
|
|
89
|
+
if (sourceRecord && targetRecord) mergeInto$1(targetRecord, sourceRecord);
|
|
87
90
|
else if (Array.isArray(targetVal) && Array.isArray(sourceVal)) target[key] = [...targetVal, ...sourceVal];
|
|
88
91
|
else target[key] = sourceVal;
|
|
89
92
|
}
|
|
@@ -154,7 +157,7 @@ function getRequestLogger(ctx, options) {
|
|
|
154
157
|
const keys = fields ? [...Object.keys(fields), "error"] : ["error"];
|
|
155
158
|
sealCheck("log.error()", keys);
|
|
156
159
|
if (emitted) return;
|
|
157
|
-
const err =
|
|
160
|
+
const err = toError(error);
|
|
158
161
|
recordStructuredError(activeContext, err);
|
|
159
162
|
addLogEvent("error", err.message, fields);
|
|
160
163
|
if (fields) {
|
|
@@ -193,8 +196,8 @@ function getRequestLogger(ctx, options) {
|
|
|
193
196
|
return snapshot;
|
|
194
197
|
},
|
|
195
198
|
fork(label, fn, forkOptions) {
|
|
196
|
-
const parentRequestId = activeContext.correlationId;
|
|
197
|
-
if (
|
|
199
|
+
const parentRequestId = nonEmptyString(activeContext.correlationId);
|
|
200
|
+
if (parentRequestId === void 0) throw new Error("[autotel] log.fork() requires the parent logger to have a correlationId. Ensure the request was created by autotel middleware.");
|
|
198
201
|
const tracer = trace$1.getTracer("autotel.request-logger");
|
|
199
202
|
const lifecycle = forkOptions?.lifecycle;
|
|
200
203
|
tracer.startActiveSpan(`request.fork:${label}`, (childSpan) => {
|
|
@@ -212,8 +215,7 @@ function getRequestLogger(ctx, options) {
|
|
|
212
215
|
Promise.resolve().then(() => fn()).then(() => {
|
|
213
216
|
childLog.emitNow();
|
|
214
217
|
}).catch((error_) => {
|
|
215
|
-
|
|
216
|
-
childLog.error(error);
|
|
218
|
+
childLog.error(toError(error_));
|
|
217
219
|
childLog.emitNow();
|
|
218
220
|
}).finally(() => {
|
|
219
221
|
try {
|
|
@@ -316,8 +318,9 @@ function createNoopRequestLogger() {
|
|
|
316
318
|
*/
|
|
317
319
|
const catalogCodeKey = Symbol.for("autotel.catalog.code");
|
|
318
320
|
function readCatalogCode(error) {
|
|
319
|
-
if (error
|
|
320
|
-
|
|
321
|
+
if (!asRecord(error)) return void 0;
|
|
322
|
+
const stored = error[catalogCodeKey];
|
|
323
|
+
return asString(stored) ?? asNumber(stored);
|
|
321
324
|
}
|
|
322
325
|
/** True when `error` was produced by any autotel error catalog. */
|
|
323
326
|
function isCatalogError(error) {
|
|
@@ -336,23 +339,25 @@ function defineErrorCatalog(namespace, entries) {
|
|
|
336
339
|
const catalog = {};
|
|
337
340
|
for (const [key, entry] of Object.entries(entries)) {
|
|
338
341
|
const code = entry.code ?? `${namespace}.${key}`;
|
|
339
|
-
const
|
|
342
|
+
const messageFor = asFunction(entry.message);
|
|
343
|
+
const whyFor = asFunction(entry.why);
|
|
344
|
+
const usesParams = Boolean(messageFor || whyFor);
|
|
340
345
|
const builder = ((paramsOrOptions, maybeOptions) => {
|
|
341
346
|
const params = usesParams ? paramsOrOptions : void 0;
|
|
342
347
|
const options = usesParams ? maybeOptions : paramsOrOptions;
|
|
343
|
-
const message =
|
|
344
|
-
const why =
|
|
348
|
+
const message = messageFor ? String(messageFor(params)) : asString(entry.message) ?? "";
|
|
349
|
+
const why = whyFor ? String(whyFor(params)) : asString(entry.why);
|
|
345
350
|
const error = createStructuredError({
|
|
346
351
|
message,
|
|
347
352
|
name: entry.name ?? key,
|
|
348
353
|
code,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
status: entry.status,
|
|
355
|
+
why,
|
|
356
|
+
fix: entry.fix,
|
|
357
|
+
link: entry.link,
|
|
358
|
+
cause: options?.cause,
|
|
359
|
+
details: options?.details,
|
|
360
|
+
internal: options?.internal
|
|
356
361
|
});
|
|
357
362
|
Object.defineProperty(error, catalogCodeKey, {
|
|
358
363
|
value: code,
|
|
@@ -383,12 +388,13 @@ function defineAuditCatalog(namespace, entries) {
|
|
|
383
388
|
for (const [key, entry] of Object.entries(entries)) {
|
|
384
389
|
const action = entry.action ?? `${namespace}.${key}`;
|
|
385
390
|
const severity = entry.severity ?? "info";
|
|
391
|
+
const auditMessageFor = asFunction(entry.message);
|
|
386
392
|
const descriptor = ((params) => {
|
|
387
|
-
const message =
|
|
393
|
+
const message = auditMessageFor ? String(auditMessageFor(params)) : asString(entry.message);
|
|
388
394
|
return Object.freeze({
|
|
389
395
|
action,
|
|
390
396
|
severity,
|
|
391
|
-
|
|
397
|
+
message
|
|
392
398
|
});
|
|
393
399
|
});
|
|
394
400
|
Object.defineProperty(descriptor, "action", {
|
|
@@ -476,15 +482,13 @@ function defineHttpDrain(options) {
|
|
|
476
482
|
|
|
477
483
|
//#endregion
|
|
478
484
|
//#region src/enricher-toolkit.ts
|
|
479
|
-
function isPlainObject(value) {
|
|
480
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
481
|
-
}
|
|
482
485
|
function mergeInto(target, source) {
|
|
483
486
|
for (const key in source) {
|
|
484
487
|
const sourceVal = source[key];
|
|
485
488
|
if (sourceVal === void 0) continue;
|
|
486
|
-
const
|
|
487
|
-
|
|
489
|
+
const sourceRecord = asRecord(sourceVal);
|
|
490
|
+
const targetRecord = asRecord(target[key]);
|
|
491
|
+
if (sourceRecord && targetRecord) mergeInto(targetRecord, sourceRecord);
|
|
488
492
|
else target[key] = sourceVal;
|
|
489
493
|
}
|
|
490
494
|
}
|
|
@@ -498,11 +502,13 @@ function defineEnricher(def, options = {}) {
|
|
|
498
502
|
return;
|
|
499
503
|
}
|
|
500
504
|
if (!computed) return;
|
|
501
|
-
|
|
502
|
-
|
|
505
|
+
const event = ctx.event;
|
|
506
|
+
const existing = asRecord(event[def.field]);
|
|
507
|
+
if (options.overwrite || !existing) {
|
|
508
|
+
event[def.field] = computed;
|
|
503
509
|
return;
|
|
504
510
|
}
|
|
505
|
-
mergeInto(
|
|
511
|
+
mergeInto(existing, computed);
|
|
506
512
|
};
|
|
507
513
|
}
|
|
508
514
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-
|
|
2
|
-
import { s as Logger } from "./logger-
|
|
3
|
-
import { h as SamplingPreset, p as Sampler } from "./sampling-
|
|
4
|
-
import {
|
|
1
|
+
import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-CvBE0z1p.js";
|
|
2
|
+
import { s as Logger } from "./logger-S1Fgl0g3.js";
|
|
3
|
+
import { h as SamplingPreset, p as Sampler } from "./sampling-CM5S2Lp3.js";
|
|
4
|
+
import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.js";
|
|
5
5
|
import { r as SpanFilterPredicate } from "./filtering-span-processor-BpDagWNa.js";
|
|
6
6
|
import { r as Policy } from "./policy-CbpP4tFH.js";
|
|
7
7
|
import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.js";
|
|
8
|
-
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
8
|
+
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-cPB4Axk-.js";
|
|
9
9
|
import { NodeSDK, NodeSDKConfiguration } from "@opentelemetry/sdk-node";
|
|
10
10
|
import { ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
11
11
|
import { Resource } from "@opentelemetry/resources";
|
|
@@ -1233,7 +1233,7 @@ declare function isLoggerLocked(): boolean;
|
|
|
1233
1233
|
*
|
|
1234
1234
|
* @example With events (observe in PostHog, Mixpanel, etc.)
|
|
1235
1235
|
* ```typescript
|
|
1236
|
-
* import { PostHogSubscriber } from 'autotel-
|
|
1236
|
+
* import { PostHogSubscriber } from 'autotel-posthog/subscriber';
|
|
1237
1237
|
*
|
|
1238
1238
|
* init({
|
|
1239
1239
|
* service: 'my-app',
|