@blaxel/telemetry 0.2.17-dev.114 → 0.2.17-dev.116
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.js +39 -0
- package/package.json +2 -2
package/dist/telemetry.js
CHANGED
|
@@ -195,6 +195,9 @@ class TelemetryManager {
|
|
|
195
195
|
core_1.telemetryRegistry.registerProvider(new telemetry_provider_1.OtelTelemetryProvider());
|
|
196
196
|
const httpInstrumentation = new instrumentation_http_1.HttpInstrumentation({
|
|
197
197
|
requireParentforOutgoingSpans: true,
|
|
198
|
+
requireParentforIncomingSpans: false, // Allow root spans for incoming requests
|
|
199
|
+
ignoreIncomingRequestHook: () => false, // Don't ignore any requests
|
|
200
|
+
ignoreOutgoingRequestHook: () => false, // Don't ignore any requests
|
|
198
201
|
requestHook: (span, request) => {
|
|
199
202
|
// Log incoming headers for debugging
|
|
200
203
|
if ("headers" in request && request.headers) {
|
|
@@ -208,6 +211,32 @@ class TelemetryManager {
|
|
|
208
211
|
"x-blaxel-workspace": headers["x-blaxel-workspace"],
|
|
209
212
|
};
|
|
210
213
|
core_1.logger.debug("Trace context headers:", JSON.stringify(traceHeaders));
|
|
214
|
+
// Manual trace context extraction for debugging
|
|
215
|
+
if (headers.traceparent) {
|
|
216
|
+
try {
|
|
217
|
+
const traceparentValue = Array.isArray(headers.traceparent)
|
|
218
|
+
? headers.traceparent[0]
|
|
219
|
+
: headers.traceparent;
|
|
220
|
+
core_1.logger.debug("Manual traceparent parsing:", traceparentValue);
|
|
221
|
+
// Extract trace context manually to see what should be extracted
|
|
222
|
+
const extractedContext = api_1.propagation.extract(api_1.context.active(), headers);
|
|
223
|
+
const extractedSpan = api_1.trace.getSpan(extractedContext);
|
|
224
|
+
if (extractedSpan) {
|
|
225
|
+
const extractedSpanContext = extractedSpan.spanContext();
|
|
226
|
+
core_1.logger.debug("Manual context extraction result:", JSON.stringify({
|
|
227
|
+
traceId: extractedSpanContext.traceId,
|
|
228
|
+
spanId: extractedSpanContext.spanId,
|
|
229
|
+
traceFlags: extractedSpanContext.traceFlags,
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
core_1.logger.debug("Manual context extraction failed - no span found");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
core_1.logger.debug("Manual context extraction error:", error);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
211
240
|
// Log the span context that was created from the incoming request
|
|
212
241
|
const spanContext = span.spanContext();
|
|
213
242
|
core_1.logger.debug("HTTP span context:", JSON.stringify({
|
|
@@ -217,12 +246,22 @@ class TelemetryManager {
|
|
|
217
246
|
}));
|
|
218
247
|
}
|
|
219
248
|
},
|
|
249
|
+
responseHook: (span) => {
|
|
250
|
+
const spanContext = span.spanContext();
|
|
251
|
+
core_1.logger.debug("HTTP response span context:", JSON.stringify({
|
|
252
|
+
traceId: spanContext.traceId,
|
|
253
|
+
spanId: spanContext.spanId,
|
|
254
|
+
traceFlags: spanContext.traceFlags,
|
|
255
|
+
}));
|
|
256
|
+
},
|
|
220
257
|
});
|
|
221
258
|
(0, instrumentation_1.registerInstrumentations)({
|
|
222
259
|
instrumentations: [httpInstrumentation],
|
|
223
260
|
});
|
|
224
261
|
}
|
|
225
262
|
setExporters() {
|
|
263
|
+
// Log current propagators for debugging
|
|
264
|
+
core_1.logger.debug("Current propagators:", api_1.propagation.fields());
|
|
226
265
|
const resource = new BlaxelResource(this.resourceAttributes);
|
|
227
266
|
const logExporter = this.getLogExporter();
|
|
228
267
|
this.loggerProvider = new sdk_logs_1.LoggerProvider({
|
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.116",
|
|
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.116"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@eslint/js": "^9.26.0",
|