[PR #10098] [MERGED] Set keyword flags on all tracelog events #27886

Open
opened 2026-01-31 09:24:53 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10098
Author: @miniksa
Created: 5/14/2021
Status: Merged
Merged: 5/15/2021
Merged by: @undefined

Base: mainHead: dev/miniksa/tl_keyword


📝 Commits (3)

  • 683389d set keyword flags on all trace events so we can distinguish and prevent excess work on providers shared with telemetry
  • c191dde add missing providers to wprps
  • 8c4cb12 missing 2 traces and an indent

📊 Changes

15 files changed (+328 additions, -156 deletions)

View changed files

📝 src/ConsolePerf.wprp (+2 -0)
📝 src/Terminal.wprp (+2 -0)
📝 src/cascadia/Remoting/Monarch.cpp (+38 -19)
📝 src/cascadia/Remoting/Peasant.cpp (+10 -5)
📝 src/cascadia/Remoting/WindowManager.cpp (+30 -15)
📝 src/cascadia/WindowsTerminal/IslandWindow.cpp (+4 -2)
📝 src/host/exe/exemain.cpp (+5 -1)
📝 src/host/tracing.cpp (+27 -1)
📝 src/inc/WilErrorReporting.h (+6 -1)
📝 src/inc/til.h (+28 -0)
📝 src/renderer/dx/DxRenderer.cpp (+3 -2)
📝 src/renderer/vt/tracing.cpp (+42 -27)
📝 src/server/ApiDispatchers.cpp (+2 -0)
📝 src/terminal/parser/tracing.cpp (+21 -11)
📝 src/types/UiaTracing.cpp (+108 -72)

📄 Description

Set keyword flags on all events so those sharing a provider with
telemetry do not fire unless tracing is enabled

PR Checklist

Detailed Description of the Pull Request / Additional comments

I initially thought that we would need to split providers here to
accomplish this... but @DHowett helped me realize that might be a lot of
additional metadata and bloat binary size. So with help from a friend
from fundamentals, I realized that we could use Keywords to
differentiate here. We can no longer define 0 keywords as that
represents an any/all scenario. Every TraceLoggingWrite event now
needs a keyword. When our events have a keyword, they're not included in
any trace. Additionally, when we have an explicit keyword to check that
is different from the ones used for the telemetry pipeline, we can
ensure that we only do "hard work" to generate debug trace data when an
"ALL" type listener like TraceView or Windows Performance Recorder with
our profiles is listening to these providers for ALL keyworded events.

Validation Steps Performed

  • - Built with full release build config to confirm performance is
    worse than dev builds BECAUSE of the telemetry event collector camping
    our provider and triggering full trace event generation on shared
    providers.
  • - Built with full release build config to enable statistics
    collection and validated trace event collection is excluded and trace
    event short-circuits work with this change.
  • - Checked that TraceView still sees both telemetry and tracing
    events
  • - Checked that WPR with our .wprp profile sees both telemetry and
    tracing events

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10098 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 5/14/2021 **Status:** ✅ Merged **Merged:** 5/15/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/miniksa/tl_keyword` --- ### 📝 Commits (3) - [`683389d`](https://github.com/microsoft/terminal/commit/683389d452871cd9825fabef4066679fd395d6a5) set keyword flags on all trace events so we can distinguish and prevent excess work on providers shared with telemetry - [`c191dde`](https://github.com/microsoft/terminal/commit/c191ddec349a7226d8485185534b37a581eeb490) add missing providers to wprps - [`8c4cb12`](https://github.com/microsoft/terminal/commit/8c4cb127c571ff8e1323c8a7171762fb1c7df08a) missing 2 traces and an indent ### 📊 Changes **15 files changed** (+328 additions, -156 deletions) <details> <summary>View changed files</summary> 📝 `src/ConsolePerf.wprp` (+2 -0) 📝 `src/Terminal.wprp` (+2 -0) 📝 `src/cascadia/Remoting/Monarch.cpp` (+38 -19) 📝 `src/cascadia/Remoting/Peasant.cpp` (+10 -5) 📝 `src/cascadia/Remoting/WindowManager.cpp` (+30 -15) 📝 `src/cascadia/WindowsTerminal/IslandWindow.cpp` (+4 -2) 📝 `src/host/exe/exemain.cpp` (+5 -1) 📝 `src/host/tracing.cpp` (+27 -1) 📝 `src/inc/WilErrorReporting.h` (+6 -1) 📝 `src/inc/til.h` (+28 -0) 📝 `src/renderer/dx/DxRenderer.cpp` (+3 -2) 📝 `src/renderer/vt/tracing.cpp` (+42 -27) 📝 `src/server/ApiDispatchers.cpp` (+2 -0) 📝 `src/terminal/parser/tracing.cpp` (+21 -11) 📝 `src/types/UiaTracing.cpp` (+108 -72) </details> ### 📄 Description Set keyword flags on all events so those sharing a provider with telemetry do not fire unless tracing is enabled ## PR Checklist * [x] Closes #10093 * [x] I work here * [x] Tests passed * [x] Documentation added in `til.h` about how keywords work and at the only other site of keywords we define in the Host project tracing files. ## Detailed Description of the Pull Request / Additional comments I initially thought that we would need to split providers here to accomplish this... but @DHowett helped me realize that might be a lot of additional metadata and bloat binary size. So with help from a friend from fundamentals, I realized that we could use Keywords to differentiate here. We can no longer define 0 keywords as that represents an any/all scenario. Every `TraceLoggingWrite` event now needs a keyword. When our events have a keyword, they're not included in any trace. Additionally, when we have an explicit keyword to check that is different from the ones used for the telemetry pipeline, we can ensure that we only do "hard work" to generate debug trace data when an "ALL" type listener like TraceView or Windows Performance Recorder with our profiles is listening to these providers for ALL keyworded events. ## Validation Steps Performed - [x] - Built with full release build config to confirm performance is worse than dev builds BECAUSE of the telemetry event collector camping our provider and triggering full trace event generation on shared providers. - [x] - Built with full release build config to enable statistics collection and validated trace event collection is excluded and trace event short-circuits work with this change. - [x] - Checked that TraceView still sees both telemetry and tracing events - [x] - Checked that WPR with our .wprp profile sees both telemetry and tracing events --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:24:53 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27886