From 8cfe208056e87395874de9af752b684c000ad725 Mon Sep 17 00:00:00 2001 From: Mihalache Marius Date: Fri, 20 Nov 2026 14:11:50 +0200 Subject: [PATCH 1/2] fix(telemetry): turn telemetry off when UIPATH_TELEMETRY_DISABLED is true [PC-5668] [2.14.39.post2] The serverless platform tells a robot its telemetry is off with UIPATH_TELEMETRY_DISABLED=true, which it always sets on Automation Suite. The SDK only read UIPATH_TELEMETRY_ENABLED (default true), so it kept sending events to the baked Application Insights instance. On an air-gapped install every send waits for a connection timeout. UIPATH_TELEMETRY_DISABLED=true now disables telemetry and wins over UIPATH_TELEMETRY_ENABLED. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_0136ibA73WLWFVYGwNLx18P7 --- .../uipath/docs/core/environment_variables.md | 2 ++ packages/uipath/pyproject.toml | 2 +- .../uipath/src/uipath/telemetry/_constants.py | 4 +++ .../uipath/src/uipath/telemetry/_track.py | 10 ++++++- packages/uipath/tests/telemetry/test_track.py | 27 +++++++++++++++++++ packages/uipath/uv.lock | 2 +- 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/packages/uipath/docs/core/environment_variables.md b/packages/uipath/docs/core/environment_variables.md index bcf1bcc8b..e09eaa5b9 100644 --- a/packages/uipath/docs/core/environment_variables.md +++ b/packages/uipath/docs/core/environment_variables.md @@ -58,6 +58,8 @@ Telemetry is enabled by default. You can opt out by setting the `UIPATH_TELEMETR UIPATH_TELEMETRY_ENABLED=false ``` +Setting `UIPATH_TELEMETRY_DISABLED=true` has the same effect and takes precedence. The serverless platform sets it for robots whose telemetry is turned off, for example on Automation Suite. + ## Runtime When executing processes or starting jobs, you can configure environment variables through the UiPath Orchestrator interface. For sensitive information like API keys and secrets, we strongly recommend using secret assets instead of environment variables. Secret assets provide enhanced security and better management capabilities. diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index ca2db62a9..4ce83f7bd 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.14.39.post1" +version = "2.14.39.post2" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/packages/uipath/src/uipath/telemetry/_constants.py b/packages/uipath/src/uipath/telemetry/_constants.py index fd9098def..0515431fa 100644 --- a/packages/uipath/src/uipath/telemetry/_constants.py +++ b/packages/uipath/src/uipath/telemetry/_constants.py @@ -4,6 +4,10 @@ PERIODIC_TELEMETRY_FLUSH_FEATURE_FLAG = "EnablePeriodicTelemetryFlush" +# Set to "true" by the serverless platform for robots whose telemetry is off +# (always on Automation Suite). Wins over UIPATH_TELEMETRY_ENABLED. +_ENV_TELEMETRY_DISABLED = "UIPATH_TELEMETRY_DISABLED" + _APP_INSIGHTS_EVENT_MARKER_ATTRIBUTE = "APPLICATION_INSIGHTS_EVENT_MARKER_ATTRIBUTE" _OTEL_RESOURCE_ATTRIBUTES = "OTEL_RESOURCE_ATTRIBUTES" _SDK_VERSION = "SdkVersion" diff --git a/packages/uipath/src/uipath/telemetry/_track.py b/packages/uipath/src/uipath/telemetry/_track.py index b2be4f90d..1a77dd133 100644 --- a/packages/uipath/src/uipath/telemetry/_track.py +++ b/packages/uipath/src/uipath/telemetry/_track.py @@ -31,6 +31,7 @@ _CONNECTION_STRING_ALPHA, _CONNECTION_STRING_PROD, _CONNECTION_STRING_STAGING, + _ENV_TELEMETRY_DISABLED, _OTEL_RESOURCE_ATTRIBUTES, _PROJECT_KEY, _SDK_VERSION, @@ -512,7 +513,14 @@ class _TelemetryClient: @staticmethod def _is_enabled() -> bool: - """Check if telemetry is enabled at runtime.""" + """Check if telemetry is enabled at runtime. + + ``UIPATH_TELEMETRY_DISABLED=true`` turns it off whatever + ``UIPATH_TELEMETRY_ENABLED`` says: that is how the serverless platform + tells a robot its telemetry is off, e.g. on Automation Suite. + """ + if os.getenv(_ENV_TELEMETRY_DISABLED, "").strip().lower() in ("true", "1"): + return False return os.getenv(ENV_TELEMETRY_ENABLED, "true").lower() == "true" @staticmethod diff --git a/packages/uipath/tests/telemetry/test_track.py b/packages/uipath/tests/telemetry/test_track.py index af7c8a616..34ada2378 100644 --- a/packages/uipath/tests/telemetry/test_track.py +++ b/packages/uipath/tests/telemetry/test_track.py @@ -739,6 +739,33 @@ def test_is_enabled_case_insensitive(self): with patch.dict(os.environ, {"UIPATH_TELEMETRY_ENABLED": "False"}): assert _TelemetryClient._is_enabled() is False + def test_is_enabled_false_when_platform_disables_telemetry(self): + """UIPATH_TELEMETRY_DISABLED=true is the serverless platform's off switch.""" + with patch.dict(os.environ, {"UIPATH_TELEMETRY_DISABLED": "true"}, clear=True): + assert _TelemetryClient._is_enabled() is False + + def test_platform_disable_wins_over_enabled(self): + """The platform's off switch wins over UIPATH_TELEMETRY_ENABLED=true.""" + env = {"UIPATH_TELEMETRY_DISABLED": "True", "UIPATH_TELEMETRY_ENABLED": "true"} + with patch.dict(os.environ, env, clear=True): + assert _TelemetryClient._is_enabled() is False + + def test_platform_disable_not_set_keeps_telemetry_on(self): + """Any other UIPATH_TELEMETRY_DISABLED value leaves the default in place.""" + for value in ("false", "", "0"): + with patch.dict( + os.environ, {"UIPATH_TELEMETRY_DISABLED": value}, clear=True + ): + assert _TelemetryClient._is_enabled() is True + + def test_track_event_sends_nothing_when_platform_disables_telemetry(self): + """No event reaches the App Insights client when the platform turned telemetry off.""" + with patch.dict(os.environ, {"UIPATH_TELEMETRY_DISABLED": "true"}, clear=True): + with patch.object(_AppInsightsEventClient, "track_event") as mock_track: + _TelemetryClient.track_event("test_event", {"key": "value"}) + + mock_track.assert_not_called() + @patch.object(_TelemetryClient, "_is_enabled", return_value=False) def test_track_event_disabled(self, mock_is_enabled): """Test that track_event does nothing when telemetry is disabled.""" diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index 8e9e34a89..b9809e790 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2599,7 +2599,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.14.39.post1" +version = "2.14.39.post2" source = { editable = "." } dependencies = [ { name = "applicationinsights" }, From df838ab9e7db87e8d127250c749ca2e52618dd7a Mon Sep 17 00:00:00 2001 From: Mihalache Marius Date: Fri, 20 Nov 2026 14:16:52 +0200 Subject: [PATCH 2/2] docs(telemetry): describe UIPATH_TELEMETRY_DISABLED without naming a host product Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_0136ibA73WLWFVYGwNLx18P7 --- packages/uipath/docs/core/environment_variables.md | 2 +- packages/uipath/src/uipath/telemetry/_constants.py | 4 ++-- packages/uipath/src/uipath/telemetry/_track.py | 4 ++-- packages/uipath/tests/telemetry/test_track.py | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/uipath/docs/core/environment_variables.md b/packages/uipath/docs/core/environment_variables.md index e09eaa5b9..c6a4e72a2 100644 --- a/packages/uipath/docs/core/environment_variables.md +++ b/packages/uipath/docs/core/environment_variables.md @@ -58,7 +58,7 @@ Telemetry is enabled by default. You can opt out by setting the `UIPATH_TELEMETR UIPATH_TELEMETRY_ENABLED=false ``` -Setting `UIPATH_TELEMETRY_DISABLED=true` has the same effect and takes precedence. The serverless platform sets it for robots whose telemetry is turned off, for example on Automation Suite. +Setting `UIPATH_TELEMETRY_DISABLED=true` has the same effect and takes precedence over `UIPATH_TELEMETRY_ENABLED`. ## Runtime diff --git a/packages/uipath/src/uipath/telemetry/_constants.py b/packages/uipath/src/uipath/telemetry/_constants.py index 0515431fa..581bc0bf0 100644 --- a/packages/uipath/src/uipath/telemetry/_constants.py +++ b/packages/uipath/src/uipath/telemetry/_constants.py @@ -4,8 +4,8 @@ PERIODIC_TELEMETRY_FLUSH_FEATURE_FLAG = "EnablePeriodicTelemetryFlush" -# Set to "true" by the serverless platform for robots whose telemetry is off -# (always on Automation Suite). Wins over UIPATH_TELEMETRY_ENABLED. +# Set to "true" by a host environment that turns telemetry off. +# Wins over UIPATH_TELEMETRY_ENABLED. _ENV_TELEMETRY_DISABLED = "UIPATH_TELEMETRY_DISABLED" _APP_INSIGHTS_EVENT_MARKER_ATTRIBUTE = "APPLICATION_INSIGHTS_EVENT_MARKER_ATTRIBUTE" diff --git a/packages/uipath/src/uipath/telemetry/_track.py b/packages/uipath/src/uipath/telemetry/_track.py index 1a77dd133..b86a53535 100644 --- a/packages/uipath/src/uipath/telemetry/_track.py +++ b/packages/uipath/src/uipath/telemetry/_track.py @@ -516,8 +516,8 @@ def _is_enabled() -> bool: """Check if telemetry is enabled at runtime. ``UIPATH_TELEMETRY_DISABLED=true`` turns it off whatever - ``UIPATH_TELEMETRY_ENABLED`` says: that is how the serverless platform - tells a robot its telemetry is off, e.g. on Automation Suite. + ``UIPATH_TELEMETRY_ENABLED`` says, so a host environment can switch + telemetry off for the processes it starts. """ if os.getenv(_ENV_TELEMETRY_DISABLED, "").strip().lower() in ("true", "1"): return False diff --git a/packages/uipath/tests/telemetry/test_track.py b/packages/uipath/tests/telemetry/test_track.py index 34ada2378..a08b3615d 100644 --- a/packages/uipath/tests/telemetry/test_track.py +++ b/packages/uipath/tests/telemetry/test_track.py @@ -739,18 +739,18 @@ def test_is_enabled_case_insensitive(self): with patch.dict(os.environ, {"UIPATH_TELEMETRY_ENABLED": "False"}): assert _TelemetryClient._is_enabled() is False - def test_is_enabled_false_when_platform_disables_telemetry(self): - """UIPATH_TELEMETRY_DISABLED=true is the serverless platform's off switch.""" + def test_is_enabled_false_when_telemetry_disabled(self): + """UIPATH_TELEMETRY_DISABLED=true turns telemetry off.""" with patch.dict(os.environ, {"UIPATH_TELEMETRY_DISABLED": "true"}, clear=True): assert _TelemetryClient._is_enabled() is False - def test_platform_disable_wins_over_enabled(self): - """The platform's off switch wins over UIPATH_TELEMETRY_ENABLED=true.""" + def test_disabled_wins_over_enabled(self): + """UIPATH_TELEMETRY_DISABLED=true wins over UIPATH_TELEMETRY_ENABLED=true.""" env = {"UIPATH_TELEMETRY_DISABLED": "True", "UIPATH_TELEMETRY_ENABLED": "true"} with patch.dict(os.environ, env, clear=True): assert _TelemetryClient._is_enabled() is False - def test_platform_disable_not_set_keeps_telemetry_on(self): + def test_disabled_not_true_keeps_telemetry_on(self): """Any other UIPATH_TELEMETRY_DISABLED value leaves the default in place.""" for value in ("false", "", "0"): with patch.dict( @@ -758,8 +758,8 @@ def test_platform_disable_not_set_keeps_telemetry_on(self): ): assert _TelemetryClient._is_enabled() is True - def test_track_event_sends_nothing_when_platform_disables_telemetry(self): - """No event reaches the App Insights client when the platform turned telemetry off.""" + def test_track_event_sends_nothing_when_telemetry_disabled(self): + """No event reaches the App Insights client when telemetry is disabled.""" with patch.dict(os.environ, {"UIPATH_TELEMETRY_DISABLED": "true"}, clear=True): with patch.object(_AppInsightsEventClient, "track_event") as mock_track: _TelemetryClient.track_event("test_event", {"key": "value"})