feat: add WIL-based TraceLogging ETW telemetry (experimental)#493
feat: add WIL-based TraceLogging ETW telemetry (experimental)#493RamonArjona4 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an experimental TraceLogging ETW telemetry pipeline to MXC, including a WIL-based C++ shim with Rust wrappers, config/schema plumbing (experimental.telemetry.enabled), internal-build GUID/license override hooks, and validation scripts/tests/docs.
Changes:
- Introduces
mxc_wil_telemetry(build-time WIL header acquisition + C++ TraceLogging provider shim + Rust FFI wrappers). - Adds
wxc_common::telemetrymodule and wires telemetry init/emit/shutdown intowxc-execandlxc-execbehind--experimental+ config flag. - Adds schema/docs/examples/tests and ADO pipeline steps for internal GUID substitution + SDK license override.
Reviewed changes
Copilot reviewed 28 out of 30 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/scripts/run_telemetry_etw_smoke_test.ps1 | Adds an admin-required ETW capture smoke test script for the public provider GUID. |
| tests/scripts/run_telemetry_build_override_test.ps1 | Adds a validation script for MXC_TELEMETRY_CONFIG_OVERRIDE build behavior. |
| tests/examples/28_telemetry_enabled.json | Adds an example config enabling experimental telemetry. |
| src/testing/wxc_e2e_tests/tests/e2e_windows.rs | Adds ignored Windows E2E tests for telemetry enabled/disabled paths. |
| src/testing/wxc_e2e_tests/src/lib.rs | Adds run_wxc_example() helper for running configs from tests/examples/. |
| src/mxc_wil_telemetry/src/lib.rs | Implements Rust-safe wrappers around the C++ telemetry shim (no-op on non-Windows). |
| src/mxc_wil_telemetry/shim/mxc_telemetry_shim.h | Declares the extern “C” surface for Rust FFI. |
| src/mxc_wil_telemetry/shim/mxc_telemetry_shim.cpp | Implements WIL TraceLogging provider + Part B fields + event emission. |
| src/mxc_wil_telemetry/Cargo.toml | Adds the new crate with build dependencies for download/extract/compile. |
| src/mxc_wil_telemetry/build.rs | Downloads/extracts WIL headers, applies override, compiles shim (Windows-only). |
| src/core/wxc/src/main.rs | Initializes telemetry from config and emits execution/error events on completion. |
| src/core/wxc_common/src/telemetry/mod.rs | Adds telemetry module entrypoint: enablement logic + init/shutdown. |
| src/core/wxc_common/src/telemetry/events.rs | Defines telemetry event types, sanitization, and emit wrappers. |
| src/core/wxc_common/src/models.rs | Adds experimental.telemetry config model (TelemetryConfig). |
| src/core/wxc_common/src/lib.rs | Exposes telemetry module from wxc_common. |
| src/core/wxc_common/src/config_parser.rs | Parses experimental.telemetry.enabled into TelemetryConfig + tests. |
| src/core/wxc_common/Cargo.toml | Links wxc_common against the new mxc_wil_telemetry crate. |
| src/core/lxc/src/main.rs | Mirrors telemetry init/emit wiring for the Linux executor (no-op behavior). |
| src/Cargo.toml | Adds mxc_wil_telemetry to the Rust workspace + workspace deps. |
| src/Cargo.lock | Updates lockfile for new crate + added build dependencies. |
| sdk/src/types.ts | Adds TypeScript TelemetryConfig and experimental.telemetry typing. |
| scripts/apply-license-override.ps1 | Adds script for internal license override injection/restoration. |
| schemas/dev/mxc-config.schema.0.7.0-dev.json | Extends dev schema with experimental.telemetry.enabled. |
| README.md | Documents experimental telemetry behavior and adds doc link. |
| docs/telemetry-wil-integration.md | Adds detailed architecture and internal-build override documentation. |
| docs/schema.md | Updates schema docs to include experimental.telemetry. |
| build/telemetry/packages.config | Adds private NuGet package manifest for internal telemetry group GUID header. |
| build/telemetry/nuget.config | Adds scoped nuget.config with <clear/> for deterministic internal restore. |
| .gitignore | Ignores restored private telemetry package artifacts and license backup. |
| .azure-pipelines/templates/Rust.Build.Job.yml | Adds official-build steps for internal NuGet restore + env var injection + license override. |
|
Can we just use these: |
2e88af1 to
89a7d69
Compare
d348769 to
d6eccb0
Compare
d6eccb0 to
5edf9ed
Compare
5edf9ed to
27c74b9
Compare
2a8e935 to
73562f3
Compare
There was a problem hiding this comment.
⚠️ Not ready to approve
There are correctness/privacy issues to address (invalid $schema reference in the new telemetry example and incomplete Unix path sanitization that can leak /Users/<name> into telemetry).
Copilot's findings
- Files reviewed: 22/24 changed files
- Comments generated: 8
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
|
|
||
| /// Unregister the TraceLogging ETW provider. | ||
| /// | ||
| /// Must be called before process exit if `init()` returned `true`. |
19e2297 to
81dc63f
Compare
There was a problem hiding this comment.
⚠️ Not ready to approve
A few correctness/robustness issues were found in telemetry sanitization and failure classification that can lead to misleading or malformed telemetry output.
Copilot's findings
- Files reviewed: 21/22 changed files
- Comments generated: 6
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
87339b9 to
81dc63f
Compare
81dc63f to
39559fd
Compare
Add pure Rust TraceLogging ETW telemetry for MXC using the tracelogging crate. No C++ shim, WIL, or FFI required. - New mxc_telemetry crate with build.rs-generated provider definition - MXC.Execution and MXC.Error events with MICROSOFT_KEYWORD_MEASURES - Common event fields (Version, Channel, IsDebugging, UTCReplace_AppSessionGuid) - PII sanitization for error messages (path stripping, URL credential removal) - Optional provider group GUID via MXC_TELEMETRY_PROVIDER_GROUP_GUID env var - Telemetry gated behind experimental.telemetry.enabled config + --experimental flag - Cross-platform: full ETW on Windows, no-op stubs on Linux/macOS - ETW smoke test script and example config Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
39559fd to
b6e02db
Compare
📖 Description
Add experimental telemetry support using the tracelogging crate for
pure Rust ETW event emission. No C++ shim or WIL dependency required.
mxc_telemetrycrate withdefine_provider!andwrite_event!forMXC.ExecutionandMXC.Errorevents using COMMON_MXC_PARAMS struct fieldsbuild.rsgeneratesprovider_def.rswith optionalgroup_idbased onMXC_TELEMETRY_PROVIDER_GROUP_GUIDenv var for internal buildswxc_common::telemetrymodule: config resolution,sanitize_error_message()(strips Windows paths, Unix paths, UNC paths, and URL credentials), event types
with bounded
FailureReasonenumtelemetry.enabledfieldwxcandlxcbinaries emit execution and error events--experimentalflag andtelemetry.enabledin the JSON config
docs/telemetry-wil-integration.mdwith architecture,feature comparison table, and GUID override mechanism
Build integration (pipeline GUID substitution, license override script)
will follow in a separate PR.
🔗 References
#492
🔍 Validation
Built locally and ran unit tests. Validated that ETW events fire when build configuration is not set to allow telemetry.
Validated that telemetry appears as expected in the UTC when telemetry provider is correctly enabled.
✅ Checklist
📋 Issue Type
Microsoft reviewers: PR builds don't auto-run (ADO policy). Comment
/azp runto start
MXC-PR-Build. See docs/pull-requests.md.Microsoft Reviewers: Open in CodeFlow