Skip to content

Commit d52bcf1

Browse files
cfauchereClement Fauchereclaude
authored
fix(platform): use LLMOps span ID in trace header (#1547)
Co-authored-by: Clement Fauchere <clement.fauchere@uipath.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3b4cba5 commit d52bcf1

4 files changed

Lines changed: 12 additions & 5 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.21"
3+
version = "0.1.22"
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/_base_service.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,15 @@ def _get_caller_component() -> str:
6767

6868

6969
def _inject_trace_context(headers: dict[str, str]) -> None:
70-
"""Inject UiPath trace context header from the active OTEL span."""
71-
span = trace.get_current_span()
70+
"""Inject UiPath trace context header from the active OTEL span.
71+
72+
Prefers the LLMOps tool span (from ContextVar) over the raw OTEL span,
73+
so the header carries the span ID visible in the LLMOps trace.
74+
"""
75+
from uipath.core.tracing.span_utils import UiPathSpanUtils
76+
77+
llmops_span = UiPathSpanUtils.get_external_current_span()
78+
span = llmops_span or trace.get_current_span()
7279
ctx = span.get_span_context()
7380
if ctx.trace_id and ctx.span_id:
7481
headers[_TRACE_PARENT_HEADER] = (

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