mxc icon indicating copy to clipboard operation
mxc copied to clipboard

telemetry: emit a cancellation event on Ctrl-C / console-close / shutdown

Open RamonArjona4 opened this issue 5 months ago • 0 comments

Description of the new feature / enhancement

The SetConsoleCtrlHandler(dacl_ctrl_handler) path (src/core/wxc/src/main.rs ~line 431) handles DACL cleanup on Ctrl-C / Ctrl-Break / console-close / logoff / shutdown, then yields to the default handler which calls ExitProcess — bypassing emit_completion. User cancellation of a long run, or host shutdown/logoff, currently produces no telemetry.

Emit a single "cancelled/terminated" event from the handler so these terminations are observable.

Proposed technical implementation details

  • From dacl_ctrl_handler, emit one MXC.Execution/MXC.Error with a Cancelled outcome/reason before yielding to the default handler.
  • Keep the handler minimal: the OS gives a tight time budget (~5s on shutdown), so do minimal, allocation-light work; the provider must already be registered (telemetry active).
  • ETW writes are fast and synchronous, which suits the constrained handler context.

Deferred from PR #493.

RamonArjona4 avatar Jun 24 '26 21:06 RamonArjona4