Skip to content

Make ORT_TELEMETRY_DISABLED a full telemetry opt-out - #29843

Merged
bmehta001 merged 1 commit into
bhamehta/posix-telemetryfrom
tlwu/posix_telemetry
Jul 23, 2026
Merged

Make ORT_TELEMETRY_DISABLED a full telemetry opt-out#29843
bmehta001 merged 1 commit into
bhamehta/posix-telemetryfrom
tlwu/posix_telemetry

Conversation

@tianleiwu

Copy link
Copy Markdown
Contributor

Description

Makes ORT_TELEMETRY_DISABLED a full telemetry opt-out on the non-Windows (1DS) provider. Previously, setting the environment variable only flipped enabled_ = false while Initialize() still created the 1DS uploader, wrote the persistent device-id file to disk, and let LogProcessInfo() upload a one-shot ProcessInfo event (it only checked logger_ != nullptr, not IsEnabled()). So a user who explicitly opted out still got an on-disk identifier and a network upload.

With this change, the env-var opt-out is treated like CI / unit-test suppression: the provider returns early before creating the uploader, so nothing is initialized, persisted, or sent.

Key Changes

File Change
onnxruntime/core/platform/telemetry_environment.h ShouldSuppressTelemetry() now also returns true for IsTelemetryDisabledByEnvVar(), making it the single "collect nothing" gate.
onnxruntime/core/platform/posix/telemetry.cc Initialize() collapses the CI/unit-test and env-var checks into one early return on ShouldSuppressTelemetry(). When set, no LogManager/uploader is created, DeviceId::GetValue() is never called (no device-id file), and LogProcessInfo() returns early (no upload). env_disabled_ is still latched so the runtime EnableTelemetryEvents() API cannot re-enable it. LogProcessInfo() comment updated.
docs/Privacy.md Documents the env-var as a full opt-out: no uploader, no init event, no persistent device id, latched for the process lifetime.
onnxruntime/test/platform/telemetry_environment_test.cc Adds assertions that ShouldSuppressTelemetry() is true when ORT_TELEMETRY_DISABLED is set.

Motivation and Context

Addresses review feedback on #27379 (the "opt-out asymmetry" thread): an explicit ORT_TELEMETRY_DISABLED=1 should leave no on-disk identifier and send nothing, rather than only suppressing usage events while still emitting an initialization heartbeat. The runtime API-based disable (DisableTelemetryEvents()) is unchanged and may still emit a minimal init event, matching the Windows ETW model.

Testing

  • TelemetryEnvironmentTest.EnvVarOptOut now asserts full suppression via ShouldSuppressTelemetry().
  • Verify on a non-Windows telemetry build that with ORT_TELEMETRY_DISABLED=1: no onnxruntime.db/deviceid file is created under the cache dir, and no ProcessInfo event is uploaded.

When ORT_TELEMETRY_DISABLED is set, skip creating the 1DS uploader entirely so no
device-id file is persisted and no ProcessInfo event is uploaded, matching CI /
unit-test suppression. The environment opt-out stays latched so the runtime
EnableTelemetryEvents() API cannot re-enable telemetry for the process lifetime.

Addresses review feedback on PR #27379 (opt-out asymmetry).
@tianleiwu
tianleiwu requested a review from bmehta001 July 23, 2026 18:02
@tianleiwu tianleiwu mentioned this pull request Jul 23, 2026
@tianleiwu tianleiwu closed this Jul 23, 2026
@tianleiwu tianleiwu reopened this Jul 23, 2026
@bmehta001
bmehta001 merged commit f5cfe90 into bhamehta/posix-telemetry Jul 23, 2026
5 of 6 checks passed
@bmehta001
bmehta001 deleted the tlwu/posix_telemetry branch July 23, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants