Skip to main content

Record every call of one request and find the slow one

Record an Xdebug trace of one request in the computer-readable format and send the file to Buggregator. It lists every function call of that request with its time and memory, shows the slowest calls, and lets you walk the call tree and search it.

Steps

1. Turn on tracing

Add this to php.ini. xdebug.trace_format=1 is required: Buggregator refuses the other formats with 400. Xdebug does not create the output folder, so create it first with mkdir -p /tmp/traces.

ini
xdebug.mode=trace
xdebug.trace_format=1
xdebug.start_with_request=trigger
xdebug.output_dir=/tmp/traces

2. Trace the request

With trigger, Xdebug traces only a request with the XDEBUG_TRIGGER cookie, query or POST parameter. For one CLI script, pass the settings as flags:

bash
php -d xdebug.mode=trace -d xdebug.trace_format=1 -d xdebug.start_with_request=yes \
  -d xdebug.output_dir=/tmp/traces bin/console app:import

3. Send the file to Buggregator

Post the trace as the request body. A .xt.gz file can go as it is: Buggregator reads gzip itself.

bash
curl -H 'X-Buggregator-Event: xdebug-trace' \
  --data-binary @/tmp/traces/trace.1234567890.xt.gz \
  http://127.0.0.1:8000/

Buggregator answers 200 with {"status":true}. It does not pick up trace files from a folder by itself.

4. Find the slow call

Open Xdebug traces in the sidebar and pick the trace. Slowest & top lists single calls by their time with callees, and functions by their own time. In Call tree, click ▸ to see what a call made, or type in Find a function or file, e.g. PDO->query.

Why it works

A trace records every call: what was called, from which file and line, how long it took and how much memory it used. Buggregator sums it up, so one slow method called many times in a loop stands out. With MCP on, an AI assistant can read the same trace through xdebug_trace_summary.

Checked on with Buggregator v2.8.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces →

Rather not run a script? Download the file yourself →

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you →