Add event-flow tracing to Component trait#210
Merged
ryanoneill merged 1 commit intomainfrom Mar 9, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
- Coverage 92.09% 92.08% -0.01%
==========================================
Files 144 144
Lines 12754 12766 +12
==========================================
+ Hits 11746 11756 +10
- Misses 1008 1010 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Enhance the existing tracing instrumentation in the Component trait's dispatch_event default method to cover the full event-to-output flow. The debug span now wraps both handle_event and update (previously it only wrapped update), and includes the event kind. A new trace-level log after handle_event reports whether a message was produced, enabling users to diagnose "why didn't my key press do anything" scenarios. Also adds Event::kind_name() to provide a short variant identifier (e.g., "Key", "Mouse", "Resize") for use in tracing spans, with doc tests and unit tests. All tracing remains behind #[cfg(feature = "tracing")] so there is zero cost when the feature is disabled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8e01766 to
95cf809
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Component::dispatch_event()to cover the full event-to-message-to-update flow, not just the update stepevent_kindfield to thecomponent_dispatchdebug span so traces show whether a Key, Mouse, Resize, etc. event was receivedhandle_eventreporting whether a message was produced, enabling diagnosis of "why didn't my key press do anything" scenariosEvent::kind_name()method returning a short variant identifier ("Key","Mouse","Resize", etc.) with doc tests and unit tests#[cfg(feature = "tracing")]with zero cost when disabledTest plan
cargo test --all-featurespasses (788 tests)cargo test --no-default-featurespasses (141 tests)cargo clippy --all-features -- -D warningscleanEvent::kind_name()covering all 6 variantsEvent::kind_name()🤖 Generated with Claude Code