Skip to content

Add debug_output_tracing crate to oss/support#2936

Open
benhillis wants to merge 2 commits intomicrosoft:mainfrom
benhillis:debug_output_tracing
Open

Add debug_output_tracing crate to oss/support#2936
benhillis wants to merge 2 commits intomicrosoft:mainfrom
benhillis:debug_output_tracing

Conversation

@benhillis
Copy link
Member

Windows-only tracing infrastructure that routes tracing events to OutputDebugStringA with a per-layer filter that avoids formatting overhead when no debugger is attached.

Windows-only tracing infrastructure that routes tracing events to
OutputDebugStringA with a per-layer filter that avoids formatting
overhead when no debugger is attached.
@benhillis benhillis requested review from a team as code owners March 11, 2026 01:09
Copilot AI review requested due to automatic review settings March 11, 2026 01:09
@github-actions
Copy link

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

@github-actions github-actions bot added the unsafe Related to unsafe code label Mar 11, 2026
]

[workspace.metadata.xtask.unused-deps]
ignored = ["debug_output_tracing"]
Copy link
Member Author

Choose a reason for hiding this comment

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

this was needed because the crate is only used in our closed source repo

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Windows-only support crate that integrates tracing with the Win32 debug output stream, enabling low-overhead debug logging by filtering events out entirely when no debugger is attached.

Changes:

  • Introduces support/debug_output_tracing with DebugOutputWriter (writes to OutputDebugStringA) and DebuggerPresentFilter (gates on both level and IsDebuggerPresent()).
  • Registers the crate in the workspace and workspace dependencies.
  • Updates workspace unused-deps metadata and lockfile for the new crate.

Reviewed changes

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

File Description
support/debug_output_tracing/src/lib.rs Implements the OutputDebugStringA writer and IsDebuggerPresent-based per-layer filter.
support/debug_output_tracing/Cargo.toml Declares Windows-only dependencies (tracing, tracing-subscriber, winapi).
Cargo.toml Adds the crate to workspace members/dependencies and ignores it in xtask unused-deps checks.
Cargo.lock Adds the new crate entry.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

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 3 out of 4 changed files in this pull request and generated 2 comments.


You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +54 to +55
# support crates consumed by closed-source only
"support/debug_output_tracing",
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The workspace member entry is grouped under a comment saying it’s “consumed by closed-source only”, but this PR is adding an OSS support crate. This label is confusing/misleading for future maintainers; consider moving this entry to an appropriate group (or adjusting the comment to reflect its intended OSS usage).

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

I feel like this is fine but I'm open to other opinions.

Comment on lines +62 to +64
[workspace.metadata.xtask.unused-deps]
ignored = ["debug_output_tracing"]

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

debug_output_tracing is added to [workspace.dependencies] but is not referenced anywhere in the repo (and then globally ignored by the unused-deps xtask pass). If the crate isn’t meant to be used by any OSS members yet, it would be cleaner to avoid adding it to workspace.dependencies until it has an in-repo consumer (or add a small Windows-only integration that uses it) so the ignore isn’t needed.

Suggested change
[workspace.metadata.xtask.unused-deps]
ignored = ["debug_output_tracing"]

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

If there's a better way to do this I'm open to it, there is a user it's just internal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants