mxc icon indicating copy to clipboard operation
mxc copied to clipboard

feat: add WIL-based TraceLogging ETW telemetry (experimental)

Open RamonArjona4 opened this issue 5 months ago • 1 comments

📖 Description

Add experimental telemetry support using the tracelogging crate for pure Rust ETW event emission. No C++ shim or WIL dependency required.

  • New mxc_telemetry crate with define_provider! and write_event! for MXC.Execution and MXC.Error events using COMMON_MXC_PARAMS struct fields
  • build.rs generates provider_def.rs with optional group_id based on MXC_TELEMETRY_PROVIDER_GROUP_GUID env var for internal builds
  • wxc_common::telemetry module: config resolution, sanitize_error_message() (strips Windows paths, Unix paths, UNC paths, and URL credentials), event types with bounded FailureReason enum
  • Schema, config parser, and SDK types extended with telemetry.enabled field
  • Telemetry callsites in wxc and lxc binaries emit execution and error events
  • Experimental feature: requires --experimental flag and telemetry.enabled in the JSON config
  • Non-Windows: all telemetry functions compile as no-ops
  • Design doc at docs/telemetry-wil-integration.md with 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

  • [ x] Signed the Contributor License Agreement
  • [ x] Linked to an issue
  • [ x] Updated documentation (if applicable)
  • [ ] Updated Copilot instructions (if build, architecture, or conventions changed)

📋 Issue Type

  • [ ] Bug fix
  • [ x] Feature
  • [ ] Task

Microsoft reviewers: PR builds don't auto-run (ADO policy). Comment /azp run to start MXC-PR-Build. See docs/pull-requests.md.

Microsoft Reviewers: Open in CodeFlow

RamonArjona4 avatar Jun 04 '26 00:06 RamonArjona4

Can we just use these:

  • https://crates.io/crates/tracelogging
  • https://crates.io/crates/tracelogging_dynamic

MGudgin avatar Jun 08 '26 15:06 MGudgin

Follow-up: seed racelogging into the ADO MxcDependencies feed (review item #4)

This PR adds two new transitive crates that resolve from crates.io on GitHub Actions (hence all GH checks are green), but will 401 on the anonymous ADO MxcDependencies feed until an authenticated fetch seeds them:

  • racelogging 1.2.4
  • racelogging_macros 1.2.3

Both are gated behind [target.'cfg(windows)'.dependencies], so only Windows ADO jobs pull them. The official build uses the separate internal Mxc-Azure-Feed and is unaffected; the fork-PR / Unofficial / Lint / Mac jobs that use the anonymous public feed are the ones that need the seed.

@bbonaby — could you trigger a seeding fetch (or confirm the feed already mirrors these) before this merges, so the ADO MXC-PR-Build pipeline doesn't 401 on the new crates? No code change is required here.

RamonArjona4 avatar Jun 23 '26 22:06 RamonArjona4

Deferred to a separate PR: docs/schema.md version-table drift (review item #2)

The review flagged that docs/schema.md's supported-version table is out of sync with the canonical schemas/schema-version.json. This drift is pre-existing — this PR only added 3 telemetry-related lines and did not touch the version table — so I'm intentionally not fixing it here to keep the telemetry change focused.

Tracking it as a follow-up doc PR rather than expanding the scope of this one.

RamonArjona4 avatar Jun 23 '26 22:06 RamonArjona4

I am not convinced MXC, at this point, needs telemetry. With MXC in alpha + the low number of users + an even lower number of events that are sent to Microsoft, the amount of useful events will be super slim. I do not believe any useful decisions can be made from the small number of events sent to Microsoft.

dhoehna avatar Jun 29 '26 19:06 dhoehna