The --ui option of run starts the web interface of the Buggregator Server inside Trap:
the build of buggregator/frontend 1.45.0. The CLI marks it experimental.
vendor/bin/trap --uiThen open http://127.0.0.1:8000 in the browser.
The UI port is 8000 by default. Change it with --ui=<port>, TRAP_UI_PORT or trap.xml;
the environment variable wins.
- When the UI port is one of the TCP ports (
8000is), the UI shares it with the rest of the traffic. The port listens onTRAP_TCP_HOST. - Otherwise the UI gets a port of its own, which serves only the UI and listens on
TRAP_UI_HOST(default127.0.0.1). The setup guide of the UI still puts that port in the HTTP addresses, as DSNs: send HTTP to a TCP port instead,8000by default.
On a shared port the UI takes only its own requests, and the others stay HTTP dumps:
/, the files of the UI build and/api/...routes the UI has;- a page of the UI opened in a browser: a
GETthat acceptstext/htmlof/settings,/favorites,/logs,/sentry/...,/{type}or/{type}/{id}with an event type of the UI, as/smtp/{uuid}; - any
/api/...call made from a page of the UI (Sec-Fetch-Site: same-origin), answered 404 when Trap has no such endpoint.
Open the UI from Trap itself: it sends no CORS headers, so a frontend served from another origin, such as a dev
server of buggregator/frontend, can't call its API. An OPTIONS request is an HTTP dump like any other, but one to
/csp or /csp/...: it gets the CORS preflight answer CSP reports need.
A page without an origin (Origin: null), such as the sandboxed frame of an HTML page that runs the
sender's scripts or a page opened from file://, gets 403 with {"code":"origin_null"} from the /api/... routes
of the UI, the files of its events and its WebSocket. It still sends events: a request no UI route takes, Sentry's
/api/{project}/envelope/ included, goes on as before.
The UI asks for no password or token, the MCP token included: anyone who reaches its port sees the caught events. Trap warns at startup when the port listens on a host other than a loopback one.
# UI on its own port 8080, no console output
vendor/bin/trap --ui=8080 -sDumps, Monolog logs, Sentry events, emails with their
other versions and invites, Ray payloads, HTTP dumps, profiles,
Xdebug traces with their call tree, CSP reports on the CSP reports page, and
HTML pages with their own CSS and scripts in a sandboxed frame. Ray html() payloads show as pages
too, without their scripts. Binary data, the traffic no protocol takes, shows as an HTML page: a
hexdump on the feed card and a viewer of the bytes on the page of the event.
The UI keeps the last 200 events; /trap/events/@maxEvents in trap.xml changes it.
A pinned event is pushed out last: only when all the kept events are pinned. A clear keeps the pinned events when
the UI asks so; clear_events of the MCP server keeps them unless told otherwise. Another browser
tab shows a pin made in this one when it loads the event list again, e.g. on a reload.
The «Keep on top of the list» button of a card, or the t key, keeps the event in a block above the feed while new
events arrive, and pins it; how many events stay there is set in Settings › Appearance. Which events the button
keeps on top is kept in the browser, not in Trap. An event that Trap updates, such as a Ray dump sent in parts, keeps its place in
the feed, and its page, when open, shows the update by itself. The application can update an event in place and
keep it on top as well: see Events updated in place.
The events live in the memory of Trap and are gone when it stops. The MCP server works with the same
events: an event deleted in the UI is gone for it too.
The UI also controls ray()->pause(), and every tab shows whether a pause was continued or stopped: see
Ray. With --xdebug its Xdebug page lists the debug
sessions and steps through the ones Trap drives, and its setup guide shows the debugger port: see
Xdebug debugger.
The UI has pages for features of the Buggregator Server that Trap has not: metrics, the mock server, updates. They show no data, and the menu of the mock server stays while HTTP dumps are on: hide it in Settings › Menu. Other features of the server stay hidden, as Trap answers 404 to their endpoints: the Broadcast page, the «Send to inbox» button of an email (Settings › Email relay says the server can't send email), sign-in and the audit log.
An event with a replace key updates the stored event of the same project, type and key instead of adding a new one, as in Buggregator Server 2.17: a state reported every few seconds stays one card with its latest value.
- The key: the
X-Buggregator-Replace-Keyheader of any HTTP request Trap takes (Ray, Sentry, profiles, HTTP dumps, Xdebug traces, HTML pages, CSP reports), or of an email;replace_keyat the top of a Ray request or of the JSON body of an HTML page (the header wins);replace_keyincontext,extraor at the top of a Monolog record; thereplace_keytag of a Sentry event (it wins over the header). A key is trimmed and cut to 200 bytes.dump()andtrap()dumps have no place for one. - The updated event keeps its ID, its pin and its stickiness; an open UI keeps its card in place and marks it «live», and a reload lists it by its new time. The payload, the time and the files of the event (attachments, Xdebug trace files) are the new ones. The ID the new event came with leads to the same event, so the links in its payload work and the next requests of a Ray client add to it; they don't change its key.
"is_sticky": trueat the top of a Monolog record, a Ray request, a Sentry event or the JSON body of an HTML page keeps the event on top of the UI list; other values do nothing. A Ray event takes it from its first request only.- A key of the HTTP header goes no further than this Trap: a remote sender sends the event on without it.
The Logs page lists the Monolog records with a full-text search over the message, the channel and the keys and values of context and extra, case-insensitive, the level and channel filters and a chart of the records over time: by minute, in wider bars over a long period.
The filter bar above a feed narrows it by the values Trap takes from the events; other events have none:
- Monolog: the channel, the level and the host in
extra.hostname, which aHostnameProcessoradds; - Sentry: the host (
server_name), environment, release, level, the logger as the channel, the user (its email, username, ID or IP address) and the tags; - Ray: the host of each payload's
origin; - profiles: the host (
hostname) and the tags; - dumps: the host of the request the dump was made in; a CLI dump has none;
- HTTP dumps: the host of the
Hostheader.
The request view of a trace on the Sentry pages adds the events of the request: Monolog records with its trace ID
in extra.trace_id or context.trace_id, and HTTP dumps and emails with a sentry-trace, traceparent or
X-Trace-Id header of it.
The Sentry section has a page for each kind of data:
- Exceptions: the Sentry error events, one by one or grouped by type and message.
- Traces: the transactions and spans of Sentry SDKs and OpenTelemetry exporters, one trace even when it crosses both. The list gives each trace the duration from its earliest start to its latest end, so work that outlives the request, such as a queued job, counts. A trace opens with the waterfall, the call sequence between services, the related errors and logs. The request view of a trace marks repeated queries with an N+1 hint and groups their spans.
- Service map: the services and what they call (other services, databases, caches, queues) over the period, with requests, errors and durations per service and per call, and the traces through each call. A call is a span with a peer: a database or cache address, an HTTP host, a queue; it leads to the service that served it when that service sends its data to Trap too.
- Logs and Metrics: Sentry
logandtrace_metricitems, OTLP logs and metrics. - Feedback: the user feedback of the project, each with a link to its error; the page of an error shows the feedback on it. The tab shows once the period has feedback.
- Queues: the queue jobs whose last attempt ended in the period, the latest first, with their status, queue, attempts and failures, and the jobs, failures, retried jobs and average duration of the period above. The page of a job shows its attempts on a time scale with the pauses between them, the time each waited in the queue, their errors and traces, and the request that queued the job. The tab shows once the period has a job.
- Crons: the cron jobs of the project, whatever the period, with the last run, the next expected one and the recent runs, failed, timed out and missed ones first; the page of a job shows its runs with their durations, output and traces, and the ping URLs of a job that pings. The tab is always there; with no job it shows how to send the first check-in. A job page opened on a port of the UI's own shows ping URLs of that port, which takes no check-ins.
Traces, logs, metrics, feedback and cron runs make no events in the feed: a Sentry transaction is a trace, and the
feed holds the errors. Trap keeps them in memory while the UI or the MCP server runs, and the UI asks for
them by project and period. The MCP tools list_traces and get_trace read the same traces,
list_queue_jobs the same jobs, list_feedback the same feedback
and list_crons the same cron jobs. "Clear all" in the Sentry section deletes them with the
Sentry events; with the pinned events kept, the feedback on a pinned error stays too. The cron jobs stay, without
their runs. The project list has the projects of cron jobs too, as a ping URL may name a project no event has.
Memory is bounded by these limits; values below 1 fall back to the defaults:
| Environment variable | trap.xml |
Default | Above it |
|---|---|---|---|
TRAP_TELEMETRY_MAX_SPANS |
/trap/telemetry/@maxSpans |
10000 |
the least recently updated traces are dropped |
TRAP_TELEMETRY_MAX_LOGS |
/trap/telemetry/@maxLogs |
5000 |
the oldest log records are dropped |
TRAP_TELEMETRY_MAX_METRICS |
/trap/telemetry/@maxMetrics |
5000 |
the oldest metric values are dropped |
maxSpans counts transactions and spans together; a single trace above it keeps its most recent 90%.
Feedback has a fixed limit of 1 000 entries, cron jobs one of 200 jobs with 100 runs each and 8 MB of ping output
in all, the oldest runs losing theirs first.
These limits are apart from the OpenTelemetry limits of the console.
A trace reports an SQL query that one transaction runs 5 times or more, up to its values: the N+1 pattern of a loop
that loads a relation row by row. The trace page and the MCP tool get_trace show the same
findings:
- Only SQL spans count: a Sentry span of op
dbordb.*, an OpenTelemetry span withdb.systemordb.system.name, but not a Sentrydb.redisspan nor a span whosedb.systemis a store that takes no SQL: Redis, Memcached, MongoDB, Elasticsearch, OpenSearch, Cassandra, Couchbase, CouchDB, DynamoDB, Cosmos DB, Neo4j, HBase, Geode, Coherence. The query is thedb.query.textattribute, elsedb.statement, else the span description, where Sentry SDKs put it (an OpenTelemetry span name is a short summary such asSELECT shop.products). - A span belongs to the transaction it came in, else to the one up its parents: OpenTelemetry and Sentry span streams send no transaction ID. Spans whose transaction has not arrived count together under the parent missing from the trace, as the server span an OpenTelemetry batch exports after its children, else under their topmost span.
- Two queries are the same when they differ only in values: string literals, numbers,
TRUE,FALSEand the placeholders?,$1,:namebecome?; anIN (…)list, the rows ofVALUES (…), (…)or anARRAY[…]of any length become one(?)or[?]; comments go; keywords are upper-cased and spacing is made uniform. Names stay as written, with their digits (table2), and so do"quoted"names and::typecasts. A?or a quote inside a string literal stays in the literal. - The database is the
db.systemordb.system.nameof the span, in any case. A backslash escapes a quote in a literal ofmysql,mariadb,clickhouse,hive,spanner,gcp.spanner,bigqueryandsnowflake, and in anE'…'literal. Only a doubled quote does inpostgresql,sqlite,mssql,microsoft.sql_server,oracle,oracle.db,db2,ibm.db2,h2,h2database,derby,hsqldb,cockroachdb,trino,firebird,firebirdsqlandteradata. For any other database, and when the span names none, a backslash escapes unless a literal of the query would then never end: then no backslash escapes in that query, so'C:\' AND b = 'y'holds two literals. A literal cut off by the 32 KB limit below does not count as never ending, so in a longer query of such a database a literal that really ends in a backslash takes the rest of the part that is read. - Trap reads the first 32 KB of a query: a longer one is shaped by that part and ends with
…, and a bulkVALUESlist cut there still collapses. Queries that differ only after their first 32 KB count as one. - Each finding has the query with its values as
?, the span count, their summed duration, and the place in the code,code.filepath:code.lineno(orcode.file.path:code.line.number) of the first span that has it. sentry-laravel sends it only for queries slower thanSENTRY_TRACE_SQL_ORIGIN_THRESHOLD_MS, 100 ms by default. - With a project chosen, only the spans of that project count, as if the others had not come.
- Trap finds them when a trace is read and keeps them until the trace changes, so a trace that grows as its spans arrive is checked again.
