Minimize telemetry context and modernize 1DS integration - #29872
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces automatically populated POSIX/1DS semantic (common) context in PosixTelemetry, and removes the POSIX override for LogProviderOptions so POSIX inherits the shared no-op implementation. This aligns POSIX telemetry with a more minimal, ORT-owned context surface while keeping ProcessInfo behavior intact and clearing PAL network context before subsequent events.
Changes:
- Add
telemetry_context.hhelpers to suppress specific PAL-populated semantic-context fields (general fields at init; network fields afterProcessInfo). - Update
PosixTelemetryinitialization and event logging to apply the above suppression in a thread-safe, one-time manner. - Add focused unit tests validating the suppression helpers.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/test/platform/telemetry_context_test.cc | Adds unit tests for semantic-context suppression helper functions. |
| onnxruntime/core/platform/posix/telemetry.h | Removes POSIX LogProviderOptions override; adds state for one-time network-context suppression. |
| onnxruntime/core/platform/posix/telemetry.cc | Applies common-context suppression at logger init; suppresses network context after ProcessInfo via guarded one-time transition. |
| onnxruntime/core/platform/posix/telemetry_context.h | Introduces field lists + helper templates to clear selected semantic-context fields. |
| cmake/onnxruntime_common.cmake | Adds the new header to the non-Windows common source list. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
tools/ci_build/github/windows/set_telemetry_var.ps1:14
set_telemetry_var.ps1now forces--no_telemetrywhenTELEMETRYGUIDis absent, which disables telemetry entirely even though this PR’s stated behavior is “default-on” with a fallback to the public (non-private-header) ETW configuration when no private telemetry header is present. LeavingTelemetryOptionempty here would allow the default-on behavior while still skipping the private header injection.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
cmake/onnxruntime_common.cmake:289
- Same issue for the install interface:
--exclude-libsarguments should be comma-separated. Using ":" here prevents the option from matching the intended library set, so the installed/exported target won't correctly hide embedded curl/mbedTLS symbols.
string(CONCAT _onnxruntime_telemetry_install_exclude_libs
"LINKER:--exclude-libs="
"$<TARGET_FILE_NAME:onnxruntime::libcurl_static>:"
"$<TARGET_FILE_NAME:onnxruntime::mbedtls>:"
tools/ci_build/github/windows/set_telemetry_var.ps1:14
- This script sets
TelemetryOptionto--no_telemetrywhenTELEMETRYGUIDis missing, which effectively makes Windows CI builds opt-in again. That seems to contradict the PR's stated goal of making telemetry default-on (with a fallback to the public ETW config when the private header isn't generated).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
docs/Privacy.md:30
- The build-time disable description is a bit misleading on Windows:
--no_telemetryturnsonnxruntime_USE_TELEMETRYOFF, which removes the telemetry provider entirely (not just the private Microsoft configuration). Consider rewording to reflect that telemetry is disabled at build time across platforms (ETW on Windows, 1DS on supported non-Windows).
Telemetry can be disabled in any of these ways:
- **Disable it at build time.** Pass `--no_telemetry` to `build.py` or `build.sh`. This omits the 1DS provider from non-Windows builds and disables the Microsoft telemetry configuration on Windows. The standard Windows `build.bat` wrapper does this automatically. Unsupported targets and exception-free builds never include telemetry.
- **Disable all telemetry at runtime (non-Windows).** Set `ORT_DISABLE_TELEMETRY=1` before ONNX Runtime initializes. This prevents the uploader, events, and persistent device identifier from being created for the process lifetime.
- **Disable non-essential events via the API.** The C API (and the C#, Python, and Java bindings) can suppress non-essential telemetry. ONNX Runtime may already have emitted a minimal initialization event before the API can be called. On **Windows**, ETW events are recorded only when an external trace session is collecting.
Summary
Minimizes automatic POSIX/1DS common context and makes telemetry an explicit build opt-out on supported native targets.
Context minimization
ProviderOptionsemitter.ext.net.*onProcessInfo, then clears it best-effort before later events.processNameandLibraryNamefields.ORTorOnnxRuntimeprefix.Build behavior
--use_telemetryinterface with the opt-out--no_telemetryflag.build.batandbuild_arm64x.batopted out;build.shadds no telemetry flag.docs/Privacy.md.cpp_client_telemetry integration
cpp_client_telemetryv3.10.173.1with an ORT-maintained compatibility patch, rather than pinning an unreleased PR archive.Self-contained Linux transport
Validation
--no_telemetry, unsupported targets/architectures, and Android default behavior.onnxruntime_commonconfigure/build transitions with telemetry ON, OFF, and exception-free OFF.The branch has been rebased onto the latest
origin/main.