Skip to content

feat: Query Monitor parity (phase 2) - #2

Merged
ogorzalka merged 3 commits into
developfrom
feat/phase-2
Oct 8, 2026
Merged

ogorzalka merged 3 commits into
developfrom
feat/phase-2

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Phase 2 of the Debugbar integration spec, stacked on #1 (retarget to develop once #1 is merged, before deleting its branch).

Queries without a wpdb subclass

The skeleton's db.php replaces $wpdb after anything this package could set, so the planned subclass is dropped. log_query_custom_data adds a trimmed backtrace to each saved query; the query filter, which runs before WordPress flushes the previous query, copies its error and row count. Works with any drop-in (Pollora's, Query Monitor's, HyperDB).

Components

Each query, HTTP call, transient and (opt-in) capability check is attributed to plugin, mu-plugin, theme, module, app — the project's own code wins, otherwise the innermost frame (a query WordPress makes while Pollora boots it is core's). In WP Queries it is the SQL widget's connection, so its filter links group by component.

New tabs

WP HTTP, WP Cache, WP Capabilities (aggregated: identical checks counted once, no backtrace unless options.wp_capabilities.backtrace), WP Blocks (render time per type, Pollora Blade blocks, block bindings via BindingResolved), WP Assets (scripts, styles, script modules, missing dependencies, Vite builds), WP Languages, and Doctor: a Run doctor button calling _debugbar/pollora/doctor (guarded like Debugbar's stored requests), errors first.

Redirects

wp_redirect() exits outside a Laravel response: the request is stacked by giving Debugbar's HTTP driver a temporary response and sending its cookie with header(). Route names are refreshed first — WordPress can exit before Laravel indexes them, which made Debugbar's collectors throw.

Pollora tab

Async actions queued in the request (pollora/async/dispatched, Pollora/hook#18), WordPress constants and drop-ins.

Depends on

Pollora/framework#442 (BindingResolved, AssetManager::containers()), Pollora/hook#18 (pollora/async/dispatched); both degrade gracefully when absent.

Tests

83 Pest tests (unit + feature), PHPStan level 6, Pint; E2E extended to 10 tests (components, HTTP, transient, capability, blocks, Vite, redirect, doctor button), green locally against the scratch site.

Full backtrace, error and rows for each wpdb query through core filters
(no wpdb subclass, so any db.php drop-in keeps working) and attribution
of queries, HTTP calls, transients and checks to a component. New tabs:
WP HTTP, WP Cache, WP Capabilities (aggregated, on by default), WP
Blocks (with block bindings), WP Assets (with Vite builds), WP Languages
and Doctor (pollora:doctor's web checks on demand). Redirects made with
wp_redirect() are stacked for the next page. The Pollora tab adds the
async actions queued, WordPress constants and drop-ins.
…irectories, readable doctor errors

Each query keeps its 10 innermost frames to show, and is attributed from
its whole trace when it runs: full traces made most of the bar's weight
(309 KB of 411 on a WooCommerce shop page, now 154). Component
directories are not cached until WordPress defines where plugins live,
which had left early lookups without them. The Doctor tab says what
came back when the answer is not JSON (a proxy's 404 while a server
restarts) instead of a JSON syntax error. The Pollora tab adds the
database server, memory limits and web server Query Monitor shows.
@ogorzalka
ogorzalka changed the base branch from feat/phase-1 to develop October 8, 2026 16:25
@ogorzalka
ogorzalka merged commit 54064c3 into develop Oct 8, 2026
4 checks passed
@ogorzalka
ogorzalka deleted the feat/phase-2 branch October 8, 2026 16:26
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.

1 participant