Skip to content

Commit f2cffbb

Browse files
ionmincuclaude
andauthored
fix(tracing): set Traces source to CodedAgents (#1631)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dc5319f commit f2cffbb

8 files changed

Lines changed: 17 additions & 17 deletions

File tree

packages/uipath-platform/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-platform"
3-
version = "0.1.48"
3+
version = "0.1.49"
44
description = "HTTP client library for programmatic access to UiPath Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-platform/src/uipath/platform/common/_span_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
logger = logging.getLogger(__name__)
1717

18-
# SourceEnum.Robots = 4 (default for Python SDK / coded agents)
19-
DEFAULT_SOURCE = 4
18+
# SourceEnum.CodedAgents = 10 (default for Python SDK / coded agents)
19+
DEFAULT_SOURCE = 10
2020

2121

2222
class AttachmentProvider(IntEnum):

packages/uipath-platform/tests/services/test_span_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ def test_uipath_span_missing_execution_type_and_agent_version(self):
363363
assert span_dict["AgentVersion"] is None
364364

365365
@patch.dict(os.environ, {"UIPATH_ORGANIZATION_ID": "test-org"})
366-
def test_uipath_span_source_defaults_to_robots(self):
367-
"""Test that Source defaults to 4 (Robots) and ignores attributes.source."""
366+
def test_uipath_span_source_defaults_to_coded_agents(self):
367+
"""Test that Source defaults to 10 (CodedAgents) and ignores attributes.source."""
368368
mock_span = Mock(spec=OTelSpan)
369369

370370
trace_id = 0x123456789ABCDEF0123456789ABCDEF0
@@ -387,9 +387,9 @@ def test_uipath_span_source_defaults_to_robots(self):
387387
uipath_span = _SpanUtils.otel_span_to_uipath_span(mock_span)
388388
span_dict = uipath_span.to_dict()
389389

390-
# Top-level Source should be 4 (Robots), string "runtime" is ignored
391-
assert uipath_span.source == 4
392-
assert span_dict["Source"] == 4
390+
# Top-level Source should be 10 (CodedAgents), string "runtime" is ignored
391+
assert uipath_span.source == 10
392+
assert span_dict["Source"] == 10
393393

394394
# attributes.source string should still be in Attributes JSON
395395
attrs = json.loads(span_dict["Attributes"])
@@ -408,7 +408,7 @@ def test_uipath_span_source_override_with_uipath_source(self):
408408
mock_span.name = "test-span"
409409
mock_span.parent = None
410410
mock_span.status.status_code = StatusCode.OK
411-
# uipath.source=1 (Agents) overrides default of 4 (Robots)
411+
# uipath.source=1 (Agents) overrides default of 10 (CodedAgents)
412412
mock_span.attributes = {"uipath.source": 1, "source": "runtime"}
413413
mock_span.events = []
414414
mock_span.links = []

packages/uipath-platform/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/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.10.63"
3+
version = "2.10.64"
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.11"

packages/uipath/src/uipath/tracing/_otel_exporters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def _process_span_attributes(self, span_data: Dict[str, Any]) -> None:
389389
def _build_url(self, span_list: list[Dict[str, Any]]) -> str:
390390
"""Construct the URL for the API request."""
391391
trace_id = str(span_list[0]["TraceId"])
392-
return f"{self.base_url}/api/Traces/spans?traceId={trace_id}&source=Robots"
392+
return f"{self.base_url}/api/Traces/spans?traceId={trace_id}&source=CodedAgents"
393393

394394
def _send_with_retries(
395395
self, url: str, payload: list[Dict[str, Any]], max_retries: int = 4

packages/uipath/tests/tracing/test_otel_exporters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def exporter(mock_env_vars):
5454
exporter = LlmOpsHttpExporter()
5555
# Mock _build_url to include query parameters as in the actual implementation
5656
exporter._build_url = MagicMock( # type: ignore
57-
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=Robots"
57+
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=CodedAgents"
5858
)
5959
yield exporter
6060

@@ -107,7 +107,7 @@ def test_export_success(exporter, mock_span):
107107
[{"span": "data", "TraceId": "test-trace-id"}]
108108
)
109109
exporter.http_client.post.assert_called_once_with(
110-
"https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=Robots",
110+
"https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=CodedAgents",
111111
json=[{"span": "data", "TraceId": "test-trace-id"}],
112112
)
113113

@@ -685,7 +685,7 @@ def exporter_with_mocks(self, mock_env_vars):
685685
with patch("uipath.tracing._otel_exporters.httpx.Client"):
686686
exporter = LlmOpsHttpExporter()
687687
exporter._build_url = MagicMock( # type: ignore
688-
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=Robots"
688+
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=CodedAgents"
689689
)
690690
yield exporter
691691

packages/uipath/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)