feat(events): add Events Panel for Litestar lifecycle tracking#9
feat(events): add Events Panel for Litestar lifecycle tracking#9JacobCoffee merged 6 commits intomainfrom
Conversation
Implements Phase 9.1 from PLAN.md - the Events Panel for tracking Litestar application lifecycle events and handlers. Features: - Track application lifecycle hooks (on_startup, on_shutdown) - Track request lifecycle hooks (before_request, after_request, after_response) - Display registered exception handlers with their exception types - Record hook execution with timing information - Capture call stack for failed hook executions - Helper functions for handler introspection The panel automatically collects metadata from the Litestar app instance during request processing and displays: - Total number of registered hooks - Number of hooks executed during the request - Total execution time for hooks - Exception handler registry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
…ooks - Fix Makefile to use --extra flags for optional dependencies - Add Events Panel to advanced-alchemy example's extra_panels - Add on_shutdown, before_request, after_request hooks for demo - Makes the Events Panel more interesting to test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR implements Phase 9.1 from the project roadmap, adding comprehensive event and lifecycle tracking capabilities to the Litestar debug toolbar. The implementation introduces a new EventsPanel that displays application lifecycle hooks, request hooks, and exception handlers with execution timing information.
Key Changes
- New Events Panel: Displays lifecycle hooks (
on_startup,on_shutdown), request hooks (before_request,after_request,after_response), and exception handlers with metadata about each handler - Middleware Integration: Automatically collects event metadata from Litestar applications during request processing with graceful error handling
- Comprehensive Testing: Adds 22 unit tests covering all major functionality with good coverage of edge cases
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/debug_toolbar/litestar/panels/events.py |
Core implementation of the Events Panel with helper functions for handler introspection and stack frame capture |
tests/unit/test_events_panel.py |
Comprehensive test suite covering all functions and edge cases including None handlers, lambdas, and wrapped functions |
src/debug_toolbar/litestar/middleware.py |
Integration of events metadata collection into the middleware request processing pipeline |
src/debug_toolbar/litestar/config.py |
Registration of the Events Panel in the default panel configuration |
src/debug_toolbar/litestar/panels/__init__.py |
Export of EventsPanel in the panels module |
src/debug_toolbar/litestar/__init__.py |
Export of EventsPanel in the main Litestar integration module |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add toolbar-events-panel.png screenshot - Add Events Panel to "More Screenshots" section - Add Events panel to Built-in Panels table 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Events Panel section to panels.md - Add Events Panel screenshot to index.md gallery 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update status to Phase 9.1 COMPLETE - Mark all Events Panel tasks as done - Update priority matrix - Update competitive advantages (Django signals equivalent) - Update test count to 305 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add `qualname` field to handler info dict for None handlers - Add docstrings with Args/Returns to helper functions - Remove empty TYPE_CHECKING block from test file - Move fixture to top of test file per codebase convention - Add qualname assertions in handler info tests - Add tests for EventsPanel auto-addition in config - Remove duplicate EventsPanel from example app (auto-added) - Add type annotations to fix type checker errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
EventsPanelclass that displays lifecycle hooks, request hooks, and exception handlersFeatures
on_startup,on_shutdown)before_request,after_request,after_response)Changes
src/debug_toolbar/litestar/panels/events.py- New Events Panel implementationsrc/debug_toolbar/litestar/middleware.py- Added events metadata collectionsrc/debug_toolbar/litestar/config.py- Registered Events Panel as defaulttests/unit/test_events_panel.py- Comprehensive test suiteTest plan
🤖 Generated with Claude Code