Skip to content

(wip) feat(tracing): migrate span ingestion to v3 API with string enums#1684

Draft
saksharthakkar wants to merge 12 commits into
mainfrom
feat/trace-v3-migration
Draft

(wip) feat(tracing): migrate span ingestion to v3 API with string enums#1684
saksharthakkar wants to merge 12 commits into
mainfrom
feat/trace-v3-migration

Conversation

@saksharthakkar
Copy link
Copy Markdown
Contributor

Motivation

The UiPath LLM Observability backend is introducing V3 span APIs with insert-only ingestion semantics. The V3 endpoint rejects integer enum values — all status, source, verbosity, and execution type fields must be strings (e.g. "Ok" not 1). This PR migrates the Python SDK's span ingestion pipeline to conform to the V3 contract.

Summary

  • _span_utils.py: Replace IntEnum-based VerbosityLevel with StrEnum; add SpanStatus, SpanSource, ExecutionType as StrEnum types with values matching C# server enum names exactly ("Ok", "CodedAgents", "Information", "Runtime"). Add int→StrEnum lookup dicts for bridging raw OTEL attribute integers to enum members. Update UiPathSpan field types from int to the new enums. Update otel_span_to_uipath_span() to produce string enum values.
  • _otel_exporters.py: Remove the old integer SpanStatus class and inner Status class. Import SpanStatus from _span_utils. Update _build_url() from /api/Traces/spans/api/Traces/v3/spans. Update _determine_status() return type and upsert_span() parameter type.
  • _live_tracking_processor.py: Update SpanStatus import to come from _span_utils instead of _otel_exporters. Update _upsert_span_async type annotation from int | None to SpanStatus | None.
  • platform/common/__init__.py: Export ExecutionType, SpanSource, SpanStatus (new public types).
  • tracing/__init__.py: Re-export SpanStatus from _span_utils instead of _otel_exporters.
  • Tests: Updated test_span_utils.py with StrEnum unit tests and enum value assertions. Updated test_otel_exporters.py with v3 URL assertions, string enum body assertions, and a new TestV3EndToEnd integration test.

Test plan

  • packages/uipath-platform: 1212 passed, 0 failed
  • packages/uipath: 1866 passed, 0 failed
  • mypy src tests clean on both packages (0 errors)
  • ruff check + ruff format --check clean on both packages
  • TestV3EndToEnd.test_export_posts_to_v3_url_with_string_enums — end-to-end: real OTel span → LlmOpsHttpExporter → asserts POST to v3/spans with "Status": "Ok" and "Source": "CodedAgents" as strings

🤖 Generated with Claude Code

saksharthakkar and others added 11 commits May 26, 2026 12:01
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vel StrEnums

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rEnum types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…string enums

- Import SpanStatus from uipath.platform.common._span_utils (StrEnum)
- Remove local int-based SpanStatus class and inner Status class
- Update _build_url to /api/Traces/v3/spans
- Update _determine_status() return type to SpanStatus (string values)
- Update upsert_span status_override param type to Optional[SpanStatus]
- Update debug log message to reference v3 path
- Add 4 new tests verifying v3 URL and string enum status values
- Fix VerbosityLevel.OFF assertion from int 6 to string "Off"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…m platform.common

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gration

Fix ruff import-sort and formatting in span_utils tests and otel_exporters;
add TestV3EndToEnd integration test asserting v3/spans URL and string enum
values (Status="Ok", Source="CodedAgents") reach the HTTP layer end-to-end.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…wboat doc

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels May 26, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant