Skip to content

Commit a6990d8

Browse files
fix: filter dropped spans in upsert_span to match export behavior (#1118)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 96091f5 commit a6990d8

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

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.4.23"
3+
version = "2.4.24"
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"

src/uipath/tracing/_otel_exporters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ def upsert_span(
188188
Returns:
189189
SpanExportResult indicating success or failure
190190
"""
191+
if self._should_drop_span(span):
192+
return SpanExportResult.SUCCESS
193+
191194
span_data = _SpanUtils.otel_span_to_uipath_span(
192195
span, custom_trace_id=self.trace_id, serialize_attributes=False
193196
).to_dict(serialize_attributes=False)

tests/tracing/test_otel_exporters.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,16 @@ def test_upsert_span_failure_retries(self, exporter_with_mocks, mock_span):
737737
assert result == SpanExportResult.FAILURE
738738
assert exporter_with_mocks.http_client.post.call_count == 4 # max_retries=4
739739

740+
def test_upsert_span_filters_dropped_spans(self, exporter_with_mocks):
741+
"""upsert_span should skip spans marked with telemetry.filter=drop."""
742+
span = MagicMock(spec=ReadableSpan)
743+
span.attributes = {"telemetry.filter": "drop"}
744+
745+
result = exporter_with_mocks.upsert_span(span)
746+
747+
assert result == SpanExportResult.SUCCESS
748+
exporter_with_mocks.http_client.post.assert_not_called()
749+
740750

741751
if __name__ == "__main__":
742752
unittest.main()

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.

0 commit comments

Comments
 (0)