Skip to content

Add event-flow tracing to Component trait#210

Merged
ryanoneill merged 1 commit intomainfrom
feature/component-tracing
Mar 9, 2026
Merged

Add event-flow tracing to Component trait#210
ryanoneill merged 1 commit intomainfrom
feature/component-tracing

Conversation

@ryanoneill
Copy link
Owner

Summary

  • Enhances the existing tracing in Component::dispatch_event() to cover the full event-to-message-to-update flow, not just the update step
  • Adds event_kind field to the component_dispatch debug span so traces show whether a Key, Mouse, Resize, etc. event was received
  • Adds a trace-level log after handle_event reporting whether a message was produced, enabling diagnosis of "why didn't my key press do anything" scenarios
  • Adds Event::kind_name() method returning a short variant identifier ("Key", "Mouse", "Resize", etc.) with doc tests and unit tests
  • All tracing remains behind #[cfg(feature = "tracing")] with zero cost when disabled

Test plan

  • cargo test --all-features passes (788 tests)
  • cargo test --no-default-features passes (141 tests)
  • cargo clippy --all-features -- -D warnings clean
  • New unit tests for Event::kind_name() covering all 6 variants
  • New doc tests for Event::kind_name()

🤖 Generated with Claude Code

@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.08%. Comparing base (86fcca8) to head (95cf809).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/component/mod.rs 57.14% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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>
@ryanoneill ryanoneill force-pushed the feature/component-tracing branch from 8e01766 to 95cf809 Compare March 8, 2026 23:07
@ryanoneill ryanoneill merged commit 3bddb37 into main Mar 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants