uipath 2.0.12__py3-none-any.whl → 2.0.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of uipath might be problematic. Click here for more details.

@@ -1,7 +1,8 @@
1
1
  import json
2
2
  import logging
3
3
  import os
4
- from typing import Sequence
4
+ import time
5
+ from typing import Any, Dict, Sequence
5
6
 
6
7
  from httpx import Client
7
8
  from opentelemetry.sdk.trace import ReadableSpan
@@ -30,7 +31,7 @@ class LlmOpsHttpExporter(SpanExporter):
30
31
 
31
32
  self.http_client = Client(headers=self.headers)
32
33
 
33
- def export(self, spans: Sequence[ReadableSpan]):
34
+ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
34
35
  """Export spans to UiPath LLM Ops."""
35
36
  logger.debug(
36
37
  f"Exporting {len(spans)} spans to {self.base_url}/llmopstenant_/api/Traces/spans"
@@ -39,23 +40,42 @@ class LlmOpsHttpExporter(SpanExporter):
39
40
  span_list = [
40
41
  _SpanUtils.otel_span_to_uipath_span(span).to_dict() for span in spans
41
42
  ]
43
+ url = self._build_url(span_list)
42
44
 
43
- trace_id = str(span_list[0]["TraceId"])
44
- url = f"{self.base_url}/llmopstenant_/api/Traces/spans?traceId={trace_id}&source=Robots"
45
-
46
- logger.debug("payload: ", json.dumps(span_list))
47
-
48
- res = self.http_client.post(url, json=span_list)
45
+ logger.debug("Payload: %s", json.dumps(span_list))
49
46
 
50
- if res.status_code == 200:
51
- return SpanExportResult.SUCCESS
52
- else:
53
- return SpanExportResult.FAILURE
47
+ return self._send_with_retries(url, span_list)
54
48
 
55
49
  def force_flush(self, timeout_millis: int = 30000) -> bool:
56
50
  """Force flush the exporter."""
57
51
  return True
58
52
 
53
+ def _build_url(self, span_list: list[Dict[str, Any]]) -> str:
54
+ """Construct the URL for the API request."""
55
+ trace_id = str(span_list[0]["TraceId"])
56
+ return f"{self.base_url}/llmopstenant_/api/Traces/spans?traceId={trace_id}&source=Robots"
57
+
58
+ def _send_with_retries(
59
+ self, url: str, payload: list[Dict[str, Any]], max_retries: int = 4
60
+ ) -> SpanExportResult:
61
+ """Send the HTTP request with retry logic."""
62
+ for attempt in range(max_retries):
63
+ try:
64
+ response = self.http_client.post(url, json=payload)
65
+ if response.status_code == 200:
66
+ return SpanExportResult.SUCCESS
67
+ else:
68
+ logger.warning(
69
+ f"Attempt {attempt + 1} failed with status code {response.status_code}: {response.text}"
70
+ )
71
+ except Exception as e:
72
+ logger.error(f"Attempt {attempt + 1} failed with exception: {e}")
73
+
74
+ if attempt < max_retries - 1:
75
+ time.sleep(1.5**attempt) # Exponential backoff
76
+
77
+ return SpanExportResult.FAILURE
78
+
59
79
  def _get_base_url(self) -> str:
60
80
  uipath_url = (
61
81
  os.environ.get("UIPATH_URL")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.0.12
3
+ Version: 2.0.13
4
4
  Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-python
@@ -70,11 +70,11 @@ uipath/models/llm_gateway.py,sha256=0sl5Wtve94V14H3AHwmJSoXAhoc-Fai3wJxP8HrnBPg,
70
70
  uipath/models/processes.py,sha256=Atvfrt6X4TYST3iA62jpS_Uxc3hg6uah11p-RaKZ6dk,2029
71
71
  uipath/models/queues.py,sha256=N_s0GKucbyjh0RnO8SxPk6wlRgvq8KIIYsfaoIY46tM,6446
72
72
  uipath/tracing/__init__.py,sha256=mQEKHs47ufpy3MxphTJRh6AQsH90y6pWW80Nqbs0Q9c,157
73
- uipath/tracing/_otel_exporters.py,sha256=Fo10ofCWGd6PN5ndEsHkw6FZgQT5zOlob2XGnkiWvZE,2056
73
+ uipath/tracing/_otel_exporters.py,sha256=x0PDPmDKJcxashsuehVsSsqBCzRr6WsNFaq_3_HS5F0,3014
74
74
  uipath/tracing/_traced.py,sha256=9EUy7-OlBOApcKx4L8pwXCUJQQSl0Qh5IPvLGd27cS0,10913
75
75
  uipath/tracing/_utils.py,sha256=5SwsTGpHkIouXBndw-u8eCLnN4p7LM8DsTCCuf2jJgs,10165
76
- uipath-2.0.12.dist-info/METADATA,sha256=hzh4ODa7bKR-z6ee1CqMLOkzWGIXCAXm6TkEgI9r0JE,6078
77
- uipath-2.0.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
78
- uipath-2.0.12.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
79
- uipath-2.0.12.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
80
- uipath-2.0.12.dist-info/RECORD,,
76
+ uipath-2.0.13.dist-info/METADATA,sha256=l7VY1H0gEhmIIm1GFgJF9UpYAJdT_OOwXowxA2T9K9Q,6078
77
+ uipath-2.0.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
78
+ uipath-2.0.13.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
79
+ uipath-2.0.13.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
80
+ uipath-2.0.13.dist-info/RECORD,,