Skip to content

Commit 029953f

Browse files
authored
Merge pull request #100 from UiPath/fix/tracing
feat(tracing): fix tracing
2 parents 4a808e4 + 20b1b69 commit 029953f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

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-mcp"
3-
version = "0.0.84"
3+
version = "0.0.85"
44
description = "UiPath MCP SDK"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

src/uipath_mcp/_cli/_runtime/_runtime.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
from mcp import ClientSession, StdioServerParameters, stdio_client
1111
from mcp.types import JSONRPCResponse
1212
from opentelemetry import trace
13+
from opentelemetry.sdk.trace import TracerProvider
14+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
1315
from pysignalr.client import CompletionMessage, SignalRClient
1416
from uipath import UiPath
1517
from uipath._cli._runtime._contracts import (
1618
UiPathBaseRuntime,
1719
UiPathErrorCategory,
1820
UiPathRuntimeResult,
1921
)
20-
from uipath.tracing import wait_for_tracers
22+
from uipath.tracing import LlmOpsHttpExporter
2123

2224
from .._utils._config import McpServer
2325
from ._context import UiPathMcpRuntimeContext, UiPathServerType
@@ -62,6 +64,12 @@ async def execute(self) -> Optional[UiPathRuntimeResult]:
6264
try:
6365
if self._server is None:
6466
return None
67+
68+
self.trace_provider = TracerProvider()
69+
trace.set_tracer_provider(self.trace_provider)
70+
self.trace_provider.add_span_processor(
71+
BatchSpanProcessor(LlmOpsHttpExporter())
72+
) # type: ignore
6573

6674
# Set up SignalR client
6775
signalr_url = f"{os.environ.get('UIPATH_URL')}/mcp_/wsstunnel?slug={self._server.name}&runtimeId={self._runtime_id}"
@@ -125,7 +133,7 @@ async def execute(self) -> Optional[UiPathRuntimeResult]:
125133
UiPathErrorCategory.USER,
126134
) from e
127135
finally:
128-
wait_for_tracers()
136+
self.trace_provider.shutdown()
129137

130138
async def validate(self) -> None:
131139
"""Validate runtime inputs and load MCP server configuration."""

uv.lock

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

0 commit comments

Comments
 (0)