autotel 2.1.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/LICENSE +21 -0
- package/README.md +1946 -0
- package/dist/chunk-2LNRY4QK.js +273 -0
- package/dist/chunk-2LNRY4QK.js.map +1 -0
- package/dist/chunk-3HENGDW2.js +587 -0
- package/dist/chunk-3HENGDW2.js.map +1 -0
- package/dist/chunk-4OAT42CA.cjs +73 -0
- package/dist/chunk-4OAT42CA.cjs.map +1 -0
- package/dist/chunk-5GWX5LFW.js +70 -0
- package/dist/chunk-5GWX5LFW.js.map +1 -0
- package/dist/chunk-5R2M36QB.js +195 -0
- package/dist/chunk-5R2M36QB.js.map +1 -0
- package/dist/chunk-5ZN622AO.js +73 -0
- package/dist/chunk-5ZN622AO.js.map +1 -0
- package/dist/chunk-77MSMAUQ.cjs +498 -0
- package/dist/chunk-77MSMAUQ.cjs.map +1 -0
- package/dist/chunk-ABPEQ6RK.cjs +596 -0
- package/dist/chunk-ABPEQ6RK.cjs.map +1 -0
- package/dist/chunk-BWYGJKRB.js +95 -0
- package/dist/chunk-BWYGJKRB.js.map +1 -0
- package/dist/chunk-BZHG5IZ4.js +73 -0
- package/dist/chunk-BZHG5IZ4.js.map +1 -0
- package/dist/chunk-G7VZBCD6.cjs +35 -0
- package/dist/chunk-G7VZBCD6.cjs.map +1 -0
- package/dist/chunk-GVLK7YUU.cjs +30 -0
- package/dist/chunk-GVLK7YUU.cjs.map +1 -0
- package/dist/chunk-HCCXC7XG.js +205 -0
- package/dist/chunk-HCCXC7XG.js.map +1 -0
- package/dist/chunk-HE6T6FIX.cjs +203 -0
- package/dist/chunk-HE6T6FIX.cjs.map +1 -0
- package/dist/chunk-KIXWPOCO.cjs +100 -0
- package/dist/chunk-KIXWPOCO.cjs.map +1 -0
- package/dist/chunk-KVGNW3FC.js +87 -0
- package/dist/chunk-KVGNW3FC.js.map +1 -0
- package/dist/chunk-LITNXTTT.js +3 -0
- package/dist/chunk-LITNXTTT.js.map +1 -0
- package/dist/chunk-M4ANN7RL.js +114 -0
- package/dist/chunk-M4ANN7RL.js.map +1 -0
- package/dist/chunk-NC52UBR2.cjs +32 -0
- package/dist/chunk-NC52UBR2.cjs.map +1 -0
- package/dist/chunk-NHCNRQD3.cjs +212 -0
- package/dist/chunk-NHCNRQD3.cjs.map +1 -0
- package/dist/chunk-NZ72VDNY.cjs +4 -0
- package/dist/chunk-NZ72VDNY.cjs.map +1 -0
- package/dist/chunk-P6JUDYNO.js +57 -0
- package/dist/chunk-P6JUDYNO.js.map +1 -0
- package/dist/chunk-RJYY7BWX.js +1349 -0
- package/dist/chunk-RJYY7BWX.js.map +1 -0
- package/dist/chunk-TRI4V5BF.cjs +126 -0
- package/dist/chunk-TRI4V5BF.cjs.map +1 -0
- package/dist/chunk-UL33I6IS.js +139 -0
- package/dist/chunk-UL33I6IS.js.map +1 -0
- package/dist/chunk-URRW6M2C.cjs +61 -0
- package/dist/chunk-URRW6M2C.cjs.map +1 -0
- package/dist/chunk-UY3UYPBZ.cjs +77 -0
- package/dist/chunk-UY3UYPBZ.cjs.map +1 -0
- package/dist/chunk-W3253FGB.cjs +277 -0
- package/dist/chunk-W3253FGB.cjs.map +1 -0
- package/dist/chunk-W7LHZVQF.js +26 -0
- package/dist/chunk-W7LHZVQF.js.map +1 -0
- package/dist/chunk-WBWNM6LB.cjs +1360 -0
- package/dist/chunk-WBWNM6LB.cjs.map +1 -0
- package/dist/chunk-WFJ7L2RV.js +494 -0
- package/dist/chunk-WFJ7L2RV.js.map +1 -0
- package/dist/chunk-X4RMFFMR.js +28 -0
- package/dist/chunk-X4RMFFMR.js.map +1 -0
- package/dist/chunk-Y4Y2S7BM.cjs +92 -0
- package/dist/chunk-Y4Y2S7BM.cjs.map +1 -0
- package/dist/chunk-YLPNXZFI.cjs +143 -0
- package/dist/chunk-YLPNXZFI.cjs.map +1 -0
- package/dist/chunk-YTXEZ4SD.cjs +77 -0
- package/dist/chunk-YTXEZ4SD.cjs.map +1 -0
- package/dist/chunk-Z6ZWNWWR.js +30 -0
- package/dist/chunk-Z6ZWNWWR.js.map +1 -0
- package/dist/config.cjs +26 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +75 -0
- package/dist/config.d.ts +75 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -0
- package/dist/db.cjs +233 -0
- package/dist/db.cjs.map +1 -0
- package/dist/db.d.cts +123 -0
- package/dist/db.d.ts +123 -0
- package/dist/db.js +228 -0
- package/dist/db.js.map +1 -0
- package/dist/decorators.cjs +67 -0
- package/dist/decorators.cjs.map +1 -0
- package/dist/decorators.d.cts +91 -0
- package/dist/decorators.d.ts +91 -0
- package/dist/decorators.js +65 -0
- package/dist/decorators.js.map +1 -0
- package/dist/event-subscriber.cjs +6 -0
- package/dist/event-subscriber.cjs.map +1 -0
- package/dist/event-subscriber.d.cts +116 -0
- package/dist/event-subscriber.d.ts +116 -0
- package/dist/event-subscriber.js +3 -0
- package/dist/event-subscriber.js.map +1 -0
- package/dist/event-testing.cjs +21 -0
- package/dist/event-testing.cjs.map +1 -0
- package/dist/event-testing.d.cts +110 -0
- package/dist/event-testing.d.ts +110 -0
- package/dist/event-testing.js +4 -0
- package/dist/event-testing.js.map +1 -0
- package/dist/event.cjs +30 -0
- package/dist/event.cjs.map +1 -0
- package/dist/event.d.cts +282 -0
- package/dist/event.d.ts +282 -0
- package/dist/event.js +13 -0
- package/dist/event.js.map +1 -0
- package/dist/exporters.cjs +17 -0
- package/dist/exporters.cjs.map +1 -0
- package/dist/exporters.d.cts +1 -0
- package/dist/exporters.d.ts +1 -0
- package/dist/exporters.js +4 -0
- package/dist/exporters.js.map +1 -0
- package/dist/functional.cjs +46 -0
- package/dist/functional.cjs.map +1 -0
- package/dist/functional.d.cts +478 -0
- package/dist/functional.d.ts +478 -0
- package/dist/functional.js +13 -0
- package/dist/functional.js.map +1 -0
- package/dist/http.cjs +189 -0
- package/dist/http.cjs.map +1 -0
- package/dist/http.d.cts +169 -0
- package/dist/http.d.ts +169 -0
- package/dist/http.js +184 -0
- package/dist/http.js.map +1 -0
- package/dist/index.cjs +333 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +758 -0
- package/dist/index.d.ts +758 -0
- package/dist/index.js +143 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation.cjs +182 -0
- package/dist/instrumentation.cjs.map +1 -0
- package/dist/instrumentation.d.cts +49 -0
- package/dist/instrumentation.d.ts +49 -0
- package/dist/instrumentation.js +179 -0
- package/dist/instrumentation.js.map +1 -0
- package/dist/logger.cjs +19 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +146 -0
- package/dist/logger.d.ts +146 -0
- package/dist/logger.js +6 -0
- package/dist/logger.js.map +1 -0
- package/dist/metric-helpers.cjs +31 -0
- package/dist/metric-helpers.cjs.map +1 -0
- package/dist/metric-helpers.d.cts +13 -0
- package/dist/metric-helpers.d.ts +13 -0
- package/dist/metric-helpers.js +6 -0
- package/dist/metric-helpers.js.map +1 -0
- package/dist/metric-testing.cjs +21 -0
- package/dist/metric-testing.cjs.map +1 -0
- package/dist/metric-testing.d.cts +110 -0
- package/dist/metric-testing.d.ts +110 -0
- package/dist/metric-testing.js +4 -0
- package/dist/metric-testing.js.map +1 -0
- package/dist/metric.cjs +26 -0
- package/dist/metric.cjs.map +1 -0
- package/dist/metric.d.cts +240 -0
- package/dist/metric.d.ts +240 -0
- package/dist/metric.js +9 -0
- package/dist/metric.js.map +1 -0
- package/dist/processors.cjs +17 -0
- package/dist/processors.cjs.map +1 -0
- package/dist/processors.d.cts +1 -0
- package/dist/processors.d.ts +1 -0
- package/dist/processors.js +4 -0
- package/dist/processors.js.map +1 -0
- package/dist/sampling.cjs +40 -0
- package/dist/sampling.cjs.map +1 -0
- package/dist/sampling.d.cts +260 -0
- package/dist/sampling.d.ts +260 -0
- package/dist/sampling.js +7 -0
- package/dist/sampling.js.map +1 -0
- package/dist/semantic-helpers.cjs +35 -0
- package/dist/semantic-helpers.cjs.map +1 -0
- package/dist/semantic-helpers.d.cts +442 -0
- package/dist/semantic-helpers.d.ts +442 -0
- package/dist/semantic-helpers.js +14 -0
- package/dist/semantic-helpers.js.map +1 -0
- package/dist/tail-sampling-processor.cjs +13 -0
- package/dist/tail-sampling-processor.cjs.map +1 -0
- package/dist/tail-sampling-processor.d.cts +27 -0
- package/dist/tail-sampling-processor.d.ts +27 -0
- package/dist/tail-sampling-processor.js +4 -0
- package/dist/tail-sampling-processor.js.map +1 -0
- package/dist/testing.cjs +286 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +291 -0
- package/dist/testing.d.ts +291 -0
- package/dist/testing.js +263 -0
- package/dist/testing.js.map +1 -0
- package/dist/trace-context-DRZdUvVY.d.cts +181 -0
- package/dist/trace-context-DRZdUvVY.d.ts +181 -0
- package/dist/trace-helpers.cjs +54 -0
- package/dist/trace-helpers.cjs.map +1 -0
- package/dist/trace-helpers.d.cts +524 -0
- package/dist/trace-helpers.d.ts +524 -0
- package/dist/trace-helpers.js +5 -0
- package/dist/trace-helpers.js.map +1 -0
- package/dist/tracer-provider.cjs +21 -0
- package/dist/tracer-provider.cjs.map +1 -0
- package/dist/tracer-provider.d.cts +169 -0
- package/dist/tracer-provider.d.ts +169 -0
- package/dist/tracer-provider.js +4 -0
- package/dist/tracer-provider.js.map +1 -0
- package/package.json +280 -0
- package/src/baggage-span-processor.test.ts +202 -0
- package/src/baggage-span-processor.ts +98 -0
- package/src/circuit-breaker.test.ts +341 -0
- package/src/circuit-breaker.ts +184 -0
- package/src/config.test.ts +94 -0
- package/src/config.ts +169 -0
- package/src/db.test.ts +252 -0
- package/src/db.ts +447 -0
- package/src/decorators.test.ts +203 -0
- package/src/decorators.ts +188 -0
- package/src/env-config.test.ts +246 -0
- package/src/env-config.ts +158 -0
- package/src/event-queue.test.ts +222 -0
- package/src/event-queue.ts +203 -0
- package/src/event-subscriber.ts +136 -0
- package/src/event-testing.ts +197 -0
- package/src/event.test.ts +718 -0
- package/src/event.ts +556 -0
- package/src/exporters.ts +96 -0
- package/src/functional.test.ts +1059 -0
- package/src/functional.ts +2295 -0
- package/src/http.test.ts +487 -0
- package/src/http.ts +424 -0
- package/src/index.ts +158 -0
- package/src/init.customization.test.ts +210 -0
- package/src/init.integrations.test.ts +366 -0
- package/src/init.openllmetry.test.ts +282 -0
- package/src/init.protocol.test.ts +215 -0
- package/src/init.ts +1426 -0
- package/src/instrumentation.test.ts +108 -0
- package/src/instrumentation.ts +308 -0
- package/src/logger.test.ts +117 -0
- package/src/logger.ts +246 -0
- package/src/metric-helpers.ts +47 -0
- package/src/metric-testing.ts +197 -0
- package/src/metric.ts +434 -0
- package/src/metrics.test.ts +205 -0
- package/src/operation-context.ts +93 -0
- package/src/processors.ts +106 -0
- package/src/rate-limiter.test.ts +199 -0
- package/src/rate-limiter.ts +98 -0
- package/src/sampling.test.ts +513 -0
- package/src/sampling.ts +428 -0
- package/src/semantic-helpers.test.ts +311 -0
- package/src/semantic-helpers.ts +584 -0
- package/src/shutdown.test.ts +311 -0
- package/src/shutdown.ts +222 -0
- package/src/stub.integration.test.ts +361 -0
- package/src/tail-sampling-processor.test.ts +226 -0
- package/src/tail-sampling-processor.ts +51 -0
- package/src/testing.ts +670 -0
- package/src/trace-context.ts +470 -0
- package/src/trace-helpers.new.test.ts +278 -0
- package/src/trace-helpers.test.ts +242 -0
- package/src/trace-helpers.ts +690 -0
- package/src/tracer-provider.test.ts +183 -0
- package/src/tracer-provider.ts +266 -0
- package/src/track.test.ts +153 -0
- package/src/track.ts +120 -0
- package/src/validation.test.ts +306 -0
- package/src/validation.ts +239 -0
- package/src/variable-name-inference.test.ts +178 -0
- package/src/variable-name-inference.ts +242 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkW3253FGB_cjs = require('./chunk-W3253FGB.cjs');
|
|
4
|
+
require('./chunk-YTXEZ4SD.cjs');
|
|
5
|
+
var chunkNC52UBR2_cjs = require('./chunk-NC52UBR2.cjs');
|
|
6
|
+
var chunkKIXWPOCO_cjs = require('./chunk-KIXWPOCO.cjs');
|
|
7
|
+
var chunkWBWNM6LB_cjs = require('./chunk-WBWNM6LB.cjs');
|
|
8
|
+
var chunkTRI4V5BF_cjs = require('./chunk-TRI4V5BF.cjs');
|
|
9
|
+
var chunkNHCNRQD3_cjs = require('./chunk-NHCNRQD3.cjs');
|
|
10
|
+
var chunk77MSMAUQ_cjs = require('./chunk-77MSMAUQ.cjs');
|
|
11
|
+
require('./chunk-NZ72VDNY.cjs');
|
|
12
|
+
require('./chunk-UY3UYPBZ.cjs');
|
|
13
|
+
var chunkYLPNXZFI_cjs = require('./chunk-YLPNXZFI.cjs');
|
|
14
|
+
var chunkABPEQ6RK_cjs = require('./chunk-ABPEQ6RK.cjs');
|
|
15
|
+
require('./chunk-GVLK7YUU.cjs');
|
|
16
|
+
var chunkHE6T6FIX_cjs = require('./chunk-HE6T6FIX.cjs');
|
|
17
|
+
require('./chunk-4OAT42CA.cjs');
|
|
18
|
+
require('./chunk-Y4Y2S7BM.cjs');
|
|
19
|
+
var chunkURRW6M2C_cjs = require('./chunk-URRW6M2C.cjs');
|
|
20
|
+
require('./chunk-G7VZBCD6.cjs');
|
|
21
|
+
var api = require('@opentelemetry/api');
|
|
22
|
+
|
|
23
|
+
// src/shutdown.ts
|
|
24
|
+
async function flush(options) {
|
|
25
|
+
const timeout = options?.timeout ?? 2e3;
|
|
26
|
+
const doFlush = async () => {
|
|
27
|
+
const eventsQueue = chunkWBWNM6LB_cjs.getEventQueue();
|
|
28
|
+
if (eventsQueue) {
|
|
29
|
+
await eventsQueue.flush();
|
|
30
|
+
}
|
|
31
|
+
const sdk = chunkABPEQ6RK_cjs.getSdk();
|
|
32
|
+
if (sdk) {
|
|
33
|
+
try {
|
|
34
|
+
const sdkAny = sdk;
|
|
35
|
+
if (typeof sdkAny.getTracerProvider === "function") {
|
|
36
|
+
const tracerProvider = sdkAny.getTracerProvider();
|
|
37
|
+
if (tracerProvider && typeof tracerProvider.forceFlush === "function") {
|
|
38
|
+
await tracerProvider.forceFlush();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
let timeoutHandle;
|
|
46
|
+
try {
|
|
47
|
+
await Promise.race([
|
|
48
|
+
doFlush().finally(() => {
|
|
49
|
+
if (timeoutHandle) {
|
|
50
|
+
clearTimeout(timeoutHandle);
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
new Promise((_, reject) => {
|
|
54
|
+
timeoutHandle = setTimeout(
|
|
55
|
+
() => reject(new Error("Flush timeout")),
|
|
56
|
+
timeout
|
|
57
|
+
);
|
|
58
|
+
timeoutHandle.unref();
|
|
59
|
+
})
|
|
60
|
+
]);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (timeoutHandle) {
|
|
63
|
+
clearTimeout(timeoutHandle);
|
|
64
|
+
}
|
|
65
|
+
const logger = chunkABPEQ6RK_cjs.getLogger();
|
|
66
|
+
logger.error(
|
|
67
|
+
"[autotel] Flush error:",
|
|
68
|
+
error instanceof Error ? error : new Error(String(error))
|
|
69
|
+
);
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function shutdown() {
|
|
74
|
+
const logger = chunkABPEQ6RK_cjs.getLogger();
|
|
75
|
+
let shutdownError = null;
|
|
76
|
+
try {
|
|
77
|
+
await flush();
|
|
78
|
+
} catch (error) {
|
|
79
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
80
|
+
shutdownError = err;
|
|
81
|
+
logger.error(
|
|
82
|
+
"[autotel] Flush failed during shutdown, continuing cleanup",
|
|
83
|
+
err
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const sdk = chunkABPEQ6RK_cjs.getSdk();
|
|
88
|
+
if (sdk) {
|
|
89
|
+
await sdk.shutdown();
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
93
|
+
const isConnectionRefused = typeof error === "object" && error !== null && "code" in error && error.code === "ECONNREFUSED";
|
|
94
|
+
if (!isConnectionRefused) {
|
|
95
|
+
if (!shutdownError) {
|
|
96
|
+
shutdownError = err;
|
|
97
|
+
}
|
|
98
|
+
logger.error("[autotel] SDK shutdown failed", err);
|
|
99
|
+
}
|
|
100
|
+
} finally {
|
|
101
|
+
chunk77MSMAUQ_cjs.resetEvents();
|
|
102
|
+
chunkW3253FGB_cjs.resetMetrics();
|
|
103
|
+
chunkWBWNM6LB_cjs.resetEventQueue();
|
|
104
|
+
}
|
|
105
|
+
if (shutdownError) {
|
|
106
|
+
throw shutdownError;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function registerShutdownHooks() {
|
|
110
|
+
if (typeof process === "undefined") return;
|
|
111
|
+
const signals = ["SIGTERM", "SIGINT"];
|
|
112
|
+
let shuttingDown = false;
|
|
113
|
+
for (const signal of signals) {
|
|
114
|
+
process.on(signal, async () => {
|
|
115
|
+
if (shuttingDown) return;
|
|
116
|
+
shuttingDown = true;
|
|
117
|
+
if (process.env.NODE_ENV !== "test") {
|
|
118
|
+
chunkABPEQ6RK_cjs.getLogger().info(`[autotel] Received ${signal}, flushing telemetry...`);
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
await shutdown();
|
|
122
|
+
} catch (error) {
|
|
123
|
+
chunkABPEQ6RK_cjs.getLogger().error(
|
|
124
|
+
"[autotel] Error during shutdown",
|
|
125
|
+
error instanceof Error ? error : void 0
|
|
126
|
+
);
|
|
127
|
+
} finally {
|
|
128
|
+
process.exit(0);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
registerShutdownHooks();
|
|
134
|
+
|
|
135
|
+
// src/index.ts
|
|
136
|
+
chunkNHCNRQD3_cjs.init_trace_context();
|
|
137
|
+
|
|
138
|
+
Object.defineProperty(exports, "Metric", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () { return chunkW3253FGB_cjs.Metric; }
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(exports, "getMetrics", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () { return chunkW3253FGB_cjs.getMetrics; }
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, "resetMetrics", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () { return chunkW3253FGB_cjs.resetMetrics; }
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "createCounter", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () { return chunkNC52UBR2_cjs.createCounter; }
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(exports, "createHistogram", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function () { return chunkNC52UBR2_cjs.createHistogram; }
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "createObservableGauge", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function () { return chunkNC52UBR2_cjs.createObservableGauge; }
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "createUpDownCounter", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () { return chunkNC52UBR2_cjs.createUpDownCounter; }
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, "getMeter", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function () { return chunkNC52UBR2_cjs.getMeter; }
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "traceDB", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function () { return chunkKIXWPOCO_cjs.traceDB; }
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "traceHTTP", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () { return chunkKIXWPOCO_cjs.traceHTTP; }
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, "traceLLM", {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: function () { return chunkKIXWPOCO_cjs.traceLLM; }
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, "traceMessaging", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () { return chunkKIXWPOCO_cjs.traceMessaging; }
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "ctx", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () { return chunkWBWNM6LB_cjs.ctx; }
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, "instrument", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () { return chunkWBWNM6LB_cjs.instrument; }
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, "span", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () { return chunkWBWNM6LB_cjs.span; }
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "trace", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () { return chunkWBWNM6LB_cjs.trace; }
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(exports, "track", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function () { return chunkWBWNM6LB_cjs.track; }
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(exports, "withBaggage", {
|
|
207
|
+
enumerable: true,
|
|
208
|
+
get: function () { return chunkWBWNM6LB_cjs.withBaggage; }
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "withNewContext", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () { return chunkWBWNM6LB_cjs.withNewContext; }
|
|
213
|
+
});
|
|
214
|
+
Object.defineProperty(exports, "withTracing", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function () { return chunkWBWNM6LB_cjs.withTracing; }
|
|
217
|
+
});
|
|
218
|
+
Object.defineProperty(exports, "createDeterministicTraceId", {
|
|
219
|
+
enumerable: true,
|
|
220
|
+
get: function () { return chunkTRI4V5BF_cjs.createDeterministicTraceId; }
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, "finalizeSpan", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () { return chunkTRI4V5BF_cjs.finalizeSpan; }
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(exports, "flattenMetadata", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
get: function () { return chunkTRI4V5BF_cjs.flattenMetadata; }
|
|
229
|
+
});
|
|
230
|
+
Object.defineProperty(exports, "getActiveContext", {
|
|
231
|
+
enumerable: true,
|
|
232
|
+
get: function () { return chunkTRI4V5BF_cjs.getActiveContext; }
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(exports, "getActiveSpan", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function () { return chunkTRI4V5BF_cjs.getActiveSpan; }
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(exports, "getTracer", {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
get: function () { return chunkTRI4V5BF_cjs.getTracer; }
|
|
241
|
+
});
|
|
242
|
+
Object.defineProperty(exports, "runWithSpan", {
|
|
243
|
+
enumerable: true,
|
|
244
|
+
get: function () { return chunkTRI4V5BF_cjs.runWithSpan; }
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "defineBaggageSchema", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () { return chunkNHCNRQD3_cjs.defineBaggageSchema; }
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(exports, "Event", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function () { return chunk77MSMAUQ_cjs.Event; }
|
|
253
|
+
});
|
|
254
|
+
Object.defineProperty(exports, "getEvents", {
|
|
255
|
+
enumerable: true,
|
|
256
|
+
get: function () { return chunk77MSMAUQ_cjs.getEvents; }
|
|
257
|
+
});
|
|
258
|
+
Object.defineProperty(exports, "resetEvents", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function () { return chunk77MSMAUQ_cjs.resetEvents; }
|
|
261
|
+
});
|
|
262
|
+
Object.defineProperty(exports, "getOperationContext", {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
get: function () { return chunkYLPNXZFI_cjs.getOperationContext; }
|
|
265
|
+
});
|
|
266
|
+
Object.defineProperty(exports, "runInOperationContext", {
|
|
267
|
+
enumerable: true,
|
|
268
|
+
get: function () { return chunkYLPNXZFI_cjs.runInOperationContext; }
|
|
269
|
+
});
|
|
270
|
+
Object.defineProperty(exports, "BaggageSpanProcessor", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function () { return chunkABPEQ6RK_cjs.BaggageSpanProcessor; }
|
|
273
|
+
});
|
|
274
|
+
Object.defineProperty(exports, "init", {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
get: function () { return chunkABPEQ6RK_cjs.init; }
|
|
277
|
+
});
|
|
278
|
+
Object.defineProperty(exports, "AdaptiveSampler", {
|
|
279
|
+
enumerable: true,
|
|
280
|
+
get: function () { return chunkHE6T6FIX_cjs.AdaptiveSampler; }
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "AlwaysSampler", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () { return chunkHE6T6FIX_cjs.AlwaysSampler; }
|
|
285
|
+
});
|
|
286
|
+
Object.defineProperty(exports, "NeverSampler", {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
get: function () { return chunkHE6T6FIX_cjs.NeverSampler; }
|
|
289
|
+
});
|
|
290
|
+
Object.defineProperty(exports, "RandomSampler", {
|
|
291
|
+
enumerable: true,
|
|
292
|
+
get: function () { return chunkHE6T6FIX_cjs.RandomSampler; }
|
|
293
|
+
});
|
|
294
|
+
Object.defineProperty(exports, "UserIdSampler", {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
get: function () { return chunkHE6T6FIX_cjs.UserIdSampler; }
|
|
297
|
+
});
|
|
298
|
+
Object.defineProperty(exports, "getAutotelTracer", {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
get: function () { return chunkURRW6M2C_cjs.getAutotelTracer; }
|
|
301
|
+
});
|
|
302
|
+
Object.defineProperty(exports, "getAutotelTracerProvider", {
|
|
303
|
+
enumerable: true,
|
|
304
|
+
get: function () { return chunkURRW6M2C_cjs.getAutotelTracerProvider; }
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, "setAutotelTracerProvider", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function () { return chunkURRW6M2C_cjs.setAutotelTracerProvider; }
|
|
309
|
+
});
|
|
310
|
+
Object.defineProperty(exports, "SpanKind", {
|
|
311
|
+
enumerable: true,
|
|
312
|
+
get: function () { return api.SpanKind; }
|
|
313
|
+
});
|
|
314
|
+
Object.defineProperty(exports, "SpanStatusCode", {
|
|
315
|
+
enumerable: true,
|
|
316
|
+
get: function () { return api.SpanStatusCode; }
|
|
317
|
+
});
|
|
318
|
+
Object.defineProperty(exports, "context", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () { return api.context; }
|
|
321
|
+
});
|
|
322
|
+
Object.defineProperty(exports, "otelTrace", {
|
|
323
|
+
enumerable: true,
|
|
324
|
+
get: function () { return api.trace; }
|
|
325
|
+
});
|
|
326
|
+
Object.defineProperty(exports, "propagation", {
|
|
327
|
+
enumerable: true,
|
|
328
|
+
get: function () { return api.propagation; }
|
|
329
|
+
});
|
|
330
|
+
exports.flush = flush;
|
|
331
|
+
exports.shutdown = shutdown;
|
|
332
|
+
//# sourceMappingURL=index.cjs.map
|
|
333
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shutdown.ts","../src/index.ts"],"names":["getEventQueue","getSdk","getLogger","resetEvents","resetMetrics","resetEventQueue","init_trace_context"],"mappings":"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","file":"index.cjs","sourcesContent":["/**\n * Graceful shutdown with flush and cleanup\n */\n\nimport { getSdk, getLogger } from './init';\nimport { getEventQueue, resetEventQueue } from './track';\nimport { resetEvents } from './event';\nimport { resetMetrics } from './metric';\n\n/**\n * Flush all pending telemetry\n *\n * Flushes both events events and OpenTelemetry spans to their destinations.\n * Includes timeout protection to prevent hanging in serverless environments.\n *\n * Safe to call multiple times.\n *\n * @param options - Optional configuration\n * @param options.timeout - Timeout in milliseconds (default: 2000ms)\n *\n * @example Manual flush in serverless\n * ```typescript\n * import { flush } from 'autotel';\n *\n * export const handler = async (event) => {\n * // ... process event\n * await flush(); // Flush before function returns\n * return result;\n * };\n * ```\n *\n * @example With custom timeout\n * ```typescript\n * await flush({ timeout: 5000 }); // 5 second timeout\n * ```\n */\nexport async function flush(options?: { timeout?: number }): Promise<void> {\n const timeout = options?.timeout ?? 2000;\n\n const doFlush = async () => {\n // Flush events queue\n const eventsQueue = getEventQueue();\n if (eventsQueue) {\n await eventsQueue.flush();\n }\n\n // Flush OpenTelemetry spans\n // This ensures spans are exported immediately, critical for serverless\n const sdk = getSdk();\n if (sdk) {\n try {\n // Type assertion needed as getTracerProvider is not in the public NodeSDK interface\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sdkAny = sdk as any;\n if (typeof sdkAny.getTracerProvider === 'function') {\n const tracerProvider = sdkAny.getTracerProvider();\n if (\n tracerProvider &&\n typeof tracerProvider.forceFlush === 'function'\n ) {\n await tracerProvider.forceFlush();\n }\n }\n } catch {\n // Ignore errors when accessing tracer provider (may not be available in test mocks)\n }\n }\n };\n\n // Add timeout protection to prevent hanging\n let timeoutHandle: NodeJS.Timeout | undefined;\n try {\n await Promise.race([\n doFlush().finally(() => {\n // Clear timeout as soon as flush completes\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n }),\n new Promise<void>((_, reject) => {\n timeoutHandle = setTimeout(\n () => reject(new Error('Flush timeout')),\n timeout,\n );\n // Use unref() to allow Node to exit if flush completes first\n // This prevents the 2s delay in serverless when flush succeeds immediately\n timeoutHandle.unref();\n }),\n ]);\n } catch (error) {\n // Clear timeout on error too\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n const logger = getLogger();\n logger.error(\n '[autotel] Flush error:',\n error instanceof Error ? error : new Error(String(error)),\n );\n throw error;\n }\n}\n\n/**\n * Shutdown telemetry and cleanup resources\n *\n * - Flushes all pending data\n * - Shuts down OpenTelemetry SDK\n * - Cleans up resources\n *\n * Call this before process exit.\n *\n * Always performs cleanup even if flush fails, preventing resource leaks\n * in serverless handlers or tests.\n *\n * @example Express server\n * ```typescript\n * const server = app.listen(3000)\n *\n * process.on('SIGTERM', async () => {\n * await server.close()\n * await shutdown()\n * process.exit(0)\n * })\n * ```\n */\nexport async function shutdown(): Promise<void> {\n const logger = getLogger();\n let shutdownError: Error | null = null;\n\n // Attempt to flush, but continue with cleanup even if it fails\n try {\n await flush();\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n shutdownError = err;\n logger.error(\n '[autotel] Flush failed during shutdown, continuing cleanup',\n err,\n );\n }\n\n // Always shutdown SDK and clean up resources\n try {\n // Shutdown OpenTelemetry SDK\n const sdk = getSdk();\n if (sdk) {\n await sdk.shutdown();\n }\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n\n // Ignore ECONNREFUSED errors - this happens when no OTLP endpoint was configured\n // The SDK tries to flush exporters that don't exist, which is harmless\n const isConnectionRefused =\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === 'ECONNREFUSED';\n\n if (!isConnectionRefused) {\n // Only store/log non-connection errors\n if (!shutdownError) {\n shutdownError = err;\n }\n logger.error('[autotel] SDK shutdown failed', err);\n }\n } finally {\n // Clean up singleton Maps and queues to prevent memory leaks\n // This runs even if SDK shutdown fails\n resetEvents();\n resetMetrics();\n resetEventQueue();\n }\n\n // Rethrow first error after cleanup completes\n // This allows tests and CI to detect failures while still ensuring cleanup\n if (shutdownError) {\n throw shutdownError;\n }\n}\n\n/**\n * Register automatic shutdown hooks for common signals\n *\n * Handles:\n * - SIGTERM (Docker/K8s graceful shutdown)\n * - SIGINT (Ctrl+C)\n *\n * @internal Called automatically on module load\n */\nfunction registerShutdownHooks(): void {\n if (typeof process === 'undefined') return; // Not in Node.js\n\n const signals: NodeJS.Signals[] = ['SIGTERM', 'SIGINT'];\n let shuttingDown = false;\n\n for (const signal of signals) {\n process.on(signal, async () => {\n if (shuttingDown) return; // Prevent double shutdown\n shuttingDown = true;\n\n if (process.env.NODE_ENV !== 'test') {\n getLogger().info(`[autotel] Received ${signal}, flushing telemetry...`);\n }\n\n try {\n await shutdown();\n } catch (error) {\n getLogger().error(\n '[autotel] Error during shutdown',\n error instanceof Error ? error : undefined,\n );\n } finally {\n process.exit(0);\n }\n });\n }\n}\n\n// Auto-register shutdown hooks\nregisterShutdownHooks();\n","/**\n * autotel - Simplified OpenTelemetry instrumentation\n *\n * @example Minimal setup\n * ```typescript\n * import { init, trace, track } from 'autotel'\n *\n * init({ service: 'my-app' })\n *\n * export const createUser = trace(ctx => async (data: CreateUserData) => {\n * track('user.signup', { userId: data.id, plan: data.plan })\n * })\n * ```\n *\n * @example With events\n * ```typescript\n * import { init, trace, track } from 'autotel'\n * import { PostHogSubscriber } from 'autotel-subscribers'\n *\n * init({\n * service: 'my-app',\n * subscribers: [new PostHogSubscriber({ apiKey: '...' })]\n * })\n *\n * export const createUser = trace(ctx => async (data: CreateUserData) => {\n * track('user.signup', { userId: data.id })\n * })\n * ```\n */\n\n// Core initialization\nexport { init, type AutotelConfig } from './init';\n\n// Baggage span processor\nexport {\n BaggageSpanProcessor,\n type BaggageSpanProcessorOptions,\n} from './baggage-span-processor';\n\n// Functional API (re-export for convenience)\nexport type {\n TraceContext,\n SpanOptions,\n WithNewContextOptions,\n WithBaggageOptions,\n InstrumentOptions,\n} from './functional';\nexport {\n trace,\n instrument,\n withTracing,\n span,\n withNewContext,\n withBaggage,\n ctx,\n} from './functional';\n\n// Operation context (for advanced usage)\nexport type { OperationContext } from './operation-context';\nexport {\n getOperationContext,\n runInOperationContext,\n} from './operation-context';\n\n// Global track function\nexport { track } from './track';\n\n// Graceful shutdown\nexport { flush, shutdown } from './shutdown';\n\n// Re-export sampling strategies\nexport {\n type Sampler,\n type SamplingContext,\n AlwaysSampler,\n NeverSampler,\n RandomSampler,\n AdaptiveSampler,\n UserIdSampler,\n} from './sampling';\n\n// Events API\nexport { Event, getEvents, resetEvents, type EventsOptions } from './event';\n\n// Metrics API\nexport {\n Metric,\n getMetrics,\n resetMetrics,\n type MetricsOptions,\n} from './metric';\n\n// Meter helpers for custom metrics\nexport {\n getMeter,\n createCounter,\n createHistogram,\n createUpDownCounter,\n createObservableGauge,\n} from './metric-helpers';\n\n// Tracer helpers for custom spans\nexport {\n getTracer,\n getActiveSpan,\n getActiveContext,\n runWithSpan,\n finalizeSpan,\n createDeterministicTraceId,\n flattenMetadata,\n} from './trace-helpers';\n\n// Isolated tracer provider support (advanced - for library authors)\nexport {\n setAutotelTracerProvider,\n getAutotelTracerProvider,\n getAutotelTracer,\n} from './tracer-provider';\n\n// Semantic convention helpers\nexport {\n traceLLM,\n traceDB,\n traceHTTP,\n traceMessaging,\n type LLMConfig,\n type DBConfig,\n type HTTPConfig,\n type MessagingConfig,\n} from './semantic-helpers';\n\n// Re-export events types\nexport type {\n EventSubscriber,\n EventAttributes,\n FunnelStatus,\n OutcomeStatus,\n} from './event-subscriber';\n\n// Re-export OpenTelemetry APIs for convenience\n// (Users shouldn't need to import @opentelemetry/api directly)\n// Note: OTel's trace is exported as 'otelTrace' to avoid naming conflict with autotel's trace()\n// Plugin developers can also access it directly: import { otelTrace } from 'autotel'\nexport {\n context,\n propagation,\n SpanStatusCode,\n trace as otelTrace,\n} from '@opentelemetry/api';\n\n// Re-export common OpenTelemetry types and utilities\n// This allows plugins and apps to use OTel without needing separate @opentelemetry/api installation\nexport type { Span, SpanContext, Tracer, Context } from '@opentelemetry/api';\nexport { SpanKind } from '@opentelemetry/api';\n// Note: trace exported from functional.ts, context/propagation/SpanStatusCode already exported above\n\n// Export typed baggage helper\nexport { defineBaggageSchema } from './trace-context';\n"]}
|