@blaxel/telemetry 0.2.17-dev.130 → 0.2.17-dev.131

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 CHANGED
@@ -231,8 +231,8 @@ class TelemetryManager {
231
231
  // Manual trace context extraction for debugging
232
232
  if (headers.traceparent) {
233
233
  const extractedContext = api_1.propagation.extract(api_1.context.active(), headers);
234
- core_1.logger.debug("Active context:", JSON.stringify(api_1.context.active()));
235
- core_1.logger.debug("Extracted context:", JSON.stringify(extractedContext));
234
+ core_1.logger.debug("Active context keys:", Object.keys(api_1.context.active()));
235
+ core_1.logger.debug("Extracted context keys:", Object.keys(extractedContext));
236
236
  // const extractedSpan = trace.getSpan(extractedContext);
237
237
  // if (extractedSpan) {
238
238
  // // Force set the extracted span as active
@@ -289,10 +289,15 @@ class TelemetryManager {
289
289
  core_1.logger.debug("Manual context extraction error:", error);
290
290
  }
291
291
  }
292
- core_1.logger.debug("Span:", JSON.stringify(span));
293
- core_1.logger.debug("Span context:", JSON.stringify(span.spanContext()));
294
- // Log the span context that was created from the incoming request
292
+ // Safe logging of span information without circular references
295
293
  const spanContext = span.spanContext();
294
+ core_1.logger.debug("Span created:", {
295
+ spanId: spanContext.spanId,
296
+ traceId: spanContext.traceId,
297
+ traceFlags: spanContext.traceFlags,
298
+ });
299
+ core_1.logger.debug("Span context:", spanContext);
300
+ // Log the span context that was created from the incoming request
296
301
  core_1.logger.debug("HTTP span context:", JSON.stringify({
297
302
  traceId: spanContext.traceId,
298
303
  spanId: spanContext.spanId,
@@ -48,27 +48,37 @@ class OtelTelemetryProvider {
48
48
  attributes: options?.attributes,
49
49
  root: options?.isRoot,
50
50
  };
51
- core_1.logger.debug("Options:", JSON.stringify(options));
52
- core_1.logger.debug("OTel span options:", JSON.stringify(otelOptions));
51
+ core_1.logger.debug("Options:", options
52
+ ? {
53
+ attributes: options.attributes,
54
+ isRoot: options.isRoot,
55
+ hasParentContext: !!options.parentContext,
56
+ }
57
+ : null);
58
+ core_1.logger.debug("OTel span options:", otelOptions);
53
59
  // Handle parent context properly with debugging
54
60
  let ctx = api_1.context.active();
55
61
  const activeSpan = api_1.trace.getActiveSpan();
56
- core_1.logger.debug("Active context:", JSON.stringify(ctx));
57
- core_1.logger.debug("Active span:", JSON.stringify(activeSpan));
58
- core_1.logger.debug("Active span context:", JSON.stringify(activeSpan?.spanContext()));
62
+ core_1.logger.debug("Active context keys:", Object.keys(ctx));
63
+ core_1.logger.debug("Active span:", activeSpan
64
+ ? {
65
+ spanId: activeSpan.spanContext().spanId,
66
+ traceId: activeSpan.spanContext().traceId,
67
+ }
68
+ : null);
69
+ core_1.logger.debug("Active span context:", activeSpan ? activeSpan.spanContext() : null);
59
70
  // Debug logging for context issues
60
- core_1.logger.info(`Creating span "${name}":`, JSON.stringify({
71
+ core_1.logger.info(`Creating span "${name}":`, {
61
72
  hasActiveSpan: !!activeSpan,
62
73
  activeSpanId: activeSpan?.spanContext().spanId,
63
74
  isRoot: options?.isRoot,
64
75
  hasParentContext: !!options?.parentContext,
65
- parentContext: JSON.stringify(options?.parentContext),
66
- activeContext: JSON.stringify(ctx),
67
- otelOptions: JSON.stringify(otelOptions),
68
- activeTraceId: activeSpan?.spanContext().traceId,
76
+ parentContext: options?.parentContext,
69
77
  contextKeys: Object.keys(ctx),
70
78
  telemetryActive: telemetry_1.blaxelTelemetry.isActive,
71
- }));
79
+ activeTraceId: activeSpan?.spanContext().traceId,
80
+ otelOptions: otelOptions,
81
+ });
72
82
  if (options?.parentContext) {
73
83
  // If explicit parent context is provided, use it
74
84
  ctx = api_1.trace.setSpanContext(api_1.ROOT_CONTEXT, options.parentContext);
@@ -81,15 +91,20 @@ class OtelTelemetryProvider {
81
91
  // Start the span with proper context
82
92
  const span = tracer.startSpan(name, otelOptions, ctx);
83
93
  const otelSpan = new OtelSpan(span);
84
- core_1.logger.debug("Span:", JSON.stringify(span));
85
- core_1.logger.debug("Span context:", JSON.stringify(span.spanContext()));
86
- // Additional debugging
94
+ // Safe logging of span information without circular references
87
95
  const spanContext = span.spanContext();
88
- core_1.logger.info(`Created span "${name}":`, JSON.stringify({
96
+ core_1.logger.debug("Span created:", {
97
+ spanId: spanContext.spanId,
98
+ traceId: spanContext.traceId,
99
+ traceFlags: spanContext.traceFlags,
100
+ });
101
+ core_1.logger.debug("Span context:", spanContext);
102
+ // Additional debugging
103
+ core_1.logger.info(`Created span "${name}":`, {
89
104
  spanId: spanContext.spanId,
90
105
  traceId: spanContext.traceId,
91
106
  parentSpanId: activeSpan?.spanContext().spanId || "none",
92
- }));
107
+ });
93
108
  return otelSpan;
94
109
  }
95
110
  async flush() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/telemetry",
3
- "version": "0.2.17-dev.130",
3
+ "version": "0.2.17-dev.131",
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.130"
74
+ "@blaxel/core": "0.2.17-dev.131"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/js": "^9.26.0",