@blaxel/telemetry 0.2.17-dev.127 → 0.2.17-dev.129
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/dist/telemetry.d.ts +0 -4
- package/dist/telemetry.js +19 -33
- package/package.json +2 -2
package/dist/telemetry.d.ts
CHANGED
|
@@ -46,10 +46,6 @@ declare class TelemetryManager {
|
|
|
46
46
|
* Check if telemetry is properly initialized and active
|
|
47
47
|
*/
|
|
48
48
|
get isActive(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Re-initialize telemetry if it was shut down
|
|
51
|
-
*/
|
|
52
|
-
reinitialize(): Promise<void>;
|
|
53
49
|
/**
|
|
54
50
|
* Get resource attributes for OpenTelemetry.
|
|
55
51
|
*/
|
package/dist/telemetry.js
CHANGED
|
@@ -159,23 +159,6 @@ class TelemetryManager {
|
|
|
159
159
|
this.nodeTracerProvider !== null &&
|
|
160
160
|
this.meterProvider !== null);
|
|
161
161
|
}
|
|
162
|
-
/**
|
|
163
|
-
* Re-initialize telemetry if it was shut down
|
|
164
|
-
*/
|
|
165
|
-
async reinitialize() {
|
|
166
|
-
if (!this.isActive) {
|
|
167
|
-
core_1.logger.info("Reinitializing telemetry...");
|
|
168
|
-
this.initialized = false;
|
|
169
|
-
this.configured = false;
|
|
170
|
-
this.nodeTracerProvider = null;
|
|
171
|
-
this.meterProvider = null;
|
|
172
|
-
this.loggerProvider = null;
|
|
173
|
-
this.otelLogger = null;
|
|
174
|
-
this.initialize();
|
|
175
|
-
await this.setConfiguration();
|
|
176
|
-
core_1.logger.info("Telemetry reinitialized successfully");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
162
|
/**
|
|
180
163
|
* Get resource attributes for OpenTelemetry.
|
|
181
164
|
*/
|
|
@@ -248,13 +231,18 @@ class TelemetryManager {
|
|
|
248
231
|
// Manual trace context extraction for debugging
|
|
249
232
|
if (headers.traceparent) {
|
|
250
233
|
const extractedContext = api_1.propagation.extract(api_1.context.active(), headers);
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
234
|
+
core_1.logger.debug("Active context:", JSON.stringify(api_1.context.active()));
|
|
235
|
+
core_1.logger.debug("Extracted context:", JSON.stringify(extractedContext));
|
|
236
|
+
// const extractedSpan = trace.getSpan(extractedContext);
|
|
237
|
+
// if (extractedSpan) {
|
|
238
|
+
// // Force set the extracted span as active
|
|
239
|
+
// context.with(
|
|
240
|
+
// trace.setSpan(context.active(), extractedSpan),
|
|
241
|
+
// () => {
|
|
242
|
+
// logger.debug("Forced context activation from traceparent");
|
|
243
|
+
// }
|
|
244
|
+
// );
|
|
245
|
+
// }
|
|
258
246
|
try {
|
|
259
247
|
const traceparentValue = Array.isArray(headers.traceparent)
|
|
260
248
|
? headers.traceparent[0]
|
|
@@ -278,8 +266,11 @@ class TelemetryManager {
|
|
|
278
266
|
core_1.logger.debug("Traceparent contains invalid IDs");
|
|
279
267
|
}
|
|
280
268
|
}
|
|
281
|
-
// Extract trace context manually to see what should be extracted
|
|
282
|
-
const extractedContext =
|
|
269
|
+
// // Extract trace context manually to see what should be extracted
|
|
270
|
+
// const extractedContext = propagation.extract(
|
|
271
|
+
// context.active(),
|
|
272
|
+
// headers
|
|
273
|
+
// );
|
|
283
274
|
const extractedSpan = api_1.trace.getSpan(extractedContext);
|
|
284
275
|
if (extractedSpan) {
|
|
285
276
|
const extractedSpanContext = extractedSpan.spanContext();
|
|
@@ -298,6 +289,8 @@ class TelemetryManager {
|
|
|
298
289
|
core_1.logger.debug("Manual context extraction error:", error);
|
|
299
290
|
}
|
|
300
291
|
}
|
|
292
|
+
core_1.logger.debug("Span:", JSON.stringify(span));
|
|
293
|
+
core_1.logger.debug("Span context:", JSON.stringify(span.spanContext()));
|
|
301
294
|
// Log the span context that was created from the incoming request
|
|
302
295
|
const spanContext = span.spanContext();
|
|
303
296
|
core_1.logger.debug("HTTP span context:", JSON.stringify({
|
|
@@ -387,13 +380,6 @@ class TelemetryManager {
|
|
|
387
380
|
Promise.all(shutdownPromises),
|
|
388
381
|
new Promise((resolve) => setTimeout(resolve, 5000)), // 5 second timeout
|
|
389
382
|
]);
|
|
390
|
-
// Reset state variables so isActive returns false
|
|
391
|
-
this.nodeTracerProvider = null;
|
|
392
|
-
this.meterProvider = null;
|
|
393
|
-
this.loggerProvider = null;
|
|
394
|
-
this.otelLogger = null;
|
|
395
|
-
this.initialized = false;
|
|
396
|
-
this.configured = false;
|
|
397
383
|
core_1.logger.debug("Instrumentation shutdown complete");
|
|
398
384
|
process.exit(0);
|
|
399
385
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/telemetry",
|
|
3
|
-
"version": "0.2.17-dev.
|
|
3
|
+
"version": "0.2.17-dev.129",
|
|
4
4
|
"description": "Blaxel SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
72
72
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
73
73
|
"ai": "^4.3.13",
|
|
74
|
-
"@blaxel/core": "0.2.17-dev.
|
|
74
|
+
"@blaxel/core": "0.2.17-dev.129"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@eslint/js": "^9.26.0",
|