autotel 7.9.0 → 7.10.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 +14 -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-SeRUabkE.d.ts → functional-CbcInXMJ.d.ts} +1 -1
- package/dist/{functional-DxHvvWc_.cjs → functional-CjZT7Jur.cjs} +3 -3
- package/dist/{functional-6QPJDqUW.js → functional-DHn-xGtR.js} +3 -3
- 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-COfMwKbc.d.cts → init-BtYaU5n9.d.cts} +18 -4
- package/dist/{init-CnoRlJqS.d.ts → init-DUIFqRRS.d.ts} +18 -4
- package/dist/{init-C-qfxo_u.js → init-rVPOUqng.js} +98 -8
- package/dist/{init-W_klPrYk.cjs → init-zb68UvOW.cjs} +97 -6
- 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
|
@@ -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
|
|
|
@@ -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);
|
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-zb68UvOW.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-rVPOUqng.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
|
|
@@ -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
|
|
@@ -4,7 +4,7 @@ import { Link, SpanContext } from "@opentelemetry/api";
|
|
|
4
4
|
/**
|
|
5
5
|
* Recorded producer call
|
|
6
6
|
*/
|
|
7
|
-
interface RecordedProducerCall {
|
|
7
|
+
export interface RecordedProducerCall {
|
|
8
8
|
/** Destination (topic/queue) */
|
|
9
9
|
destination: string;
|
|
10
10
|
/** System (kafka, sqs, etc.) */
|
|
@@ -23,7 +23,7 @@ interface RecordedProducerCall {
|
|
|
23
23
|
/**
|
|
24
24
|
* Recorded consumer call
|
|
25
25
|
*/
|
|
26
|
-
interface RecordedConsumerCall {
|
|
26
|
+
export interface RecordedConsumerCall {
|
|
27
27
|
/** Destination (topic/queue) */
|
|
28
28
|
destination: string;
|
|
29
29
|
/** System (kafka, sqs, etc.) */
|
|
@@ -50,7 +50,7 @@ interface RecordedConsumerCall {
|
|
|
50
50
|
/**
|
|
51
51
|
* Recorded rebalance event
|
|
52
52
|
*/
|
|
53
|
-
interface RecordedRebalanceEvent extends RebalanceEvent {
|
|
53
|
+
export interface RecordedRebalanceEvent extends RebalanceEvent {
|
|
54
54
|
/** Destination (topic) */
|
|
55
55
|
destination: string;
|
|
56
56
|
/** Consumer group */
|
|
@@ -59,7 +59,7 @@ interface RecordedRebalanceEvent extends RebalanceEvent {
|
|
|
59
59
|
/**
|
|
60
60
|
* Mock message for testing
|
|
61
61
|
*/
|
|
62
|
-
interface MockMessage<T = unknown> {
|
|
62
|
+
export interface MockMessage<T = unknown> {
|
|
63
63
|
/** Message payload */
|
|
64
64
|
payload: T;
|
|
65
65
|
/** Headers */
|
|
@@ -78,7 +78,7 @@ interface MockMessage<T = unknown> {
|
|
|
78
78
|
/**
|
|
79
79
|
* Producer assertion options
|
|
80
80
|
*/
|
|
81
|
-
interface ProducerAssertionOptions {
|
|
81
|
+
export interface ProducerAssertionOptions {
|
|
82
82
|
/** Expected number of messages */
|
|
83
83
|
messageCount?: number;
|
|
84
84
|
/** Whether trace headers should be present */
|
|
@@ -93,7 +93,7 @@ interface ProducerAssertionOptions {
|
|
|
93
93
|
/**
|
|
94
94
|
* Consumer assertion options
|
|
95
95
|
*/
|
|
96
|
-
interface ConsumerAssertionOptions {
|
|
96
|
+
export interface ConsumerAssertionOptions {
|
|
97
97
|
/** Expected number of messages processed */
|
|
98
98
|
messageCount?: number;
|
|
99
99
|
/** Whether producer links should be present */
|
|
@@ -112,7 +112,7 @@ interface ConsumerAssertionOptions {
|
|
|
112
112
|
/**
|
|
113
113
|
* Messaging test harness
|
|
114
114
|
*/
|
|
115
|
-
interface MessagingTestHarness {
|
|
115
|
+
export interface MessagingTestHarness {
|
|
116
116
|
/** All recorded producer calls */
|
|
117
117
|
producerCalls: RecordedProducerCall[];
|
|
118
118
|
/** All recorded consumer calls */
|
|
@@ -211,11 +211,11 @@ interface MessagingTestHarness {
|
|
|
211
211
|
* });
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
214
|
-
declare function createMessagingTestHarness(): MessagingTestHarness;
|
|
214
|
+
export declare function createMessagingTestHarness(): MessagingTestHarness;
|
|
215
215
|
/**
|
|
216
216
|
* Mock message broker for testing
|
|
217
217
|
*/
|
|
218
|
-
interface MockMessageBroker {
|
|
218
|
+
export interface MockMessageBroker {
|
|
219
219
|
/** Topics/queues in the broker */
|
|
220
220
|
topics: Map<string, MockMessage[]>;
|
|
221
221
|
/**
|
|
@@ -269,27 +269,27 @@ interface MockMessageBroker {
|
|
|
269
269
|
* expect(messages[0].payload).toEqual({ orderId: '123' });
|
|
270
270
|
* ```
|
|
271
271
|
*/
|
|
272
|
-
declare function createMockMessageBroker(): MockMessageBroker;
|
|
272
|
+
export declare function createMockMessageBroker(): MockMessageBroker;
|
|
273
273
|
/**
|
|
274
274
|
* Extract trace ID from traceparent header
|
|
275
275
|
*/
|
|
276
|
-
declare function extractTraceIdFromHeader(traceparent: string): string | null;
|
|
276
|
+
export declare function extractTraceIdFromHeader(traceparent: string): string | null;
|
|
277
277
|
/**
|
|
278
278
|
* Extract span ID from traceparent header
|
|
279
279
|
*/
|
|
280
|
-
declare function extractSpanIdFromHeader(traceparent: string): string | null;
|
|
280
|
+
export declare function extractSpanIdFromHeader(traceparent: string): string | null;
|
|
281
281
|
/**
|
|
282
282
|
* Create a mock span context
|
|
283
283
|
*/
|
|
284
|
-
declare function createMockSpanContext(traceId?: string, spanId?: string): SpanContext;
|
|
284
|
+
export declare function createMockSpanContext(traceId?: string, spanId?: string): SpanContext;
|
|
285
285
|
/**
|
|
286
286
|
* Create a mock link to a producer span
|
|
287
287
|
*/
|
|
288
|
-
declare function createMockProducerLink(traceId?: string, spanId?: string): Link;
|
|
288
|
+
export declare function createMockProducerLink(traceId?: string, spanId?: string): Link;
|
|
289
289
|
/**
|
|
290
290
|
* Create a batch of mock messages
|
|
291
291
|
*/
|
|
292
|
-
declare function createMockMessageBatch<T>(payloads: T[], options?: {
|
|
292
|
+
export declare function createMockMessageBatch<T>(payloads: T[], options?: {
|
|
293
293
|
startOffset?: number;
|
|
294
294
|
partition?: number;
|
|
295
295
|
addTraceHeaders?: boolean;
|
|
@@ -298,17 +298,16 @@ declare function createMockMessageBatch<T>(payloads: T[], options?: {
|
|
|
298
298
|
/**
|
|
299
299
|
* Create a rebalance scenario
|
|
300
300
|
*/
|
|
301
|
-
declare function createRebalanceScenario(topic: string, consumerGroup: string, partitions: number[]): {
|
|
301
|
+
export declare function createRebalanceScenario(topic: string, consumerGroup: string, partitions: number[]): {
|
|
302
302
|
assignEvent: RecordedRebalanceEvent;
|
|
303
303
|
revokeEvent: RecordedRebalanceEvent;
|
|
304
304
|
};
|
|
305
305
|
/**
|
|
306
306
|
* Create an out-of-order scenario
|
|
307
307
|
*/
|
|
308
|
-
declare function createOutOfOrderScenario<T>(payloads: T[], outOfOrderIndices: number[]): MockMessage<T>[];
|
|
308
|
+
export declare function createOutOfOrderScenario<T>(payloads: T[], outOfOrderIndices: number[]): MockMessage<T>[];
|
|
309
309
|
/**
|
|
310
310
|
* Create a duplicate message scenario
|
|
311
311
|
*/
|
|
312
|
-
declare function createDuplicateScenario<T>(payloads: T[], duplicateIndices: number[]): MockMessage<T>[];
|
|
313
|
-
//#endregion
|
|
314
|
-
export { ConsumerAssertionOptions, MessagingTestHarness, MockMessage, MockMessageBroker, ProducerAssertionOptions, RecordedConsumerCall, RecordedProducerCall, RecordedRebalanceEvent, createDuplicateScenario, createMessagingTestHarness, createMockMessageBatch, createMockMessageBroker, createMockProducerLink, createMockSpanContext, createOutOfOrderScenario, createRebalanceScenario, extractSpanIdFromHeader, extractTraceIdFromHeader };
|
|
312
|
+
export declare function createDuplicateScenario<T>(payloads: T[], duplicateIndices: number[]): MockMessage<T>[];
|
|
313
|
+
//#endregion
|