Serenade’s browser profiler is the analogue of Symfony’s Web Debug Toolbar + Profiler. It is not the console (debug:container, ratatui TUI).
| Surface | Role |
|---|---|
Console (serenade-console / CLI) |
Operator commands offline |
Profiler (serenade-profiler) |
Per-request browser debug in dev |
Disabled by default (ProfilerConfig::disabled()). Apps enable explicitly:
use std::sync::Arc;
use serenade_profiler::{AsyncProfilerMiddleware, ProfilerConfig, ProfileStore};
let store = Arc::new(ProfileStore::new(50));
let config = ProfilerConfig::enabled(50);
kernel.push_middleware(AsyncProfilerMiddleware::new(Arc::clone(&store), config));Never leave the toolbar on by default in production configs.
- Middleware allocates a token, stores it on the request as
_profiler_token. - Controllers run; apps may call
record_queryfor SQL panels. - On the way out, HTML responses gain a fixed toolbar linking to
/_profiler/{token}. try_handle_profilerserves the index and detail pages.
| Panel | Source |
|---|---|
| Request / routing / timing | Middleware |
| Logs | ProfilerLogLayer + request scope (with_profile_scope / install_log_scope) |
| Database | App adapters → record_query(store, token, QueryEvent) |
| Views | No built-in view panel; apps own view timing if they record it |
Install ProfilerLogLayer on your tracing subscriber (alongside serenade-observability channels). While a profile scope is active, matching events appear on that request’s Logs panel.
Documented also in KERNEL.md and OBSERVABILITY.md: CLI debug commands inspect the container and config; the profiler inspects one HTTP request in the browser.