blaxel 0.1.18rc63__py3-none-any.whl → 0.1.18rc65__py3-none-any.whl

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.
blaxel/common/logger.py CHANGED
@@ -6,8 +6,7 @@ import json
6
6
  import logging
7
7
  import os
8
8
 
9
- from opentelemetry import trace
10
- from opentelemetry import context as context_api
9
+ from opentelemetry.trace import get_current_span
11
10
 
12
11
 
13
12
  class JsonFormatter(logging.Formatter):
@@ -36,19 +35,18 @@ class JsonFormatter(logging.Formatter):
36
35
  self.labels_name: {}
37
36
  }
38
37
 
39
- # Try to get the current span from context
40
- # Get current span - try multiple approaches
41
- current_span = trace.get_current_span()
38
+ # Get current active span - equivalent to trace.getActiveSpan() in JS
39
+ current_span = get_current_span()
42
40
 
43
- # If that doesn't work, try getting from current context explicitly
44
- if not current_span.is_recording():
45
- ctx = context_api.get_current()
46
- current_span = trace.get_current_span(ctx)
47
-
48
- if current_span.is_recording():
41
+ # Check if span exists and has valid context (equivalent to 'if (currentSpan)' in JS)
42
+ if current_span and current_span.get_span_context().is_valid:
49
43
  span_context = current_span.get_span_context()
50
- log_entry[self.trace_id_name] = f"{self.trace_id_prefix}{span_context.trace_id}"
51
- log_entry[self.span_id_name] = f"{self.span_id_prefix}{span_context.span_id}"
44
+ # Format trace_id and span_id as hex strings (like JS does)
45
+ trace_id_hex = format(span_context.trace_id, '032x')
46
+ span_id_hex = format(span_context.span_id, '016x')
47
+
48
+ log_entry[self.trace_id_name] = f"{self.trace_id_prefix}{trace_id_hex}"
49
+ log_entry[self.span_id_name] = f"{self.span_id_prefix}{span_id_hex}"
52
50
 
53
51
  # Add task ID if available
54
52
  task_id = os.environ.get(self.task_index)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blaxel
3
- Version: 0.1.18rc63
3
+ Version: 0.1.18rc65
4
4
  Summary: Add your description here
5
5
  Project-URL: Homepage, https://blaxel.ai
6
6
  Project-URL: Documentation, https://docs.blaxel.ai
@@ -285,7 +285,7 @@ blaxel/client/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS1
285
285
  blaxel/common/autoload.py,sha256=NFuK71-IHOY2JQyEBSjDCVfUaQ8D8PJsEUEryIdG4AU,263
286
286
  blaxel/common/env.py,sha256=wTbzPDdNgz4HMJiS2NCZmQlN0qpxy1PQEYBaZgtvhoc,1247
287
287
  blaxel/common/internal.py,sha256=6lZENUQrh3bvpMIPLaie6-g2upiNzf21QG-dQ0hGJWU,2371
288
- blaxel/common/logger.py,sha256=-2_aTQgo8VDKqR8VoM16EcJ5i8Z7l8VmqHi5MoYAuLg,4462
288
+ blaxel/common/logger.py,sha256=TNuWqwFDU87TwPDHLLDTluwgEyw2axj-d0kPOkN5J8M,4489
289
289
  blaxel/common/settings.py,sha256=7KTryuBdud0IfHqykX7xEEtpgq5M5h1Z8YEzYKsHB-Q,2327
290
290
  blaxel/instrumentation/exporters.py,sha256=EoX3uaBVku1Rg49pSNXKFyHhgY5OV3Ih6UlqgjF5epw,1670
291
291
  blaxel/instrumentation/log.py,sha256=RvQByRjZMoP_dRaAZu8oK6DTegsHs-xV4W-UIqis6CA,2461
@@ -364,7 +364,7 @@ blaxel/tools/llamaindex.py,sha256=-gQ-C9V_h9a11J4ItsbWjXrCJOg0lRKsb98v9rVsNak,71
364
364
  blaxel/tools/openai.py,sha256=GuFXkj6bXEwldyVr89jEsRAi5ihZUVEVe327QuWiGNs,653
365
365
  blaxel/tools/pydantic.py,sha256=CvnNbAG_J4yBtA-XFI4lQrq3FYKjNd39hu841vZT004,1801
366
366
  blaxel/tools/types.py,sha256=YPCGJ4vZDhqR0X2H_TWtc5chQScsC32nGTQdRKJlO8Y,707
367
- blaxel-0.1.18rc63.dist-info/METADATA,sha256=3r5AE3YTRl2qSwnNTwkZHxKLML9N-pat_lbJlnVrBrA,6706
368
- blaxel-0.1.18rc63.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
369
- blaxel-0.1.18rc63.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
370
- blaxel-0.1.18rc63.dist-info/RECORD,,
367
+ blaxel-0.1.18rc65.dist-info/METADATA,sha256=ddggGZuNM7FiX7SPdRJ_SSXvSGP7HzfGy9F4dgCPDLg,6706
368
+ blaxel-0.1.18rc65.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
369
+ blaxel-0.1.18rc65.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
370
+ blaxel-0.1.18rc65.dist-info/RECORD,,