Skip to content

Minimize telemetry context and modernize 1DS integration - #29872

Merged
Tianlei Wu (tianleiwu) merged 50 commits into
mainfrom
bhamehta/trim-posix-telemetry-context
Aug 9, 2026
Merged

Minimize telemetry context and modernize 1DS integration#29872
Tianlei Wu (tianleiwu) merged 50 commits into
mainfrom
bhamehta/trim-posix-telemetry-context

Conversation

@bmehta001

@bmehta001 bmehta001 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Minimizes automatic POSIX/1DS common context and makes telemetry an explicit build opt-out on supported native targets.

Context minimization

  • Removes the unused POSIX ProviderOptions emitter.
  • Suppresses duplicate app name, app/user locale, timezone, and enrolled tenant ID.
  • Retains ext.net.* on ProcessInfo, then clears it best-effort before later events.
  • Removes redundant POSIX processName and LibraryName fields.
  • Retains ORT correlation, version, framework, device, timestamp, sampling, and SDK-ordering fields.
  • Keeps optional context suppression non-fatal and retries network cleanup until it succeeds.
  • Preserves canonical event names without adding an ORT or OnnxRuntime prefix.

Build behavior

  • Replaces the opt-in --use_telemetry interface with the opt-out --no_telemetry flag.
  • Enables telemetry by default for supported Windows, Linux, macOS, iOS, and Android targets.
  • Keeps build.bat and build_arm64x.bat opted out; build.sh adds no telemetry flag.
  • Automatically disables telemetry for WebAssembly, AIX, RISC-V, unsupported Linux architectures, tvOS, visionOS, Mac Catalyst, and exception-free builds.
  • Makes Windows default-on source builds fall back to the public non-Microsoft ETW configuration when no private telemetry header is present.
  • Updates Android/Apple packaging, Azure callers, and docs/Privacy.md.

cpp_client_telemetry integration

  • Uses stable cpp_client_telemetry v3.10.173.1 with an ORT-maintained compatibility patch, rather than pinning an unreleased PR archive.
  • The compatibility patch applies the released SDK's source-root, Apple, vendored-dependency, curl-target, and portability fixes needed by ORT.
  • Routes non-vcpkg Linux telemetry through ORT's pinned static curl with mbedTLS, avoiding an OpenSSL dependency.
  • Uses bundled SQLite/zlib for static non-Apple and Apple telemetry packaging, avoiding bare iOS system-library names.
  • Keeps vcpkg, Android, Apple, Windows, telemetry-off, and unsupported-target paths appropriately configured.

Self-contained Linux transport

  • Non-vcpkg Linux telemetry builds pin and statically link an HTTP/HTTPS-only curl with mbedTLS instead of requiring host curl/TLS libraries.
  • Dependency options are isolated from caller cache state; mbedTLS uses pthread protection for concurrent 1DS uploads.
  • The target host CA bundle is selected at runtime, while build-host trust paths are removed from curl's generated configuration.
  • Shared consumers do not re-export transport symbols; static package exports include all required archives and document the ordinary static co-link constraint.

Validation

  • CI-discovered regression tests cover native default-on telemetry, --no_telemetry, unsupported targets/architectures, and Android default behavior.
  • Windows and Linux/WSL parser/wrapper checks.
  • Linux onnxruntime_common configure/build transitions with telemetry ON, OFF, and exception-free OFF.
  • Patched stable SDK configure/build validation with static curl, mbedTLS, and vendored SQLite/zlib.
  • React Native iOS, iOS simulator, iOS packaging, Android, Linux, Windows, CUDA/TensorRT, and WebGPU CI validation during the integration work.
  • Focused semantic-context/no-throw tests and material review.
  • ELF dependency/symbol inspection and static package export/install graph checks.
  • Updated ORT privacy data inventory for the minimized POSIX context.

The branch has been rebased onto the latest origin/main.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.h helpers to suppress specific PAL-populated semantic-context fields (general fields at init; network fields after ProcessInfo).
  • Update PosixTelemetry initialization 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread onnxruntime/core/platform/posix/telemetry.cc Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@bmehta001 bmehta001 changed the title Minimize POSIX telemetry common context Minimize telemetry context and make builds opt-out Jul 27, 2026
Comment thread tools/ci_build/test_build_args.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Comment thread tools/ci_build/test_build_args.py Outdated
Comment thread tools/ci_build/test_build_args.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ps1 now forces --no_telemetry when TELEMETRYGUID is 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. Leaving TelemetryOption empty here would allow the default-on behavior while still skipping the private header injection.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-libs arguments 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 TelemetryOption to --no_telemetry when TELEMETRYGUID is 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).

Comment thread cmake/onnxruntime_common.cmake

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_telemetry turns onnxruntime_USE_TELEMETRY OFF, 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.

This was referenced Aug 14, 2026
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.

4 participants