Skip to content

Commit d0db5e5

Browse files
authored
Merge pull request #15 from UiPath/fix/add_attributes
fix: add attributes to execution runtime
2 parents f84ee51 + 34a78ca commit d0db5e5

4 files changed

Lines changed: 15 additions & 32 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.0.7"
3+
version = "0.0.8"
44
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
77
dependencies = [
8-
"opentelemetry-sdk>=1.38.0",
9-
"opentelemetry-instrumentation>=0.59b0",
108
"pydantic>=2.12.3",
11-
"uipath-core>=0.0.3, <0.1.0",
9+
"uipath-core>=0.0.4, <0.1.0",
1210
]
1311
classifiers = [
1412
"Intended Audience :: Developers",
1513
"Topic :: Software Development :: Build Tools",
1614
"Programming Language :: Python :: 3.11",
1715
"Programming Language :: Python :: 3.12",
1816
"Programming Language :: Python :: 3.13",
19-
2017
]
2118
maintainers = [
2219
{ name = "Marius Cosareanu", email = "marius.cosareanu@uipath.com" },

src/uipath/runtime/base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ def __init__(
147147
delegate: UiPathRuntimeProtocol,
148148
trace_manager: UiPathTraceManager,
149149
root_span: str = "root",
150+
span_attributes: Optional[dict[str, str]] = None,
150151
log_handler: Optional[UiPathRuntimeExecutionLogHandler] = None,
151152
execution_id: Optional[str] = None,
152153
):
153154
"""Initialize the executor."""
154155
self.delegate = delegate
155156
self.trace_manager = trace_manager
156157
self.root_span = root_span
158+
self.span_attributes = span_attributes
157159
self.execution_id = execution_id
158160
self.log_handler = log_handler
159161
if execution_id is not None and log_handler is None:
@@ -174,7 +176,9 @@ async def execute(
174176
try:
175177
if self.execution_id:
176178
with self.trace_manager.start_execution_span(
177-
self.root_span, execution_id=self.execution_id
179+
self.root_span,
180+
execution_id=self.execution_id,
181+
attributes=self.span_attributes,
178182
):
179183
return await self.delegate.execute(input, options=options)
180184
else:
@@ -209,7 +213,9 @@ async def stream(
209213
try:
210214
if self.execution_id:
211215
with self.trace_manager.start_execution_span(
212-
self.root_span, execution_id=self.execution_id
216+
self.root_span,
217+
execution_id=self.execution_id,
218+
attributes=self.span_attributes,
213219
):
214220
async for event in self.delegate.stream(input, options=options):
215221
yield event

src/uipath/runtime/context.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
Optional,
1010
TypeVar,
1111
)
12-
from uuid import uuid4
1312

1413
from pydantic import BaseModel
15-
from uipath.core.tracing.context import UiPathTraceContext
1614

1715
from uipath.runtime.errors import (
1816
UiPathErrorCategory,
@@ -34,7 +32,6 @@ class UiPathRuntimeContext(BaseModel):
3432
entrypoint: Optional[str] = None
3533
input: Optional[dict[str, Any]] = None
3634
job_id: Optional[str] = None
37-
trace_context: Optional[UiPathTraceContext] = None
3835
config_path: str = "uipath.json"
3936
runtime_dir: Optional[str] = "__uipath"
4037
result_file: str = "output.json"
@@ -208,19 +205,6 @@ def with_defaults(cls: type[C], config_path: Optional[str] = None, **kwargs) ->
208205
base.job_id = os.environ.get("UIPATH_JOB_KEY")
209206
base.logs_min_level = os.environ.get("LOG_LEVEL", "INFO")
210207

211-
base.trace_context = UiPathTraceContext(
212-
trace_id=os.environ.get("UIPATH_TRACE_ID"),
213-
parent_span_id=os.environ.get("UIPATH_PARENT_SPAN_ID"),
214-
root_span_id=os.environ.get("UIPATH_ROOT_SPAN_ID"),
215-
enabled=tracing_enabled,
216-
job_id=os.environ.get("UIPATH_JOB_KEY"),
217-
org_id=os.environ.get("UIPATH_ORGANIZATION_ID"),
218-
tenant_id=os.environ.get("UIPATH_TENANT_ID"),
219-
process_key=os.environ.get("UIPATH_PROCESS_UUID"),
220-
folder_key=os.environ.get("UIPATH_FOLDER_KEY"),
221-
reference_id=os.environ.get("UIPATH_JOB_KEY") or str(uuid4()),
222-
)
223-
224208
# Override with kwargs
225209
for k, v in kwargs.items():
226210
setattr(base, k, v)

uv.lock

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)