Skip to content

Commit d931d4f

Browse files
authored
Merge pull request #386 from UiPath/fix/tracing_errors
feat(tracing): otel status error description to attributes error
2 parents 4f9cf49 + 163c4df commit d931d4f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.0.57"
3+
version = "2.0.58"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

src/uipath/tracing/_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ def otel_span_to_uipath_span(otel_span: ReadableSpan) -> UiPathSpan:
134134
if otel_span.parent is not None:
135135
parent_id = _SpanUtils.span_id_to_uuid4(otel_span.parent.span_id)
136136

137-
# Map status
138-
status = 1 # Default to OK
139-
if otel_span.status.status_code == StatusCode.ERROR:
140-
status = 2 # Error
141-
142137
# Convert attributes to a format compatible with UiPathSpan
143138
attributes_dict: dict[str, Any] = (
144139
dict(otel_span.attributes) if otel_span.attributes else {}
145140
)
146141

142+
# Map status
143+
status = 1 # Default to OK
144+
if otel_span.status.status_code == StatusCode.ERROR:
145+
status = 2 # Error
146+
attributes_dict["error"] = otel_span.status.description
147+
147148
original_inputs = attributes_dict.get("inputs", None)
148149
original_outputs = attributes_dict.get("outputs", None)
149150

tests/tracing/test_span_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def test_otel_span_to_uipath_span(self):
114114
assert attributes["key2"] == 123
115115

116116
# Test with error status
117+
mock_span.status.description = "Test error description"
117118
mock_span.status.status_code = StatusCode.ERROR
118119
uipath_span = _SpanUtils.otel_span_to_uipath_span(mock_span)
119120
assert uipath_span.status == 2 # Error

0 commit comments

Comments
 (0)