autotel 7.9.0 → 7.10.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 +16 -0
- package/dist/analysis.cjs +1 -1
- package/dist/analysis.d.cts +6 -7
- package/dist/analysis.d.ts +6 -7
- package/dist/analysis.js +1 -1
- package/dist/attributes.d.cts +1 -1
- package/dist/attributes.d.ts +1 -1
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/business-baggage.d.cts +12 -13
- package/dist/business-baggage.d.ts +12 -13
- package/dist/{canonical-log-line-processor-Bwrt_L4c.d.ts → canonical-log-line-processor-DDGzm-wi.d.ts} +1 -1
- package/dist/{canonical-log-line-processor-C0Z_N4oL.d.cts → canonical-log-line-processor-DLeAQjgb.d.cts} +1 -1
- package/dist/channel-BobQKsZd.js +64 -0
- package/dist/channel-D0eaVqn3.cjs +81 -0
- package/dist/config.d.cts +7 -7
- package/dist/config.d.ts +7 -7
- package/dist/correlation-id.cjs +1 -1
- package/dist/correlation-id.d.cts +9 -10
- package/dist/correlation-id.d.ts +9 -10
- package/dist/correlation-id.js +1 -1
- package/dist/db.d.cts +18 -19
- package/dist/db.d.ts +18 -19
- package/dist/decorators.cjs +1 -1
- package/dist/decorators.d.cts +7 -7
- package/dist/decorators.d.ts +7 -7
- package/dist/decorators.js +1 -1
- package/dist/diagnostics.cjs +10 -70
- package/dist/diagnostics.d.cts +6 -6
- package/dist/diagnostics.d.ts +6 -6
- package/dist/diagnostics.js +1 -61
- package/dist/drain-pipeline.d.cts +4 -5
- package/dist/drain-pipeline.d.ts +4 -5
- package/dist/enrichers.d.cts +7 -8
- package/dist/enrichers.d.ts +7 -8
- package/dist/event.cjs +1 -1
- package/dist/event.d.cts +6 -6
- package/dist/event.d.ts +6 -6
- package/dist/event.js +1 -1
- package/dist/evidence.d.cts +13 -14
- package/dist/evidence.d.ts +13 -14
- package/dist/exception-fingerprint.d.cts +10 -11
- package/dist/exception-fingerprint.d.ts +10 -11
- package/dist/exporters.d.cts +2 -2
- package/dist/exporters.d.ts +2 -2
- package/dist/feature-flags.d.cts +23 -24
- package/dist/feature-flags.d.ts +23 -24
- package/dist/{filtering-span-processor-vkewzbqB.d.ts → filtering-span-processor-BDGe1myy.d.ts} +1 -1
- package/dist/{filtering-span-processor-BpDagWNa.d.cts → filtering-span-processor-BYvLMiNz.d.cts} +1 -1
- package/dist/filtering-span-processor.cjs +3 -3
- package/dist/filtering-span-processor.d.cts +1 -1
- package/dist/filtering-span-processor.d.ts +1 -1
- package/dist/filtering-span-processor.js +3 -3
- package/dist/{functional-6QPJDqUW.js → functional-C4gGiBou.js} +14 -9
- package/dist/{functional-SeRUabkE.d.ts → functional-CbcInXMJ.d.ts} +1 -1
- package/dist/{functional-DxHvvWc_.cjs → functional-DptEM9La.cjs} +14 -9
- package/dist/{functional-DPZTpGh6.d.cts → functional-j8Joyrwd.d.cts} +1 -1
- package/dist/functional.cjs +1 -1
- package/dist/functional.d.cts +1 -1
- package/dist/functional.d.ts +1 -1
- package/dist/functional.js +1 -1
- package/dist/http.cjs +1 -1
- package/dist/http.d.cts +6 -7
- package/dist/http.d.ts +6 -7
- package/dist/http.js +1 -1
- package/dist/{index-B9aRLp6c.d.ts → index-DAH41w0W.d.ts} +4 -4
- package/dist/{index-8bFU4kmd.d.cts → index-DVPsz3DK.d.cts} +4 -4
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +38 -38
- package/dist/index.d.ts +38 -38
- package/dist/index.js +4 -4
- package/dist/{init-CnoRlJqS.d.ts → init-Biyby8Br.d.ts} +21 -5
- package/dist/{init-C-qfxo_u.js → init-BvUtwZNx.js} +104 -14
- package/dist/{init-COfMwKbc.d.cts → init-CHanKvOq.d.cts} +21 -5
- package/dist/{init-W_klPrYk.cjs → init-Cx1-ejLn.cjs} +108 -17
- package/dist/instrumentation.cjs +1 -1
- package/dist/instrumentation.d.cts +4 -5
- package/dist/instrumentation.d.ts +4 -5
- package/dist/instrumentation.js +1 -1
- package/dist/{logger-S1Fgl0g3.d.cts → logger-C9UT1aZ_.d.cts} +4 -4
- package/dist/{logger-S1Fgl0g3.d.ts → logger-C9UT1aZ_.d.ts} +4 -4
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/messaging-adapters.d.cts +10 -11
- package/dist/messaging-adapters.d.ts +10 -11
- package/dist/messaging-testing.d.cts +19 -20
- package/dist/messaging-testing.d.ts +19 -20
- package/dist/messaging.cjs +2 -2
- package/dist/messaging.d.cts +23 -24
- package/dist/messaging.d.ts +23 -24
- package/dist/messaging.js +2 -2
- package/dist/metric-helpers.d.cts +6 -7
- package/dist/metric-helpers.d.ts +6 -7
- package/dist/metric.d.cts +7 -7
- package/dist/metric.d.ts +7 -7
- package/dist/parse-error.d.cts +3 -4
- package/dist/parse-error.d.ts +3 -4
- package/dist/policy.cjs +0 -0
- package/dist/policy.js +0 -0
- package/dist/processors.d.cts +1 -1
- package/dist/processors.d.ts +1 -1
- package/dist/{sampling-CZi7OM9u.d.ts → sampling-B_8orhSB.d.ts} +1 -1
- package/dist/{sampling-DENUjT_8.d.cts → sampling-Dud4XU2m.d.cts} +1 -1
- package/dist/sampling.cjs +1 -1
- package/dist/sampling.d.cts +1 -1
- package/dist/sampling.d.ts +1 -1
- package/dist/sampling.js +1 -1
- package/dist/security-schema.d.cts +30 -31
- package/dist/security-schema.d.ts +30 -31
- package/dist/semantic-conventions-yG0X2AsN.d.cts +31 -0
- package/dist/semantic-conventions-yG0X2AsN.d.ts +31 -0
- package/dist/semantic-conventions.d.cts +1 -1
- package/dist/semantic-conventions.d.ts +1 -1
- package/dist/semantic-helpers.cjs +1 -1
- package/dist/semantic-helpers.d.cts +10 -11
- package/dist/semantic-helpers.d.ts +10 -11
- package/dist/semantic-helpers.js +1 -1
- package/dist/slo.d.cts +12 -13
- package/dist/slo.d.ts +12 -13
- package/dist/tail-sampling-processor.cjs +1 -1
- package/dist/tail-sampling-processor.d.cts +2 -3
- package/dist/tail-sampling-processor.d.ts +2 -3
- package/dist/tail-sampling-processor.js +1 -1
- package/dist/test-span-collector.d.cts +4 -5
- package/dist/test-span-collector.d.ts +4 -5
- package/dist/testing.d.cts +18 -18
- package/dist/testing.d.ts +18 -18
- package/dist/trace-helpers.d.cts +15 -16
- package/dist/trace-helpers.d.ts +15 -16
- package/dist/tracer-provider.cjs +21 -1
- package/dist/tracer-provider.d.cts +16 -6
- package/dist/tracer-provider.d.ts +16 -6
- package/dist/tracer-provider.js +22 -3
- package/dist/validate.cjs +8 -7
- package/dist/validate.d.cts +12 -12
- package/dist/validate.d.ts +12 -12
- package/dist/validate.js +8 -7
- package/dist/validation-attributes.d.cts +14 -15
- package/dist/validation-attributes.d.ts +14 -15
- package/dist/webhook.cjs +1 -1
- package/dist/webhook.d.cts +11 -12
- package/dist/webhook.d.ts +11 -12
- package/dist/webhook.js +1 -1
- package/dist/workflow-distributed.cjs +1 -1
- package/dist/workflow-distributed.d.cts +26 -27
- package/dist/workflow-distributed.d.ts +26 -27
- package/dist/workflow-distributed.js +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.cts +11 -12
- package/dist/workflow.d.ts +11 -12
- package/dist/workflow.js +1 -1
- package/dist/yaml-config.cjs +1 -1
- package/dist/yaml-config.d.cts +9 -10
- package/dist/yaml-config.d.ts +9 -10
- package/dist/yaml-config.js +1 -1
- package/package.json +15 -21
- package/dist/semantic-conventions-FhSxv-bK.d.cts +0 -31
- package/dist/semantic-conventions-FhSxv-bK.d.ts +0 -31
|
@@ -9,6 +9,7 @@ import { SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
|
9
9
|
import { AttributeRedactingProcessor, REDACTOR_PRESETS, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
10
10
|
import { t as PrettyConsoleExporter } from "./pretty-console-exporter-DqKl_q9z.js";
|
|
11
11
|
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-BQ6NeZAk.js";
|
|
12
|
+
import { n as subscribeChannel } from "./channel-BobQKsZd.js";
|
|
12
13
|
import { resetMetrics } from "./metric.js";
|
|
13
14
|
import { DiagConsoleLogger, DiagLogLevel, TraceFlags, context, createContextKey, diag, metrics, propagation, trace } from "@opentelemetry/api";
|
|
14
15
|
import { logs } from "@opentelemetry/api-logs";
|
|
@@ -24,7 +25,7 @@ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic
|
|
|
24
25
|
import * as nodeAsyncHooks from "node:async_hooks";
|
|
25
26
|
import * as nodeFs from "node:fs";
|
|
26
27
|
import path from "node:path";
|
|
27
|
-
import
|
|
28
|
+
import * as os from "node:os";
|
|
28
29
|
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
29
30
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
30
31
|
|
|
@@ -1074,10 +1075,10 @@ function resetEventQueue() {
|
|
|
1074
1075
|
|
|
1075
1076
|
//#endregion
|
|
1076
1077
|
//#region src/trace-context.ts
|
|
1077
|
-
const
|
|
1078
|
-
/**
|
|
1079
|
-
function
|
|
1080
|
-
return
|
|
1078
|
+
const explicitSpanStatuses = /* @__PURE__ */ new WeakMap();
|
|
1079
|
+
/** The status a TraceContext consumer explicitly chose for this span, if any. */
|
|
1080
|
+
function explicitSpanStatus(span) {
|
|
1081
|
+
return explicitSpanStatuses.get(span);
|
|
1081
1082
|
}
|
|
1082
1083
|
/**
|
|
1083
1084
|
* AsyncLocalStorage for storing the active context with baggage
|
|
@@ -1165,7 +1166,7 @@ function createTraceContext(span) {
|
|
|
1165
1166
|
span.setAttributes(flattenToAttributes(attrs));
|
|
1166
1167
|
},
|
|
1167
1168
|
setStatus: (status) => {
|
|
1168
|
-
|
|
1169
|
+
explicitSpanStatuses.set(span, status.code);
|
|
1169
1170
|
span.setStatus(status);
|
|
1170
1171
|
},
|
|
1171
1172
|
recordException: span.recordException.bind(span),
|
|
@@ -2399,7 +2400,7 @@ function substituteEnvVars(value) {
|
|
|
2399
2400
|
* @returns Object with all string values having env vars substituted
|
|
2400
2401
|
*/
|
|
2401
2402
|
function substituteEnvVarsDeep(value) {
|
|
2402
|
-
if (Array.isArray(value)) return value.map(substituteEnvVarsDeep);
|
|
2403
|
+
if (Array.isArray(value)) return value.map((item) => substituteEnvVarsDeep(item));
|
|
2403
2404
|
const mapping = asYamlMapping(value);
|
|
2404
2405
|
if (mapping) {
|
|
2405
2406
|
const result = {};
|
|
@@ -2631,7 +2632,7 @@ const DEFAULT_SHUTDOWN_TIMEOUT_MS = 2e3;
|
|
|
2631
2632
|
function runShutdownOnce(shutdown, timeoutMs) {
|
|
2632
2633
|
if (shutdownInFlight) return shutdownInFlight;
|
|
2633
2634
|
let timeoutHandle;
|
|
2634
|
-
const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() =>
|
|
2635
|
+
const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() => {});
|
|
2635
2636
|
const timeout = new Promise((resolve) => {
|
|
2636
2637
|
timeoutHandle = setTimeout(resolve, timeoutMs);
|
|
2637
2638
|
timeoutHandle.unref();
|
|
@@ -2643,7 +2644,7 @@ function runShutdownOnce(shutdown, timeoutMs) {
|
|
|
2643
2644
|
}
|
|
2644
2645
|
const DEFAULT_SIGNALS = ["SIGTERM", "SIGINT"];
|
|
2645
2646
|
function signalExitCode(signal) {
|
|
2646
|
-
return 128 + constants.signals[signal];
|
|
2647
|
+
return 128 + os.constants.signals[signal];
|
|
2647
2648
|
}
|
|
2648
2649
|
/**
|
|
2649
2650
|
* Surface a fatal error before shutting down.
|
|
@@ -2724,7 +2725,7 @@ function installExitFlush(flushTelemetry, timeoutMs = DEFAULT_SHUTDOWN_TIMEOUT_M
|
|
|
2724
2725
|
const deadline = setTimeout(() => {
|
|
2725
2726
|
process.exit(process.exitCode ?? code);
|
|
2726
2727
|
}, timeoutMs);
|
|
2727
|
-
exitFlushInFlight = flushTelemetry().catch(() =>
|
|
2728
|
+
exitFlushInFlight = flushTelemetry().catch(() => {}).finally(() => {
|
|
2728
2729
|
clearTimeout(deadline);
|
|
2729
2730
|
});
|
|
2730
2731
|
};
|
|
@@ -2742,6 +2743,91 @@ function uninstallProcessHandlers() {
|
|
|
2742
2743
|
exitFlushInFlight = void 0;
|
|
2743
2744
|
}
|
|
2744
2745
|
|
|
2746
|
+
//#endregion
|
|
2747
|
+
//#region src/console-signals.ts
|
|
2748
|
+
/**
|
|
2749
|
+
* Console-derived error signals, recorded on the active span.
|
|
2750
|
+
*
|
|
2751
|
+
* - `console.error(...)` inside a span records an exception on that span
|
|
2752
|
+
* without touching its status: the code handled the error, but it still
|
|
2753
|
+
* belongs to the request's issue list.
|
|
2754
|
+
* - One log template repeated past a threshold within one trace (logging
|
|
2755
|
+
* inside a loop) records a single `autotel.LogFlood` exception.
|
|
2756
|
+
*
|
|
2757
|
+
* Listens on Node's `console.*` diagnostics channels, so `console` is never
|
|
2758
|
+
* patched and the original output is untouched. Installed once by `init()`.
|
|
2759
|
+
* Mirrors `autotel-edge/src/core/console-signals.ts`, which patches `console`
|
|
2760
|
+
* because edge runtimes have no such channel.
|
|
2761
|
+
*/
|
|
2762
|
+
/** `exception.type` of the logging-in-a-loop signal. */
|
|
2763
|
+
const LOG_FLOOD_EXCEPTION = "autotel.LogFlood";
|
|
2764
|
+
const MAX_MESSAGE_LENGTH = 500;
|
|
2765
|
+
const MAX_TEMPLATE_LENGTH = 120;
|
|
2766
|
+
const MAX_INVOCATIONS = 256;
|
|
2767
|
+
const MAX_TEMPLATES = 256;
|
|
2768
|
+
const LEVELS = [
|
|
2769
|
+
"log",
|
|
2770
|
+
"info",
|
|
2771
|
+
"warn",
|
|
2772
|
+
"error",
|
|
2773
|
+
"debug"
|
|
2774
|
+
];
|
|
2775
|
+
const invocations = /* @__PURE__ */ new Map();
|
|
2776
|
+
let options = {
|
|
2777
|
+
captureConsoleErrors: true,
|
|
2778
|
+
logFloodThreshold: 100
|
|
2779
|
+
};
|
|
2780
|
+
let installed = false;
|
|
2781
|
+
let busy = false;
|
|
2782
|
+
const nodeUtil = safeRequire("node:util");
|
|
2783
|
+
/** Collapse ids and numbers so one loop's lines share a template. */
|
|
2784
|
+
function logTemplate(args) {
|
|
2785
|
+
return args.map((arg) => typeof arg === "string" ? arg.slice(0, 200) : arg instanceof Error ? arg.name : `<${typeof arg}>`).join(" ").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]*\d)[0-9a-f]{8,}\b/gi, "<hex>").replaceAll(/\d+/g, "<n>");
|
|
2786
|
+
}
|
|
2787
|
+
function countLogLine(key, template, threshold) {
|
|
2788
|
+
let templates = invocations.get(key);
|
|
2789
|
+
if (!templates) {
|
|
2790
|
+
if (invocations.size >= MAX_INVOCATIONS) invocations.delete(invocations.keys().next().value);
|
|
2791
|
+
templates = /* @__PURE__ */ new Map();
|
|
2792
|
+
invocations.set(key, templates);
|
|
2793
|
+
}
|
|
2794
|
+
const count = (templates.get(template) ?? 0) + 1;
|
|
2795
|
+
if (count > 1 || templates.size < MAX_TEMPLATES) templates.set(template, count);
|
|
2796
|
+
return count === threshold + 1;
|
|
2797
|
+
}
|
|
2798
|
+
function onConsole(level, args) {
|
|
2799
|
+
if (busy) return;
|
|
2800
|
+
if (typeof args[0] === "string" && args[0].startsWith("[autotel")) return;
|
|
2801
|
+
const captureError = level === "error" && options.captureConsoleErrors;
|
|
2802
|
+
const threshold = options.logFloodThreshold;
|
|
2803
|
+
if (!captureError && threshold <= 0) return;
|
|
2804
|
+
const span = trace.getActiveSpan();
|
|
2805
|
+
if (!span?.isRecording()) return;
|
|
2806
|
+
busy = true;
|
|
2807
|
+
try {
|
|
2808
|
+
if (captureError) span.recordException(args.find((a) => a instanceof Error) ?? (nodeUtil?.format(...args) ?? args.join(" ")).slice(0, MAX_MESSAGE_LENGTH));
|
|
2809
|
+
if (threshold > 0) {
|
|
2810
|
+
const template = logTemplate(args);
|
|
2811
|
+
if (countLogLine(span.spanContext().traceId, template, threshold)) span.recordException({
|
|
2812
|
+
name: LOG_FLOOD_EXCEPTION,
|
|
2813
|
+
message: `"${template.slice(0, MAX_TEMPLATE_LENGTH)}" logged ${threshold}+ times in one invocation`
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2816
|
+
} catch {} finally {
|
|
2817
|
+
busy = false;
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
/** Subscribe once; later calls only update the options. */
|
|
2821
|
+
function installConsoleSignals(next = {}) {
|
|
2822
|
+
options = {
|
|
2823
|
+
captureConsoleErrors: next.captureConsoleErrors ?? true,
|
|
2824
|
+
logFloodThreshold: next.logFloodThreshold ?? 100
|
|
2825
|
+
};
|
|
2826
|
+
if (installed) return;
|
|
2827
|
+
installed = true;
|
|
2828
|
+
for (const level of LEVELS) subscribeChannel(`console.${level}`, (message) => onConsole(level, Array.isArray(message) ? message : message?.args ?? []));
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2745
2831
|
//#endregion
|
|
2746
2832
|
//#region src/circuit-breaker.ts
|
|
2747
2833
|
const DEFAULT_CONFIG = {
|
|
@@ -4316,7 +4402,7 @@ function init(cfg) {
|
|
|
4316
4402
|
if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
|
|
4317
4403
|
if (mergedConfig.resourceAttributes) resource = resource.merge(resourceFromAttributes(mergedConfig.resourceAttributes));
|
|
4318
4404
|
const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
|
|
4319
|
-
const configuredSpanProcessors = mergedConfig.spanProcessors
|
|
4405
|
+
const configuredSpanProcessors = mergedConfig.spanProcessors === void 0 ? mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0 : mergedConfig.spanProcessors;
|
|
4320
4406
|
const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
|
|
4321
4407
|
const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
|
|
4322
4408
|
const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
|
|
@@ -4430,9 +4516,9 @@ function init(cfg) {
|
|
|
4430
4516
|
resource,
|
|
4431
4517
|
serviceName: mergedConfig.service,
|
|
4432
4518
|
sampler,
|
|
4433
|
-
instrumentations: finalInstrumentations
|
|
4519
|
+
instrumentations: finalInstrumentations,
|
|
4520
|
+
spanProcessors: spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()]
|
|
4434
4521
|
};
|
|
4435
|
-
sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
|
|
4436
4522
|
if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
|
|
4437
4523
|
if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
|
|
4438
4524
|
else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
|
|
@@ -4453,6 +4539,10 @@ function init(cfg) {
|
|
|
4453
4539
|
} else logger.warn({}, "[autotel] OpenLLMetry enabled but @traceloop/node-server-sdk is not installed. Install it as a peer dependency to use OpenLLMetry integration.");
|
|
4454
4540
|
}
|
|
4455
4541
|
initialized = true;
|
|
4542
|
+
installConsoleSignals({
|
|
4543
|
+
captureConsoleErrors: mergedConfig.captureConsoleErrors,
|
|
4544
|
+
logFloodThreshold: mergedConfig.logFloodThreshold
|
|
4545
|
+
});
|
|
4456
4546
|
const processHandlers = mergedConfig.processHandlers;
|
|
4457
4547
|
const handlersConfig = processHandlers && processHandlers !== true ? processHandlers : {};
|
|
4458
4548
|
if (processHandlers) installProcessHandlers(handlersConfig, shutdown);
|
|
@@ -4533,4 +4623,4 @@ function getSdk() {
|
|
|
4533
4623
|
}
|
|
4534
4624
|
|
|
4535
4625
|
//#endregion
|
|
4536
|
-
export { generateCorrelationId as $, CompositeSampler as A, hashUnitInterval as B, TailSamplingSpanProcessor as C, AUTOTEL_SAMPLING_TAIL_KEEP as D, AUTOTEL_SAMPLING_TAIL_EVALUATED as E, RandomSampler as F, createTraceContext as G, markForceKept as H, UserIdSampler as I,
|
|
4626
|
+
export { generateCorrelationId as $, CompositeSampler as A, hashUnitInterval as B, TailSamplingSpanProcessor as C, AUTOTEL_SAMPLING_TAIL_KEEP as D, AUTOTEL_SAMPLING_TAIL_EVALUATED as E, RandomSampler as F, createTraceContext as G, markForceKept as H, UserIdSampler as I, getActiveContextWithBaggage as J, defineBaggageSchema as K, createLinkFromHeaders as L, FeatureFlagSampler as M, KeyTargetRateSampler as N, AdaptiveSampler as O, NeverSampler as P, CORRELATION_ID_BAGGAGE_KEY as Q, debugCaptureRequested as R, BaggageSpanProcessor as S, AUTOTEL_SAMPLING_RATE as T, resolveSamplingPreset as U, isForceKept as V, samplingPresets as W, getEventQueue as X, getContextStorage as Y, track as Z, loadYamlConfig as _, init as a, setCorrelationIdInBaggage as at, getRequestSpanIn as b, lockLogger as c, Event as d, getCorrelationId as et, getEvents as f, hasYamlConfig as g, runInOperationContext as h, getSdk as i, setCorrelationId as it, DeterministicSampler as j, AlwaysSampler as k, flush as l, getOperationContext as m, getConfiguredSampler as n, getOrCreateCorrelationId as nt, isInitialized as o, resetEvents as p, explicitSpanStatus as q, getLogger as r, runWithCorrelationId as rt, isLoggerLocked as s, getConfig as t, getCorrelationStorage as tt, shutdown as u, loadYamlConfigFromFile as v, AUTOTEL_DEBUG_BAGGAGE_KEY as w, rememberRequestAttributes as x, createStringRedactor as y, extractLinksFromBatch as z };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-CvBE0z1p.cjs";
|
|
2
|
-
import { s as Logger } from "./logger-
|
|
3
|
-
import { g as SamplingPreset, m as Sampler$1 } from "./sampling-
|
|
2
|
+
import { s as Logger } from "./logger-C9UT1aZ_.cjs";
|
|
3
|
+
import { g as SamplingPreset, m as Sampler$1 } from "./sampling-Dud4XU2m.cjs";
|
|
4
4
|
import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.cjs";
|
|
5
|
-
import { r as SpanFilterPredicate } from "./filtering-span-processor-
|
|
5
|
+
import { r as SpanFilterPredicate } from "./filtering-span-processor-BYvLMiNz.cjs";
|
|
6
6
|
import { r as Policy } from "./policy-C4QcZnqv.cjs";
|
|
7
7
|
import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.cjs";
|
|
8
|
-
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
8
|
+
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-DLeAQjgb.cjs";
|
|
9
9
|
import { BasicTracerProvider, ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
10
10
|
import { Attributes, Sampler, TextMapPropagator } from "@opentelemetry/api";
|
|
11
11
|
import { Resource, ResourceDetector } from "@opentelemetry/resources";
|
|
@@ -403,6 +403,20 @@ interface AutotelConfig {
|
|
|
403
403
|
* autotel added no listener.
|
|
404
404
|
*/
|
|
405
405
|
flushOnExit?: boolean;
|
|
406
|
+
/**
|
|
407
|
+
* Record `console.error(...)` calls made inside a span as an exception on
|
|
408
|
+
* that span, leaving its status alone (the error was handled). Read from
|
|
409
|
+
* Node's `console.*` diagnostics channels; `console` is never patched.
|
|
410
|
+
* Default: `true`.
|
|
411
|
+
*/
|
|
412
|
+
captureConsoleErrors?: boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Record one `autotel.LogFlood` exception on the active span when a single
|
|
415
|
+
* log template (digits, UUIDs and hex ids collapsed) is written more than
|
|
416
|
+
* this many times in one trace — logging inside a loop. Default: `100`;
|
|
417
|
+
* `0` disables.
|
|
418
|
+
*/
|
|
419
|
+
logFloodThreshold?: number;
|
|
406
420
|
/**
|
|
407
421
|
* Local developer UX for autotel-devtools.
|
|
408
422
|
*
|
|
@@ -905,7 +919,9 @@ interface AutotelConfig {
|
|
|
905
919
|
* - true: Flush on root span completion (default)
|
|
906
920
|
* - false: Use batching (events flush every 10 seconds automatically)
|
|
907
921
|
*
|
|
908
|
-
* Only flushes on root spans to avoid excessive network calls.
|
|
922
|
+
* Only flushes on root spans to avoid excessive network calls. A span whose
|
|
923
|
+
* parent arrived from another process (an extracted `traceparent`) counts as
|
|
924
|
+
* a root, so a server flushes once per incoming request.
|
|
909
925
|
* Default is true for serverless/short-lived processes. Set to false
|
|
910
926
|
* for long-running services where batching is more efficient.
|
|
911
927
|
*/
|
|
@@ -10,6 +10,7 @@ const require_span_name_normalizer = require('./span-name-normalizer.cjs');
|
|
|
10
10
|
const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
|
|
11
11
|
const require_pretty_console_exporter = require('./pretty-console-exporter-CMzlrRNg.cjs');
|
|
12
12
|
const require_canonical_log_line_processor = require('./canonical-log-line-processor-BU03jJeA.cjs');
|
|
13
|
+
const require_channel = require('./channel-D0eaVqn3.cjs');
|
|
13
14
|
const require_metric = require('./metric.cjs');
|
|
14
15
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
15
16
|
let _opentelemetry_api_logs = require("@opentelemetry/api-logs");
|
|
@@ -29,6 +30,7 @@ node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
|
29
30
|
let node_path = require("node:path");
|
|
30
31
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
31
32
|
let node_os = require("node:os");
|
|
33
|
+
node_os = require_rolldown_runtime.__toESM(node_os, 1);
|
|
32
34
|
let _opentelemetry_exporter_metrics_otlp_http = require("@opentelemetry/exporter-metrics-otlp-http");
|
|
33
35
|
let _opentelemetry_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
|
|
34
36
|
|
|
@@ -1078,10 +1080,10 @@ function resetEventQueue() {
|
|
|
1078
1080
|
|
|
1079
1081
|
//#endregion
|
|
1080
1082
|
//#region src/trace-context.ts
|
|
1081
|
-
const
|
|
1082
|
-
/**
|
|
1083
|
-
function
|
|
1084
|
-
return
|
|
1083
|
+
const explicitSpanStatuses = /* @__PURE__ */ new WeakMap();
|
|
1084
|
+
/** The status a TraceContext consumer explicitly chose for this span, if any. */
|
|
1085
|
+
function explicitSpanStatus(span) {
|
|
1086
|
+
return explicitSpanStatuses.get(span);
|
|
1085
1087
|
}
|
|
1086
1088
|
/**
|
|
1087
1089
|
* AsyncLocalStorage for storing the active context with baggage
|
|
@@ -1169,7 +1171,7 @@ function createTraceContext(span) {
|
|
|
1169
1171
|
span.setAttributes(require_structured_error.flattenToAttributes(attrs));
|
|
1170
1172
|
},
|
|
1171
1173
|
setStatus: (status) => {
|
|
1172
|
-
|
|
1174
|
+
explicitSpanStatuses.set(span, status.code);
|
|
1173
1175
|
span.setStatus(status);
|
|
1174
1176
|
},
|
|
1175
1177
|
recordException: span.recordException.bind(span),
|
|
@@ -2403,7 +2405,7 @@ function substituteEnvVars(value) {
|
|
|
2403
2405
|
* @returns Object with all string values having env vars substituted
|
|
2404
2406
|
*/
|
|
2405
2407
|
function substituteEnvVarsDeep(value) {
|
|
2406
|
-
if (Array.isArray(value)) return value.map(substituteEnvVarsDeep);
|
|
2408
|
+
if (Array.isArray(value)) return value.map((item) => substituteEnvVarsDeep(item));
|
|
2407
2409
|
const mapping = asYamlMapping(value);
|
|
2408
2410
|
if (mapping) {
|
|
2409
2411
|
const result = {};
|
|
@@ -2635,7 +2637,7 @@ const DEFAULT_SHUTDOWN_TIMEOUT_MS = 2e3;
|
|
|
2635
2637
|
function runShutdownOnce(shutdown, timeoutMs) {
|
|
2636
2638
|
if (shutdownInFlight) return shutdownInFlight;
|
|
2637
2639
|
let timeoutHandle;
|
|
2638
|
-
const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() =>
|
|
2640
|
+
const shutdownAttempt = Promise.resolve(exitFlushInFlight).then(shutdown).catch(() => {});
|
|
2639
2641
|
const timeout = new Promise((resolve) => {
|
|
2640
2642
|
timeoutHandle = setTimeout(resolve, timeoutMs);
|
|
2641
2643
|
timeoutHandle.unref();
|
|
@@ -2728,7 +2730,7 @@ function installExitFlush(flushTelemetry, timeoutMs = DEFAULT_SHUTDOWN_TIMEOUT_M
|
|
|
2728
2730
|
const deadline = setTimeout(() => {
|
|
2729
2731
|
process.exit(process.exitCode ?? code);
|
|
2730
2732
|
}, timeoutMs);
|
|
2731
|
-
exitFlushInFlight = flushTelemetry().catch(() =>
|
|
2733
|
+
exitFlushInFlight = flushTelemetry().catch(() => {}).finally(() => {
|
|
2732
2734
|
clearTimeout(deadline);
|
|
2733
2735
|
});
|
|
2734
2736
|
};
|
|
@@ -2746,6 +2748,91 @@ function uninstallProcessHandlers() {
|
|
|
2746
2748
|
exitFlushInFlight = void 0;
|
|
2747
2749
|
}
|
|
2748
2750
|
|
|
2751
|
+
//#endregion
|
|
2752
|
+
//#region src/console-signals.ts
|
|
2753
|
+
/**
|
|
2754
|
+
* Console-derived error signals, recorded on the active span.
|
|
2755
|
+
*
|
|
2756
|
+
* - `console.error(...)` inside a span records an exception on that span
|
|
2757
|
+
* without touching its status: the code handled the error, but it still
|
|
2758
|
+
* belongs to the request's issue list.
|
|
2759
|
+
* - One log template repeated past a threshold within one trace (logging
|
|
2760
|
+
* inside a loop) records a single `autotel.LogFlood` exception.
|
|
2761
|
+
*
|
|
2762
|
+
* Listens on Node's `console.*` diagnostics channels, so `console` is never
|
|
2763
|
+
* patched and the original output is untouched. Installed once by `init()`.
|
|
2764
|
+
* Mirrors `autotel-edge/src/core/console-signals.ts`, which patches `console`
|
|
2765
|
+
* because edge runtimes have no such channel.
|
|
2766
|
+
*/
|
|
2767
|
+
/** `exception.type` of the logging-in-a-loop signal. */
|
|
2768
|
+
const LOG_FLOOD_EXCEPTION = "autotel.LogFlood";
|
|
2769
|
+
const MAX_MESSAGE_LENGTH = 500;
|
|
2770
|
+
const MAX_TEMPLATE_LENGTH = 120;
|
|
2771
|
+
const MAX_INVOCATIONS = 256;
|
|
2772
|
+
const MAX_TEMPLATES = 256;
|
|
2773
|
+
const LEVELS = [
|
|
2774
|
+
"log",
|
|
2775
|
+
"info",
|
|
2776
|
+
"warn",
|
|
2777
|
+
"error",
|
|
2778
|
+
"debug"
|
|
2779
|
+
];
|
|
2780
|
+
const invocations = /* @__PURE__ */ new Map();
|
|
2781
|
+
let options = {
|
|
2782
|
+
captureConsoleErrors: true,
|
|
2783
|
+
logFloodThreshold: 100
|
|
2784
|
+
};
|
|
2785
|
+
let installed = false;
|
|
2786
|
+
let busy = false;
|
|
2787
|
+
const nodeUtil = require_node_require.safeRequire("node:util");
|
|
2788
|
+
/** Collapse ids and numbers so one loop's lines share a template. */
|
|
2789
|
+
function logTemplate(args) {
|
|
2790
|
+
return args.map((arg) => typeof arg === "string" ? arg.slice(0, 200) : arg instanceof Error ? arg.name : `<${typeof arg}>`).join(" ").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]*\d)[0-9a-f]{8,}\b/gi, "<hex>").replaceAll(/\d+/g, "<n>");
|
|
2791
|
+
}
|
|
2792
|
+
function countLogLine(key, template, threshold) {
|
|
2793
|
+
let templates = invocations.get(key);
|
|
2794
|
+
if (!templates) {
|
|
2795
|
+
if (invocations.size >= MAX_INVOCATIONS) invocations.delete(invocations.keys().next().value);
|
|
2796
|
+
templates = /* @__PURE__ */ new Map();
|
|
2797
|
+
invocations.set(key, templates);
|
|
2798
|
+
}
|
|
2799
|
+
const count = (templates.get(template) ?? 0) + 1;
|
|
2800
|
+
if (count > 1 || templates.size < MAX_TEMPLATES) templates.set(template, count);
|
|
2801
|
+
return count === threshold + 1;
|
|
2802
|
+
}
|
|
2803
|
+
function onConsole(level, args) {
|
|
2804
|
+
if (busy) return;
|
|
2805
|
+
if (typeof args[0] === "string" && args[0].startsWith("[autotel")) return;
|
|
2806
|
+
const captureError = level === "error" && options.captureConsoleErrors;
|
|
2807
|
+
const threshold = options.logFloodThreshold;
|
|
2808
|
+
if (!captureError && threshold <= 0) return;
|
|
2809
|
+
const span = _opentelemetry_api.trace.getActiveSpan();
|
|
2810
|
+
if (!span?.isRecording()) return;
|
|
2811
|
+
busy = true;
|
|
2812
|
+
try {
|
|
2813
|
+
if (captureError) span.recordException(args.find((a) => a instanceof Error) ?? (nodeUtil?.format(...args) ?? args.join(" ")).slice(0, MAX_MESSAGE_LENGTH));
|
|
2814
|
+
if (threshold > 0) {
|
|
2815
|
+
const template = logTemplate(args);
|
|
2816
|
+
if (countLogLine(span.spanContext().traceId, template, threshold)) span.recordException({
|
|
2817
|
+
name: LOG_FLOOD_EXCEPTION,
|
|
2818
|
+
message: `"${template.slice(0, MAX_TEMPLATE_LENGTH)}" logged ${threshold}+ times in one invocation`
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
} catch {} finally {
|
|
2822
|
+
busy = false;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
/** Subscribe once; later calls only update the options. */
|
|
2826
|
+
function installConsoleSignals(next = {}) {
|
|
2827
|
+
options = {
|
|
2828
|
+
captureConsoleErrors: next.captureConsoleErrors ?? true,
|
|
2829
|
+
logFloodThreshold: next.logFloodThreshold ?? 100
|
|
2830
|
+
};
|
|
2831
|
+
if (installed) return;
|
|
2832
|
+
installed = true;
|
|
2833
|
+
for (const level of LEVELS) require_channel.subscribeChannel(`console.${level}`, (message) => onConsole(level, Array.isArray(message) ? message : message?.args ?? []));
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2749
2836
|
//#endregion
|
|
2750
2837
|
//#region src/circuit-breaker.ts
|
|
2751
2838
|
const DEFAULT_CONFIG = {
|
|
@@ -4320,7 +4407,7 @@ function init(cfg) {
|
|
|
4320
4407
|
if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
|
|
4321
4408
|
if (mergedConfig.resourceAttributes) resource = resource.merge((0, _opentelemetry_resources.resourceFromAttributes)(mergedConfig.resourceAttributes));
|
|
4322
4409
|
const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
|
|
4323
|
-
const configuredSpanProcessors = mergedConfig.spanProcessors
|
|
4410
|
+
const configuredSpanProcessors = mergedConfig.spanProcessors === void 0 ? mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0 : mergedConfig.spanProcessors;
|
|
4324
4411
|
const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
|
|
4325
4412
|
const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
|
|
4326
4413
|
const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
|
|
@@ -4434,9 +4521,9 @@ function init(cfg) {
|
|
|
4434
4521
|
resource,
|
|
4435
4522
|
serviceName: mergedConfig.service,
|
|
4436
4523
|
sampler,
|
|
4437
|
-
instrumentations: finalInstrumentations
|
|
4524
|
+
instrumentations: finalInstrumentations,
|
|
4525
|
+
spanProcessors: spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()]
|
|
4438
4526
|
};
|
|
4439
|
-
sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
|
|
4440
4527
|
if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
|
|
4441
4528
|
if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
|
|
4442
4529
|
else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
|
|
@@ -4457,6 +4544,10 @@ function init(cfg) {
|
|
|
4457
4544
|
} else logger.warn({}, "[autotel] OpenLLMetry enabled but @traceloop/node-server-sdk is not installed. Install it as a peer dependency to use OpenLLMetry integration.");
|
|
4458
4545
|
}
|
|
4459
4546
|
initialized = true;
|
|
4547
|
+
installConsoleSignals({
|
|
4548
|
+
captureConsoleErrors: mergedConfig.captureConsoleErrors,
|
|
4549
|
+
logFloodThreshold: mergedConfig.logFloodThreshold
|
|
4550
|
+
});
|
|
4460
4551
|
const processHandlers = mergedConfig.processHandlers;
|
|
4461
4552
|
const handlersConfig = processHandlers && processHandlers !== true ? processHandlers : {};
|
|
4462
4553
|
if (processHandlers) installProcessHandlers(handlersConfig, shutdown);
|
|
@@ -4669,6 +4760,12 @@ Object.defineProperty(exports, 'defineBaggageSchema', {
|
|
|
4669
4760
|
return defineBaggageSchema;
|
|
4670
4761
|
}
|
|
4671
4762
|
});
|
|
4763
|
+
Object.defineProperty(exports, 'explicitSpanStatus', {
|
|
4764
|
+
enumerable: true,
|
|
4765
|
+
get: function () {
|
|
4766
|
+
return explicitSpanStatus;
|
|
4767
|
+
}
|
|
4768
|
+
});
|
|
4672
4769
|
Object.defineProperty(exports, 'extractLinksFromBatch', {
|
|
4673
4770
|
enumerable: true,
|
|
4674
4771
|
get: function () {
|
|
@@ -4765,12 +4862,6 @@ Object.defineProperty(exports, 'getSdk', {
|
|
|
4765
4862
|
return getSdk;
|
|
4766
4863
|
}
|
|
4767
4864
|
});
|
|
4768
|
-
Object.defineProperty(exports, 'hasExplicitSpanStatus', {
|
|
4769
|
-
enumerable: true,
|
|
4770
|
-
get: function () {
|
|
4771
|
-
return hasExplicitSpanStatus;
|
|
4772
|
-
}
|
|
4773
|
-
});
|
|
4774
4865
|
Object.defineProperty(exports, 'hasYamlConfig', {
|
|
4775
4866
|
enumerable: true,
|
|
4776
4867
|
get: function () {
|
package/dist/instrumentation.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_init = require('./init-
|
|
2
|
+
const require_init = require('./init-Cx1-ejLn.cjs');
|
|
3
3
|
const require_node_require = require('./node-require-BPsB09eC.cjs');
|
|
4
4
|
let _opentelemetry_resources = require("@opentelemetry/resources");
|
|
5
5
|
let _opentelemetry_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
2
2
|
//#region src/instrumentation.d.ts
|
|
3
|
-
interface InstrumentationConfig {
|
|
3
|
+
export interface InstrumentationConfig {
|
|
4
4
|
serviceName: string;
|
|
5
5
|
serviceVersion?: string;
|
|
6
6
|
deploymentEnvironment?: string;
|
|
@@ -43,7 +43,6 @@ interface InstrumentationConfig {
|
|
|
43
43
|
* Shutdown the OpenTelemetry SDK gracefully
|
|
44
44
|
* Call this before process exit or during hot-reloads
|
|
45
45
|
*/
|
|
46
|
-
declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
|
|
47
|
-
declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { InstrumentationConfig, initInstrumentation, shutdownInstrumentation };
|
|
46
|
+
export declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
|
|
47
|
+
export declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
|
|
48
|
+
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
2
2
|
//#region src/instrumentation.d.ts
|
|
3
|
-
interface InstrumentationConfig {
|
|
3
|
+
export interface InstrumentationConfig {
|
|
4
4
|
serviceName: string;
|
|
5
5
|
serviceVersion?: string;
|
|
6
6
|
deploymentEnvironment?: string;
|
|
@@ -43,7 +43,6 @@ interface InstrumentationConfig {
|
|
|
43
43
|
* Shutdown the OpenTelemetry SDK gracefully
|
|
44
44
|
* Call this before process exit or during hot-reloads
|
|
45
45
|
*/
|
|
46
|
-
declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
|
|
47
|
-
declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { InstrumentationConfig, initInstrumentation, shutdownInstrumentation };
|
|
46
|
+
export declare function shutdownInstrumentation(sdk?: NodeSDK): Promise<void>;
|
|
47
|
+
export declare function initInstrumentation(config: InstrumentationConfig): Promise<NodeSDK>;
|
|
48
|
+
//#endregion
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as TailSamplingSpanProcessor, r as getLogger } from "./init-
|
|
1
|
+
import { C as TailSamplingSpanProcessor, r as getLogger } from "./init-BvUtwZNx.js";
|
|
2
2
|
import { n as safeRequire, t as requireModule } from "./node-require-CkK_xzL-.js";
|
|
3
3
|
import { detectResources, hostDetector, processDetector, resourceFromAttributes } from "@opentelemetry/resources";
|
|
4
4
|
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
@@ -192,10 +192,10 @@ declare function autotelLogger(options?: {
|
|
|
192
192
|
* Log level constants
|
|
193
193
|
*/
|
|
194
194
|
declare const LOG_LEVEL: {
|
|
195
|
-
readonly DEBUG:
|
|
196
|
-
readonly INFO:
|
|
197
|
-
readonly WARN:
|
|
198
|
-
readonly ERROR:
|
|
195
|
+
readonly DEBUG: 'debug';
|
|
196
|
+
readonly INFO: 'info';
|
|
197
|
+
readonly WARN: 'warn';
|
|
198
|
+
readonly ERROR: 'error';
|
|
199
199
|
};
|
|
200
200
|
type LogLevel = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL];
|
|
201
201
|
/**
|
|
@@ -192,10 +192,10 @@ declare function autotelLogger(options?: {
|
|
|
192
192
|
* Log level constants
|
|
193
193
|
*/
|
|
194
194
|
declare const LOG_LEVEL: {
|
|
195
|
-
readonly DEBUG:
|
|
196
|
-
readonly INFO:
|
|
197
|
-
readonly WARN:
|
|
198
|
-
readonly ERROR:
|
|
195
|
+
readonly DEBUG: 'debug';
|
|
196
|
+
readonly INFO: 'info';
|
|
197
|
+
readonly WARN: 'warn';
|
|
198
|
+
readonly ERROR: 'error';
|
|
199
199
|
};
|
|
200
200
|
type LogLevel = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL];
|
|
201
201
|
/**
|
package/dist/logger.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LoggedOperation, c as LoggerConfig, d as BuiltinLoggerOptions, f as autotelLogger, g as runWithLogLevel, h as getTraceContext, i as LogLevel, l as PinoLogger, m as getActiveLogLevel, n as LOG_LEVEL, o as LoggedOperationOptions, p as createBuiltinLogger, r as LogFn, s as Logger, t as ILogger, u as BuiltinLogLevel } from "./logger-
|
|
1
|
+
import { a as LoggedOperation, c as LoggerConfig, d as BuiltinLoggerOptions, f as autotelLogger, g as runWithLogLevel, h as getTraceContext, i as LogLevel, l as PinoLogger, m as getActiveLogLevel, n as LOG_LEVEL, o as LoggedOperationOptions, p as createBuiltinLogger, r as LogFn, s as Logger, t as ILogger, u as BuiltinLogLevel } from "./logger-C9UT1aZ_.cjs";
|
|
2
2
|
export { type BuiltinLogLevel, type BuiltinLoggerOptions, ILogger, LOG_LEVEL, LogFn, LogLevel, LoggedOperation, LoggedOperationOptions, Logger, LoggerConfig, type PinoLogger, autotelLogger, createBuiltinLogger, getActiveLogLevel, getTraceContext, runWithLogLevel };
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LoggedOperation, c as LoggerConfig, d as BuiltinLoggerOptions, f as autotelLogger, g as runWithLogLevel, h as getTraceContext, i as LogLevel, l as PinoLogger, m as getActiveLogLevel, n as LOG_LEVEL, o as LoggedOperationOptions, p as createBuiltinLogger, r as LogFn, s as Logger, t as ILogger, u as BuiltinLogLevel } from "./logger-
|
|
1
|
+
import { a as LoggedOperation, c as LoggerConfig, d as BuiltinLoggerOptions, f as autotelLogger, g as runWithLogLevel, h as getTraceContext, i as LogLevel, l as PinoLogger, m as getActiveLogLevel, n as LOG_LEVEL, o as LoggedOperationOptions, p as createBuiltinLogger, r as LogFn, s as Logger, t as ILogger, u as BuiltinLogLevel } from "./logger-C9UT1aZ_.js";
|
|
2
2
|
export { type BuiltinLogLevel, type BuiltinLoggerOptions, ILogger, LOG_LEVEL, LogFn, LogLevel, LoggedOperation, LoggedOperationOptions, Logger, LoggerConfig, type PinoLogger, autotelLogger, createBuiltinLogger, getActiveLogLevel, getTraceContext, runWithLogLevel };
|
|
@@ -4,7 +4,7 @@ import { AttributeValue, SpanContext } from "@opentelemetry/api";
|
|
|
4
4
|
/**
|
|
5
5
|
* Producer adapter configuration
|
|
6
6
|
*/
|
|
7
|
-
interface ProducerAdapter {
|
|
7
|
+
export interface ProducerAdapter {
|
|
8
8
|
/**
|
|
9
9
|
* Hook to add system-specific attributes to producer spans
|
|
10
10
|
*/
|
|
@@ -17,7 +17,7 @@ interface ProducerAdapter {
|
|
|
17
17
|
/**
|
|
18
18
|
* Consumer adapter configuration
|
|
19
19
|
*/
|
|
20
|
-
interface ConsumerAdapter {
|
|
20
|
+
export interface ConsumerAdapter {
|
|
21
21
|
/**
|
|
22
22
|
* Extract headers from the message for trace context propagation
|
|
23
23
|
*/
|
|
@@ -34,11 +34,11 @@ interface ConsumerAdapter {
|
|
|
34
34
|
/**
|
|
35
35
|
* Combined producer and consumer adapter
|
|
36
36
|
*/
|
|
37
|
-
interface MessagingAdapter {
|
|
37
|
+
export interface MessagingAdapter {
|
|
38
38
|
producer?: ProducerAdapter;
|
|
39
39
|
consumer?: ConsumerAdapter;
|
|
40
40
|
}
|
|
41
|
-
declare const natsAdapter: MessagingAdapter;
|
|
41
|
+
export declare const natsAdapter: MessagingAdapter;
|
|
42
42
|
/**
|
|
43
43
|
* Temporal adapter
|
|
44
44
|
*
|
|
@@ -68,7 +68,7 @@ declare const natsAdapter: MessagingAdapter;
|
|
|
68
68
|
* });
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
declare const temporalAdapter: MessagingAdapter;
|
|
71
|
+
export declare const temporalAdapter: MessagingAdapter;
|
|
72
72
|
/**
|
|
73
73
|
* Cloudflare Queues adapter
|
|
74
74
|
*
|
|
@@ -94,7 +94,7 @@ declare const temporalAdapter: MessagingAdapter;
|
|
|
94
94
|
* });
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
|
-
declare const cloudflareQueuesAdapter: MessagingAdapter;
|
|
97
|
+
export declare const cloudflareQueuesAdapter: MessagingAdapter;
|
|
98
98
|
/**
|
|
99
99
|
* Datadog trace context extractor
|
|
100
100
|
*
|
|
@@ -115,7 +115,7 @@ declare const cloudflareQueuesAdapter: MessagingAdapter;
|
|
|
115
115
|
* });
|
|
116
116
|
* ```
|
|
117
117
|
*/
|
|
118
|
-
declare function datadogContextExtractor(headers: Record<string, string>): SpanContext | null;
|
|
118
|
+
export declare function datadogContextExtractor(headers: Record<string, string>): SpanContext | null;
|
|
119
119
|
/**
|
|
120
120
|
* B3 (Zipkin) trace context extractor
|
|
121
121
|
*
|
|
@@ -141,7 +141,7 @@ declare function datadogContextExtractor(headers: Record<string, string>): SpanC
|
|
|
141
141
|
* // Headers: X-B3-TraceId, X-B3-SpanId, X-B3-Sampled
|
|
142
142
|
* ```
|
|
143
143
|
*/
|
|
144
|
-
declare function b3ContextExtractor(headers: Record<string, string>): SpanContext | null;
|
|
144
|
+
export declare function b3ContextExtractor(headers: Record<string, string>): SpanContext | null;
|
|
145
145
|
/**
|
|
146
146
|
* AWS X-Ray trace context extractor
|
|
147
147
|
*
|
|
@@ -159,6 +159,5 @@ declare function b3ContextExtractor(headers: Record<string, string>): SpanContex
|
|
|
159
159
|
* });
|
|
160
160
|
* ```
|
|
161
161
|
*/
|
|
162
|
-
declare function xrayContextExtractor(headers: Record<string, string>): SpanContext | null;
|
|
163
|
-
//#endregion
|
|
164
|
-
export { ConsumerAdapter, MessagingAdapter, ProducerAdapter, b3ContextExtractor, cloudflareQueuesAdapter, datadogContextExtractor, natsAdapter, temporalAdapter, xrayContextExtractor };
|
|
162
|
+
export declare function xrayContextExtractor(headers: Record<string, string>): SpanContext | null;
|
|
163
|
+
//#endregion
|