Add POSIX telemetry [DRAFT]#27379
Open
bmehta001 wants to merge 66 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces cross-platform build support for telemetry by extending the existing Windows ETW telemetry to non-Windows platforms via the 1DS (cpp_client_telemetry) SDK, wiring it through the build scripts and CMake.
Changes:
- Adds a new POSIX telemetry provider implementation using the 1DS SDK and swaps it into the POSIX Env when enabled.
- Extends build and CMake plumbing to fetch/link cpp_client_telemetry on non-Windows and to expose a cross-platform
--use_telemetrybuild flag. - Updates top-level build wrappers and third-party notices for the new dependency.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ci_build/build_args.py | Moves --use_telemetry to cross-platform args. |
| tools/ci_build/build.py | Always sets -Donnxruntime_USE_TELEMETRY=ON/OFF based on --use_telemetry. |
| onnxruntime/core/platform/windows/telemetry.cc | Include ordering tweak only. |
| onnxruntime/core/platform/posix/telemetry.h | Introduces POSIX telemetry provider interface (1DS). |
| onnxruntime/core/platform/posix/telemetry.cc | Implements POSIX telemetry provider using cpp_client_telemetry. |
| onnxruntime/core/platform/posix/env.cc | Uses PosixTelemetry provider when USE_1DS_TELEMETRY is defined. |
| cmake/onnxruntime_common.cmake | Adds POSIX telemetry sources/defines and links 1DS + system libs when enabled. |
| cmake/onnxruntime_1ds_telemetry.cmake | New helper module for enabling 1DS telemetry on non-Windows. |
| cmake/external/onnxruntime_external_deps.cmake | Fetches cpp_client_telemetry only when telemetry is enabled on non-Windows. |
| cmake/deps.txt | Adds cpp_client_telemetry dependency entry. |
| cmake/CMakeLists.txt | Includes the new 1DS telemetry CMake module. |
| build.sh | Now passes --use_telemetry by default. |
| build.bat | Now passes --use_telemetry by default. |
| ThirdPartyNotices.txt | Adds cpp_client_telemetry license text (and an additional KleidiAi block). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix 1DS SDK FetchContent integration: - Set MAC_ARCH for macOS builds - Fix nlohmann/json.hpp include path (CMAKE_SOURCE_DIR mismatch) - Fix z/sqlite3 imported targets with IMPORTED_LOCATION - Disable ObjC/Swift wrappers, privacy guard, sanitizer modules - Build as static library - Fix telemetry.cc API compatibility with 1DS SDK v3.10.40.1: - Use ILogConfiguration& instead of LogConfiguration - Use raw ILogger* instead of shared_ptr (LogManager owns it) - Fix namespace casing (Microsoft vs microsoft) - Remove non-existent SetPIIKind/CFG_STR_SAMPLING_PERCENTAGE - Add LOGMANAGER_INSTANCE macro for template instantiation - Comment out unused transmit profile constants - Add required Apple frameworks: Foundation, SystemConfiguration, Network - Add 1DS SDK include directories for onnxruntime_common target Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve merge conflicts: - cmake/external/onnxruntime_external_deps.cmake: Keep z/sqlite3 IMPORTED_LOCATION fix and iOS platform detection (BUILD_IOS, IOS_ARCH, IOS_PLAT, sysroot fix), adopt remote's simpler cpp_client_telemetry_SOURCE_DIR variable - cmake/onnxruntime_common.cmake: Adopt remote's include paths (adds lib/include/mat) - onnxruntime/core/platform/posix/telemetry.cc: Adopt remote's ILogConfiguration constructor, shared_ptr<ILogger> with no-op deleter, and cleaned-up comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On iOS (and other POSIX platforms), GetStorageDirectory() returns the path but doesn't create it. SQLite can create the .db file but not the parent directory, causing 'No such file or directory' errors and preventing telemetry caching. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the iOS cache path fix, make the 1DS SDK lifetime handling robust, and link telemetry's bundled zlib in ORT's FetchContent iOS build so device dylib/framework rebuilds succeed again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fded7ba to
2f18217
Compare
Implement PosixTelemetry using the Microsoft 1DS SDK (cpp_client_telemetry) for non-Windows platforms (Linux/macOS/Android/iOS), add a posix device_id helper, wire PosixTelemetry into PosixEnv, and unify the --use_telemetry build flag across platforms (ETW on Windows, 1DS elsewhere). Also adds a Windows svchost -s/-k service-name fallback in windows/telemetry.cc. Squashed from bhamehta/posix-telemetry (commits: Add POSIX telemetry; Lint; Modify device id and other events; Service fallback Windows, fix Posix telemetry, add dep) and rebased onto current origin/main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When building with vcpkg (onnxruntime_USE_VCPKG), obtain the 1DS SDK from the cpp-client-telemetry port via find_package(MSTelemetry CONFIG REQUIRED) and link MSTelemetry::mat, whose imported target already carries include directories and transitive deps (curl/sqlite3/zlib/nlohmann-json). The existing FetchContent path with its build workarounds is retained as the non-vcpkg fallback. Adds a 'telemetry' vcpkg manifest feature (gated to non-Windows) and passes --x-feature=telemetry from build.py when --use_telemetry is set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rebasing onto current main surfaced interface drift and a latent build break: - LogSessionCreation: add hardware_device_types/hardware_vendor_ids params (the base interface gained them at schemaVersion 1) and emit them as hardwareDeviceTypes/hardwareVendorIds to match the Windows ETW schema; the missing params made the override fail to compile. - LogRuntimePerf: take duration_per_batch_size by const reference (the base signature changed from by-value), which otherwise broke the override. - env.cc: restore an '#else Telemetry telemetry_provider_' fallback so PosixEnv::GetTelemetryProvider() still has a member to return when USE_1DS_TELEMETRY is not defined (the default, telemetry-off build was otherwise uncompilable). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LogProcessInfo guarded only on the logger handle, so a runtime DisableTelemetryEvents() call still emitted the ProcessInfo event. Check enabled_ as every other event does (and as WindowsTelemetry::LogProcessInfo does), so the opt-out is respected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LogEvaluationStop runs on every inference Run() and emitted a SystemMetrics event (getrusage syscall + 11-property event) every time. Sample it: emit on the first run and then every kSystemMetricsSampleInterval (100) runs, skipping the syscall on non-sampled runs, so high-frequency small-model inference is not slowed by telemetry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PosixTelemetry inherited base no-ops for 7 events that are emitted from platform-agnostic core/session code, so POSIX silently dropped data Windows collects. Implement them, mirroring the Windows ETW event names and fields via EventBuilder (omitting the Windows-only frameworkName): ModelLoadStart, ModelLoadEnd, SessionCreationEnd, EpDeviceUsage, RegisterEpLibraryStart, RegisterEpLibraryEnd, RegisterEpLibraryWithLibPath. The genuinely Windows-only events (LogExecutionProviderEvent/LUID, LogDriverInfoEvent) remain no-op stubs. Verified on WSL/Linux: telemetry.cc compiles -fsyntax-only against 1DS SDK v3.10.40.1; all overrides match the base interface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Initialization/teardown is gated on the static global_register_count_, but the SDK handles (log_manager_, logger_, config_) and state (enabled_, projection_, level_, keyword_, process_info_logged_, sampling counter) were per-instance. With more than one instance, only the first acquired a live logger and teardown could leak the manager or drop buffered events. Make all shared state static (and the mutex), mirroring WindowsTelemetry, so a single owner manages the SDK regardless of instance count. Removed 'mutable' (incompatible with static); added out-of-line definitions. Verified on WSL/Linux: telemetry.cc compiles -fsyntax-only against 1DS SDK v3.10.40.1 and override conformance holds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… 3.10.161.1) The vcpkg port pulls cpp_client_telemetry v3.10.161.1, but the non-vcpkg FetchContent fallback still pinned v3.10.40.1 (Feb 2026). Bump it to v3.10.161.1 so both paths build the same SDK and the fallback picks up ~4 months of fixes: vendored SQLite 3.34.1 -> 3.53.1 (multiple CVEs), vendored zlib 1.3.2, Apple reachability via NWPathMonitor (iOS 18 crash fix), libcurl poll() (removes 1024-FD limit), and -Wextra-semi/redefinition header fixes that matter under ORT's -Werror. Also fix the cgmanifest entry to record the actual tag commit (cc03dce...) instead of the archive SHA1. Archive SHA1 validated by reproducing the existing 3.10.40.1 hash; telemetry.cc verified to compile -fsyntax-only against v3.10.161.1 headers; bundled-dep layout (sqlite/, zlib/) and the 'mat' target our FetchContent workarounds rely on are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-range; pin mimalloc ORT pinned vcpkg baseline 120deac (2025-08), which predates the cpp-client-telemetry port, so --use_vcpkg + --x-feature=telemetry could not resolve the dependency. Bump the baseline to 22b8d09994 (2026-06-12, the exact commit that added the port, vcpkg#52316). Impact was verified with a full-manifest 'vcpkg install --dry-run' (x64-linux, exit 0): cpp-client-telemetry@3.10.161.1 resolves; ORT's heavy deps stay pinned by overlay/override (eigen3 3.4.0, protobuf 3.21.12, onnx, abseil, pybind11, cpuinfo, dlpack); only benign security/minor bumps float (zlib 1.3.2, sqlite3 3.53.2, openssl 3.6.3, curl 8.20.0, ms-gsl 4.2.2, boost 1.91, benchmark 1.9.5). Two notable floats are neutralized: remove utf8-range (vestigial - ORT links no utf8_range target and pins protobuf 3.21.12 which predates the split; resolution succeeds without it), and override mimalloc to 2.2.3 to avoid silently swapping the allocator major (2->3) on opt-in Windows builds (verified the override pins 2.2.3). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rebasing onto current origin/main pulled in further Telemetry interface evolution: LogSessionCreation gained an ep_versions parameter, LogEpDeviceUsage gained an ep_version parameter, and a new LogRuntimeInferenceError virtual was added. Update the PosixTelemetry overrides accordingly (emitting executionProviderVersions / epVersion) and implement LogRuntimeInferenceError as a RuntimeInferenceError event mirroring the Windows ETW schema (EP versions/device types + status + runtimeVersion). Verified on WSL/Linux: override conformance against the current base telemetry.h holds and telemetry.cc compiles -fsyntax-only against 1DS SDK v3.10.161.1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
178e702 to
b0eaeb7
Compare
Telemetry isn't supported on Emscripten (the 1DS vcpkg feature excludes it), but nothing prevented enabling it for a WASM build, causing a confusing late find_package/missing-target failure. Fail fast: - build.py: raise BuildError when --use_telemetry is combined with --build_wasm. - onnxruntime_external_deps.cmake: FATAL_ERROR when onnxruntime_USE_TELEMETRY is set for an Emscripten (CMAKE_SYSTEM_NAME=Emscripten) configuration, before find_package(MSTelemetry). Verified build.py is ruff format + lint clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+871
to
+876
| # Telemetry arguments (cross-platform) | ||
| parser.add_argument( | ||
| "--use_telemetry", | ||
| action="store_true", | ||
| help="Enable telemetry (ETW on Windows; 1DS on Linux, macOS, Android, and iOS).", | ||
| ) |
…DS SDK When ONNX Runtime statically links the 1DS telemetry SDK (cpp-client-telemetry), the SDK uses SQLite only for plain offline event storage and never needs the json1 extension. Request sqlite3 with default-features:false in the telemetry feature so json1 (SQLITE_OMIT_JSON, ~50 KB) is omitted from the build. vcpkg ignores a transitive default-features:false (the port's own edge), so the consumer must also opt out in its own manifest. This takes full effect once ONNX Runtime's vcpkg baseline includes the cpp-client-telemetry port revision that also opts out (microsoft/cpp_client_telemetry#1475); with the current baseline it resolves cleanly and is a no-op (json1 stays). Verified with 'vcpkg install --dry-run' that json1 is dropped when both edges opt out, and that sqlite3 is only pulled when the telemetry feature is enabled. The other static-link footprint levers are already in place in ONNX Runtime: -ffunction-sections/-fdata-sections + -fvisibility=hidden at compile, and --gc-sections / -dead_strip / /OPT:REF,ICF at link, so the SDK's PR-1475 function-sectioning and hidden visibility let the existing dead-strip remove unreferenced SDK code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…build) 3.10.173.1 carries the SDK's binary-footprint / compilation improvements (microsoft/cpp_client_telemetry#1475): function-level linking + hidden visibility, which let ONNX Runtime's existing dead-strip (--gc-sections / -dead_strip / /OPT:REF,ICF) discard unreferenced SDK code, plus the sqlite3 json1 opt-out. - cmake/deps.txt: bump the FetchContent fallback to v3.10.173.1 (+ archive SHA1). - cgmanifests/cgmanifest.json: bump the tracked commit to the v3.10.173.1 tag. - cmake/vcpkg-ports/cpp-client-telemetry: add an overlay port pinned to v3.10.173.1 (mirrors the SDK's port, including sqlite3 default-features:false) so the vcpkg path resolves the new version now, before the registry merge. Removable once the vcpkg baseline includes 3.10.173.1. Combined with the sqlite3 json1 opt-out in cmake/vcpkg.json, verified via 'vcpkg install --dry-run' that the vcpkg path resolves cpp-client-telemetry@3.10.173.1 and sqlite3 with json1 dropped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The cpp-client-telemetry 3.10.173.1 port is now in microsoft/vcpkg (PR #52568), so the overlay-port bridge added earlier is no longer needed. Bump the vcpkg baseline to 18a4723aeb (the commit that ships the 3.10.173.1 port) and drop cmake/vcpkg-ports/cpp-client-telemetry. Verified with 'vcpkg install --dry-run' that the manifest now resolves cpp-client-telemetry@3.10.173.1 from the registry and sqlite3 with json1 dropped (the registry port carries default-features:false, combined with ORT's own opt-out). ORT's heavy deps (abseil/onnx/protobuf/flatbuffers) remain pinned via overlay-ports/overrides; only benign minor versions float with the baseline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Complete the registry transition: bump the default-registry baseline to 18a4723aeb (microsoft/vcpkg PR #52568, which ships cpp-client-telemetry 3.10.173.1) so the manifest resolves the new port from the registry now that the overlay bridge is removed. Verified via 'vcpkg install --dry-run': resolves cpp-client-telemetry@3.10.173.1 from the registry, sqlite3 with json1 dropped, and ORT's pinned heavy deps unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d.sh build.sh unconditionally appended --use_telemetry, so './build.sh --build_wasm' became 'build.py --use_telemetry --build_wasm', which the WASM fail-fast guard (added in this PR) correctly rejects - breaking the convenience-script WASM build. Only add --use_telemetry for native builds (skip it when --build_wasm is present). Telemetry stays the default for native builds, and direct 'build.py --build_wasm' was already unaffected (telemetry is off by default). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DeviceId::GenerateUUID() seeded a std::mt19937 from a single std::random_device value, which caps the generated UUID's entropy at 32 bits and risks device-id collisions across a large fleet (birthday-bound ~77k devices), under-counting distinct devices in MAD/DAD telemetry. Draw each UUID field straight from std::random_device (CSPRNG-backed via getrandom // /dev/urandom on the POSIX platforms this file targets), mirroring the SDK's own PAL UUID hardening. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… (vcpkg build fix) telemetry.cc unconditionally included <api/ContextFieldsProvider.hpp>, an internal 1DS SDK header that the vcpkg-installed MSTelemetry::mat target does not expose (only public headers are installed). This broke the vcpkg telemetry build on desktop with "fatal error: api/ContextFieldsProvider.hpp: No such file or directory". ContextFieldsProvider is only used on mobile (Android/iOS) to read the SDK's auto-generated device id, so guard the include with the same #if as its use, and move <TargetConditionals.h> above it so TARGET_OS_IOS is defined for the guard. Verified by a full Linux --use_vcpkg --use_telemetry build: onnxruntime_common (telemetry.cc) now compiles and libonnxruntime.so links (33 MB stripped). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
By default the non-Windows 1DS SDK (cpp-client-telemetry) is statically linked into libonnxruntime, adding ~9 MiB that is mostly its OpenSSL/curl/sqlite3 TLS+HTTP stack. When onnxruntime ships alongside another binary that links the same SDK (e.g. onnxruntime-genai), each binary embeds its own copy, so the footprint is paid per-binary and two independent 1DS LogManager singletons run in one process. Add --telemetry_shared_sdk (default off) to build the SDK as a single self-contained shared library (libmat.so) that several binaries link dynamically and share. The SDK's own dependencies stay static inside libmat.so, so it needs no host libraries. Default static behavior is unchanged (a standalone onnxruntime is smaller fully static), and the one-time vcpkg rebuild the changed triplet causes only affects the opt-in build. Verified on Linux (--use_vcpkg --use_telemetry --telemetry_shared_sdk): libmat.so = 12.1 MiB stripped, NEEDED only system libs; libonnxruntime.so drops from 33.31 to 24.26 MiB stripped (NEEDED libmat.so, 0 MAT symbols embedded), resolved via the existing $ORIGIN RPATH. - cmake/CMakeLists.txt: add onnxruntime_TELEMETRY_SHARED_SDK dependent option - tools/python/util/vcpkg_helpers.py: emit per-port dynamic VCPKG_LIBRARY_LINKAGE for cpp-client-telemetry (deps stay static) in the POSIX triplets - tools/ci_build/build_args.py, build.py: --telemetry_shared_sdk flag + validation, -Donnxruntime_TELEMETRY_SHARED_SDK, thread into Linux/macOS triplet generation - cmake/onnxruntime_common.cmake: install libmat.so next to libonnxruntime via IMPORTED_RUNTIME_ARTIFACTS; FATAL_ERROR if requested with the FetchContent fallback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…untime into bhamehta/posix-telemetry
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve pull conflicts by taking the incoming telemetry branch changes and preserving the validated Apple FetchContent fixes for the 1DS telemetry SDK fallback path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sqlite3 is pulled in only as the non-Windows 1DS telemetry SDK's offline event cache, and the SDK uses it very narrowly (one event table: parameter-bound INSERT/SELECT/DELETE, a few PRAGMAs and VACUUM, UTF-8 only; no triggers, views, FTS, JSON, ALTER, ATTACH, foreign keys, UTF-16, or extension loading). Compile sqlite3 with the matching feature reductions so the offline store is smaller and hardened (no runtime extension loading), while keeping persistence intact. Wired as a per-PORT compile-flag override in the generated POSIX triplets (same mechanism as the linkage override), gated on --use_telemetry so non-telemetry builds keep their vcpkg cache. Applies to any telemetry build; only ORT's own sqlite is affected (ORT itself does not use sqlite). Verified on Linux against the vcpkg sqlite3 port: the set builds cleanly in both Debug and Release, and the SDK references none of the omitted APIs (it uses only bind_*/errmsg/temp_directory, all retained), so the trimmed sqlite links cleanly. Release .text shrinks ~33 KB. Three otherwise-useful omits are intentionally excluded because the vcpkg sqlite3 port enables conflicting options: SQLITE_OMIT_DECLTYPE (vs SQLITE_ENABLE_COLUMN_METADATA, all configs) and SQLITE_OMIT_TRACE / SQLITE_UNTESTABLE (vs SQLITE_DEBUG/SELECTTRACE in Debug). The deeper grammar omits (triggers/views/window functions) require building sqlite from canonical sources and are deliberately left for a custom sqlite port. - tools/python/util/vcpkg_helpers.py: _SQLITE_TELEMETRY_MINIMAL_DEFINES + per-port emission gated on use_telemetry; thread use_telemetry through the Linux/macOS triplet generators - tools/ci_build/build.py: pass args.use_telemetry to the triplet generators Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bhamehta/posix-telemetry
The non-vcpkg (FetchContent) telemetry path failed the default static ./build.sh on Linux in two ways: - install(EXPORT onnxruntimeTargets) rejected onnxruntime_common because it links the FetchContent 'mat' target, which is not installed/exported. Scope the link to \$<BUILD_INTERFACE:mat> so mat is still absorbed into the shared library and in-tree executables but is excluded from the static export (where mat cannot be shipped). The vcpkg MSTelemetry::mat path is imported and unaffected. - telemetry.cc failed to compile because the SDK public headers (NullObjects.hpp, LogManagerProvider.hpp) trip onnxruntime_common's -Werror=unused-parameter. Mark the SDK include directories SYSTEM so the third-party headers are exempt, matching the vcpkg path. Validated on Linux (Ubuntu, gcc-13) FetchContent static build: configure succeeds, the 1DS SDK (libmat.a) builds, and onnxruntime_common (telemetry.cc, device_id.cc, env.cc) compiles and archives. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LogRuntimeError already reduces its file field to a basename so telemetry does not leak usernames or local paths, but the adjacent errorMessage was uploaded verbatim. ORT error messages frequently embed absolute model paths (e.g. 'Load model from /home/<user>/models/foo.onnx failed'), so the same path/username leakage reached telemetry through errorMessage. Add a shared RedactAbsolutePathsForTelemetry helper (core/platform/telemetry_redaction.h) that reduces POSIX, Windows-drive, and UNC absolute paths embedded in a free-form string to their basename, leaving relative paths, URLs, and other text unchanged. Apply it to every errorMessage field on both the POSIX (1DS) and Windows (ETW) telemetry paths. Add unit tests in test/platform/telemetry_redaction_test.cc. Validated on Linux (gcc-13): onnxruntime_common compiles with the wrapped calls; the helper passes a standalone test covering POSIX/Windows/UNC paths, URL/relative-path preservation, and that usernames never survive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address gaps found while reviewing the errorMessage path scrubber: - A path ending at the user's home dir (/home/<u>, /Users/<u>, C:\\Users\\<u>, /root) now reduces to '~' instead of emitting the bare username as the basename. - Paths containing spaces are kept whole while the path clearly continues, so 'C:\\Users\\First Last\\model.onnx' and 'C:\\Program Files\\...' reduce to the basename instead of leaking the username/layout after the first space. - Absolute paths glued to ':' ',' ';' (e.g. 'failed:/abs/path') are now redacted. - file:// URIs have their embedded local path redacted (http/https/ftp still preserved). Extend the unit tests for these cases. Validated with a standalone run of the header over all cases and an onnxruntime_common compile on Linux (gcc-13). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s dirs
Material review found the home-directory redaction fired whenever a path's parent component was literally named 'home'/'users', regardless of position, destroying a real file under an unrelated directory: '/usr/home/config.txt' and '/opt/users/data.bin' both became '~'.
Restrict the '~' reduction to paths whose home marker is the first component ('/home/X', '/Users/X', 'X:\\Users\\X'). Also drop the unreachable 'Documents and Settings' marker (the space-tolerant consumer never yields it as a component), which falsely implied legacy-profile coverage.
Add tests for the over-redaction guard. Validated on Linux (gcc-13): onnxruntime_common compiles and the standalone scrubber passes all cases.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
For cross-repo consistency with onnxruntime-genai's telemetry pipeline: - Replace the basename path scrubber with genai's LooksLikePath/ScrubErrorMessage, which replaces each path-like whitespace token (POSIX multi-segment, Windows drive/UNC, '~/', and URLs) with a '[path]' placeholder. - Cap the scrubbed errorMessage at 256 bytes (kMaxTelemetryErrorMessageLength), matching genai's per-call-site length guard. - POSIX 1DS Initialize: set config['enableIpScrubbing']=true for collector-side client-IP obfuscation, and honor an ORT_TELEMETRY_ENABLED=0/false environment opt-out (skips creating the uploader), mirroring genai's enableIpScrubbing and ORTGENAI_TELEMETRY_ENABLED. Rewrite the unit tests for the [path] behaviour and length cap. Validated on Linux (gcc-13): onnxruntime_common compiles and the standalone scrubber passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…scrub note - ORT_TELEMETRY_ENABLED opt-out now lowercases the value and accepts the same set as onnxruntime-genai (0/false/off/no/disabled/n), so ORT_TELEMETRY_ENABLED=False (Python str(False)), =off, =no no longer silently leave telemetry on. As a privacy control an unrecognized value previously failed in the unsafe direction. Adds <cctype> for std::tolower. - enableIpScrubbing is set only for parity with onnxruntime-genai; the bundled cpp_client_telemetry SDK does not consume this key (client-IP obfuscation is a OneCollector tenant-side setting), so the comment no longer claims an effect it does not deliver. Validated on Linux (gcc-13): onnxruntime_common compiles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…genai parity) - Remove config['enableIpScrubbing']=true: the bundled cpp_client_telemetry SDK does not consume this key (client-IP obfuscation is a OneCollector tenant-side setting), so it was an inert no-op. IP scrubbing stays enabled by default server-side. - Set CFG_INT_MAX_TEARDOWN_TIME=0 (was 10) so Shutdown does not block process exit to upload; persisted events are sent on the next run. Matches onnxruntime-genai and avoids adding exit latency to host apps. Validated by an Android arm64 cross-compile (NDK r29 / Clang 21, FetchContent 1DS SDK): onnxruntime_common incl. posix/telemetry.cc compiles and links. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace ORT_TELEMETRY_ENABLED (which disabled on 0/false/...) with ORT_TELEMETRY_DISABLED, set to a truthy value (1/true/yes/on/y, case-insensitive) to disable telemetry. A single opt-out variable honored by both ONNX Runtime and onnxruntime-genai (which previously used ORTGENAI_TELEMETRY_ENABLED). Validated on Linux (gcc-13) and Android arm64 (NDK r29 / Clang 21): onnxruntime_common compiles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Create the POSIX LogManager with an explicit factory host name (CreateLogManager('OnnxRuntime', true, ...)) instead of the default/unnamed host, matching onnxruntime-genai (which uses 'OnnxRuntimeGenAI'). With distinct named hosts, onnxruntime and onnxruntime-genai run independent LogManagers even when they share one libmat.so, and neither collides on the SDK's default host.
- Correct the onnxruntime_TELEMETRY_SHARED_SDK comment: the shared libmat.so shares the SDK code/TLS-HTTP stack, not the LogManager. Each binary still runs its own named LogManager, so the option does not merge them into one.
Validated on Linux (gcc-13): onnxruntime_common compiles.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a 'Disabling Telemetry' section covering the three opt-out paths (omit --use_telemetry at build, the ORT_TELEMETRY_DISABLED=1 runtime env var, and the on/off API), and update the 'only implemented for Windows' statement to note the optional cross-platform 1DS provider built with --use_telemetry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
C_API.md no longer exists in the repo, so the [C API: Telemetry](./C_API.md#telemetry) reference was a broken link. Point it at the new in-doc 'Disabling Telemetry' section instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context