Skip to content

Commit 50064b6

Browse files
authored
fix(py): include missing attributes in traces (extra, error, serialized) (#2017)
Fixes: #2014
1 parent 94ed456 commit 50064b6

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

python/langsmith/_internal/_operations.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ def calculate_serialized_size(self) -> int:
9797
size += len(data_or_path)
9898
return size
9999

100+
def deserialize_run_info(self) -> dict:
101+
"""Deserialize the main run info (_none and extra, error and serialized)."""
102+
run_info = _orjson.loads(self._none)
103+
if self.extra is not None:
104+
run_info["extra"] = _orjson.loads(self.extra)
105+
106+
if self.error is not None:
107+
run_info["error"] = _orjson.loads(self.error)
108+
109+
if self.serialized is not None:
110+
run_info["serialized"] = _orjson.loads(self.serialized)
111+
112+
return run_info
113+
100114
def __eq__(self, other: object) -> bool:
101115
return isinstance(other, SerializedRunOperation) and (
102116
self.operation,

python/langsmith/_internal/otel/_otel_exporter.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,7 @@ def _deserialize_run_info(self, op: SerializedRunOperation) -> Optional[dict]:
224224
failed.
225225
"""
226226
try:
227-
run_info = _orjson.loads(op._none)
228-
229-
# convert run_info to a Run Schema
230-
return run_info
227+
return op.deserialize_run_info()
231228
except Exception as e:
232229
logger.exception(f"Failed to deserialize run info for {op.id}: {e}")
233230
return None

python/uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)