Skip to content

Commit 787f154

Browse files
authored
Merge pull request #6 from UiPath/fix/remove_tracing
fix: simplify execution id
2 parents 68e8d70 + 91d5345 commit 787f154

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/uipath/runtime/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, context: UiPathRuntimeContext):
4444
async def get_schema(self) -> UiPathRuntimeSchema:
4545
"""Get schema for this runtime.
4646
47-
Returns: A entrypoint for this runtime.
47+
Returns: The runtime's schema (entrypoint type, input/output json schema).
4848
"""
4949
raise NotImplementedError()
5050

src/uipath/runtime/factory.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,15 @@ async def stream(
127127
async def execute_in_root_span(
128128
self,
129129
runtime: UiPathBaseRuntime,
130-
execution_id: Optional[str] = None,
131130
root_span: str = "root",
132131
attributes: Optional[dict[str, str]] = None,
133132
) -> UiPathRuntimeResult:
134133
"""Execute runtime with context in a root span."""
135134
try:
136135
tracer: Tracer = trace.get_tracer("uipath-runtime")
137136
span_attributes = {}
138-
if execution_id:
139-
span_attributes["execution.id"] = execution_id
137+
if runtime.context.execution_id:
138+
span_attributes["execution.id"] = runtime.context.execution_id
140139
if attributes:
141140
span_attributes.update(attributes)
142141

@@ -151,7 +150,6 @@ async def execute_in_root_span(
151150
async def stream_in_root_span(
152151
self,
153152
runtime: UiPathBaseRuntime,
154-
execution_id: Optional[str] = None,
155153
root_span: str = "root",
156154
attributes: Optional[dict[str, str]] = None,
157155
) -> AsyncGenerator[UiPathRuntimeEvent, None]:
@@ -172,8 +170,8 @@ async def stream_in_root_span(
172170
try:
173171
tracer: Tracer = trace.get_tracer("uipath-runtime")
174172
span_attributes = {}
175-
if execution_id:
176-
span_attributes["execution.id"] = execution_id
173+
if runtime.context.execution_id:
174+
span_attributes["execution.id"] = runtime.context.execution_id
177175
if attributes:
178176
span_attributes.update(attributes)
179177

tests/test_executor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,24 @@ async def test_multiple_factories_same_executor():
9393
executor = UiPathRuntimeExecutor()
9494

9595
# Execute runtime A
96-
runtime_a = factory_a.from_context(UiPathRuntimeContext())
96+
runtime_a = factory_a.from_context(UiPathRuntimeContext(execution_id="exec-a"))
9797
async with runtime_a:
9898
result_a = await executor.execute_in_root_span(
99-
runtime_a, execution_id="exec-a", root_span="runtime-a-span"
99+
runtime_a, root_span="runtime-a-span"
100100
)
101101

102102
# Execute runtime B
103-
runtime_b = factory_b.from_context(UiPathRuntimeContext())
103+
runtime_b = factory_b.from_context(UiPathRuntimeContext(execution_id="exec-b"))
104104
async with runtime_b:
105105
result_b = await executor.execute_in_root_span(
106-
runtime_b, execution_id="exec-b", root_span="runtime-b-span"
106+
runtime_b, root_span="runtime-b-span"
107107
)
108108

109109
# Execute runtime C with custom spans
110-
runtime_c = factory_c.from_context(UiPathRuntimeContext())
110+
runtime_c = factory_c.from_context(UiPathRuntimeContext(execution_id="exec-c"))
111111
async with runtime_c:
112112
result_c = await executor.execute_in_root_span(
113-
runtime_c, execution_id="exec-c", root_span="runtime-c-span"
113+
runtime_c, root_span="runtime-c-span"
114114
)
115115

116116
# Verify results

0 commit comments

Comments
 (0)