Finding the real performance problem in a Laravel app · Part 6 of 6
Observability: Pulse, Telescope and OpenTelemetry, and what each one costs
Pulse, Telescope and OpenTelemetry on the same app, each measured for what it costs, a Tempo trace of a webhook, Nightwatch compared from its documentation, and three investigations run through the dashboards: a slow request, a job that fails because its row is gone, and a job that eats memory.
By Abhishek Fouzdar
Five parts of this series were investigations, and every one of them started the same way: a number from a load test, a guess about the layer, a tool fetched for that layer, and then the finding. The tools were fetched because the app had none of its own. Part 6 gives it some, and asks of each what it costs, because an instrument that slows the app it measures is a trade like any other. Three tools: Laravel Pulse, which is free and shows the last hour; Telescope, which is free and shows everything and is not for production; and OpenTelemetry, which is the open standard the rest of the industry uses, with a collector, Tempo and Grafana in the Compose file. Then Nightwatch, Laravel's hosted service, compared from its documentation rather than a trial, because this series spends nothing. And three investigations run through the dashboards instead of through curl, to see what the afternoon would have looked like with them on from the start.
Pulse
Pulse records into the application's own database: slow requests, slow queries, slow jobs, slow outgoing requests, exceptions, cache hit rates, the busiest users, and the server's CPU, memory and disk through a pulse:check process. Install, publish, migrate, and one line for who may see it:
Gate::define('viewPulse', fn ($user) => $user->role === 'admin');
pulse:
<<: *php
command: php artisan pulse:check
Every recorder has a threshold and a sample rate in config/pulse.php, and the thresholds are where it earns its keep: by default a query is slow at a second and a request at a second, which on this app would have recorded nothing until the dashboard and search in part 1, and everything about them. Lowered to 100 ms for queries and 500 ms for requests, which is this series' definition of slow, it would have listed the inbox's sort query from part 3 on its first day.

That is the dashboard after the measurements below, and every card on it is a finding from an earlier part seen from the other side. The cache card lists dashboard:stats and the inbox count keys with their hit rates, which is part 4's table without the typing. The slow queries card has two statements from the webhook job at 1.6 and 1.0 seconds, an INSERT into ticket_events and the assignment UPDATE, which never appeared in any part because they are not slow: they waited on row locks while five k6 users posted webhooks against the same tickets, and only a tool that watches production traffic sees a wait. The exceptions card shows 487 QueryExceptions in the hour, which is the second investigation below. And the slow requests card has POST /login at 1.4 seconds, which is bcrypt under load and the reason part 5's keepalive timeouts were all logins.
Telescope
Telescope records everything: every request with its queries, every job, mail, cache operation, event and exception, each one a row in telescope_entries. That is the reason it is a development tool: a request that runs twelve queries writes thirteen rows plus their bindings, and the inbox under ten users writes a hundred rows a second into the same MySQL that serves the pages. The install adds a service provider that Laravel loads only in local, and TELESCOPE_ENABLED=false in phpunit.xml keeps it out of the tests.

What it is for is the thing the first two instruments of part 2 did by hand: open a request and see its queries, with bindings and timings, in order. desk:queries grouped them; Telescope shows them one by one with the stack of where each was made, which is the view that finds an N+1 in a partial in seconds.
OpenTelemetry
Pulse and Telescope are Laravel's view of a Laravel app. OpenTelemetry is the one everyone else's tools read: a trace is a tree of spans, each with a start, a duration and attributes, and a span can be a request in nginx, a query in MySQL, a job on the queue, and the same trace id links them across processes. The PHP side is an extension plus Composer packages that hook the framework without changes to the app:
RUN apk add --no-cache --virtual .otel-deps $PHPIZE_DEPS linux-headers \
&& pecl install opentelemetry \
&& docker-php-ext-enable opentelemetry \
&& apk del .otel-deps
composer require open-telemetry/opentelemetry-auto-laravel open-telemetry/opentelemetry-auto-pdo \
open-telemetry/exporter-otlp open-telemetry/sdk
and environment variables on every PHP container, since the workers and the scheduler are part of the same traces:
environment:
OTEL_PHP_AUTOLOAD_ENABLED: "${OTEL_ENABLED:-false}"
OTEL_SERVICE_NAME: deskmini
OTEL_TRACES_EXPORTER: otlp
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
OTEL_PROPAGATORS: baggage,tracecontext
The other end is three containers behind a Compose profile, about 190 MB between them on this machine: the collector, which receives OTLP and batches it; Tempo, which stores traces on disk for an hour; Grafana, which reads Tempo and draws the tree.

The webhook request as a tree: the server span, under it the Eloquent calls the Laravel instrumentation hooks (Customer::get, Ticket::find, Message::create), under those the PDO spans from the PDO instrumentation with the statement text, and a client span for the Redis push that queued the job. Twenty-seven spans for one 89 ms request, which is both the value and the cost.
Two things about the setup that the documentation does not lead with. The hooks are registered through a Composer plugin, tbachert/spi, and Composer refuses plugins it has not been told to allow: with --no-interaction it silently skipped it, the PDO spans arrived as orphan traces and the request spans never came, until composer config allow-plugins.tbachert/spi true and a fresh install. And the scheduler and the pulse:check container run queries all day with no request around them, so each query became a root span of its own and the trace list was PDO noise; both containers now carry OTEL_PHP_AUTOLOAD_ENABLED=false.
One thing did not work. The job spans, the ProcessInboundTicket that the webhook queues, never reached Tempo from Horizon's worker processes, though the workers carry the same environment and the request trace carries the queue push. A long-running worker exports when its batch fills or when something flushes it, and an hour of looking did not find what Horizon's horizon:work processes needed; the trace stops at the push. It is in the repository as a known gap rather than hidden, because a trace that silently ends at the queue is the kind of thing this part is supposed to catch.
What each one costs
Each instrument against the same scenario, the inbox at ten users for sixty seconds, measured one at a time with the others off, on the sixteen-worker stack from part 5:
| Instrumentation | p50 | p95 | p99 | req/s | Cost at the median |
|---|---|---|---|---|---|
| None | 162 ms | 260 ms | 331 ms | 62.5 | |
| Pulse | 207 ms | 305 ms | 362 ms | 49.4 | +28% |
| Telescope | 465 ms | 1.14 s | 3.48 s | 17.9 | +187%, 137,611 rows in a minute |
| OpenTelemetry, every request | 381 ms | 557 ms | 649 ms | 27.3 | +135% |
| OpenTelemetry, one request in ten | 208 ms | 319 ms | 404 ms | 48.7 | +28% |
Telescope is the development tool it says it is: three times slower and a hundred and thirty-seven thousand rows into the production database in a minute, which would have been a part 3 finding of its own. OpenTelemetry at full sampling more than doubles the request, because every one of the twenty-seven spans is built in PHP and the lot is exported over HTTP to the collector before the response can finish; at one request in ten, OTEL_TRACES_SAMPLER=parentbased_traceidratio with OTEL_TRACES_SAMPLER_ARG=0.1, it costs what Pulse costs. Pulse's 28% is the price of its recorders running on every request and writing to MySQL, and it is the one of the three that a production app runs at 100%, because an hour of what it shows above is worth a quarter of the throughput on a server that has it to spare, and on one that does not, its sample rates go down the same way.
The stack this series leaves behind runs Pulse, Telescope in local only, and OpenTelemetry at ten percent, and the inbox under all three together measured 115 ms at the median in the final run of the day, which is faster than the "none" row above, because the host was quieter at a quarter to three than at twenty to. The noise floor from part 2 applies to this table as to every other: the ratios are the finding, not the milliseconds.
Nightwatch, from the outside
Nightwatch is Laravel's own hosted monitoring, launched in 2025, and this series did not sign up for it, so this is what its documentation and pricing page say rather than what a dashboard showed. The shape is the Pulse list grown up: requests, queries, jobs, scheduled tasks, commands, outgoing requests, cache, mail, notifications, exceptions and logs, each counted as an event, with the trace of an entry point kept whole when the entry point is sampled in. The mechanism is a Composer package plus an agent process, php artisan nightwatch:agent, that the application talks to on a local port and that batches and ships events to Laravel's servers in the US or EU; serverless hosting needs a machine somewhere to run it. The documentation recommends starting with NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1 for a new application and raising it from there, which is also the honest answer to the overhead question above.
The free plan is 300,000 events a month with fourteen days of lookback, unlimited applications and seats, and projects that pause after thirty days of inactivity; Pro is $20 a month for 7.5 million events and thirty days, Team $60 for 30 million and sixty days, with additional events at 35 to 50 cents per hundred thousand and a spending cap that stops ingestion. There is no self-hosted option. An event is a request or a query or a job, so the inbox scenario from part 1, ten users for a minute, at a hundred queries per page and six pages a second, would have been about forty thousand events in sixty seconds before part 2 fixed the N+1s, and about six thousand after, which is the kind of arithmetic the sample rate exists for.
Against the three above: it replaces Pulse's dashboard and Telescope's detail with one hosted screen and adds what neither has, which is alerting, retention past an hour, and a view across every environment, for a price and a dependency. It does not replace OpenTelemetry for anyone whose traces need to include nginx, a Go service or a database proxy, because it reads Laravel's events, not the wire. For a Laravel-only team that would rather pay $20 than run a collector, it is the obvious choice; for this series the choice was made by the rule that it spends nothing.
Three investigations
A slow request. Pulse's slow-requests card says GET / took 1,026 ms once in the hour, and the dashboard is cached. The one slow one is the cold computation after a cache clear, which the stampede lock in part 4 makes a single event, and the card is where that single event shows up with a time and a count. The same request in Telescope is 28 ms and twelve queries on the warm path, and in Tempo it is a trace whose longest span is the Redis GET. Three views, three questions answered: how often, what it ran, and where the time went.
A failing job. The exceptions card shows 487 QueryExceptions and Horizon shows 965 failed jobs, most of them with ModelNotFoundException: No query results for model [App\Models\Ticket]. The webhook scenario queues a job per new ticket, the benchmark reset deletes those tickets a few seconds later, and every job still on the queue restores its serialised ticket, finds nothing, and fails. It is an artefact of the benchmark and a real production shape: a job that runs after the row it was queued for is gone. Laravel has the answer as a property on the job:
public bool $deleteWhenMissingModels = true;
The job is deleted quietly when its model is missing instead of failing three times and landing in the failed-jobs table with a stack trace nobody needs. The 131 failures from part 5 were the same shape with a different symptom, a null customer in a mail view, and were fixed by eager loading; this is the general case.
A job that eats memory. The digest job before part 5 loaded every open ticket an agent owned with every message, to put ten subjects in an email. Measured in tinker for the busiest agent, 920 open tickets and 5,444 messages: 12 MB above the baseline the old way, 0.17 MB the new way, a count and ten rows. Twelve megabytes is not a crash, and twenty agents in a row on one worker is 240 MB of churn, which is why Horizon's memory option, 128 MB for the default supervisor, restarts a worker that grows past it: the restart is the instrument, and the Horizon dashboard's process count is where a worker restarting every few jobs shows. The honest version of this investigation is that the digest was caught by reading the code in part 5, not by a tool, because no tool here measures a job's memory; Nightwatch's jobs page and OpenTelemetry's metrics both can, and neither is in this stack.
What went wrong
Composer skipped the plugin that registers the hooks. composer require under --no-interaction installed the OpenTelemetry packages and quietly declined the tbachert/spi plugin they rely on, and the first search in Tempo found PDO spans as orphan traces and no request at all. allow-plugins in composer.json is the fix, and the symptom, instrumentation that half works, is worth recognising.
The scheduler flooded the trace store. With auto-instrumentation on every PHP container, the scheduler's and Pulse's own queries became root traces, and the ten most recent traces were PDO::prepare and sql INSERT. Tracing is for the processes that handle requests and jobs; the others have it off.
Horizon's workers kept their spans. The gap above. The request shows the queue push and the job's trace was never exported from the worker, and this part ships with that written down rather than solved.
The failed-jobs count grew while the measurements ran. From 131 to 965 between part 5 and this part's screenshot, because the reset that cleans up the webhook scenario kept racing the queue. The fix on the job is above; the fix on the benchmark is to wait for the queue to drain before resetting.
Pulse's defaults would have recorded nothing from part 1. A one-second threshold for slow queries and slow requests is the package's; on this app in part 1 the inbox's 32 ms sort and the ticket page's 329 queries were both well under it and both the problem. The thresholds are 100 ms and 500 ms in this repository, and they are the kind of number to set from the app's own baseline.
That is the series. The main post is the overview and the index, the app is in shipbytes/blog-examples with one commit per part and every benchmark's summary under bench/results/, and the dashboard that took ten seconds in part 1 takes fourteen milliseconds, with the instruments to notice if it ever stops.
New posts by email
Get new posts by email. Nothing else, no digests, unsubscribe in one click.
Comments
Comments are GitHub Discussions in shipbytes/discussions. Sign in with GitHub to post.
In this series
6 / 6- OverviewFinding the real performance problem in a Laravel app
- Part 1The app, the data, a load test and a baseline
- Part 2The application layer: a profiler, flame graphs and the N+1s
- Part 3The database on a million rows
- Part 4Caching: what to cache, the stampede, and the cache that looked right
- Part 5Queues, workers and the server: the number that shaped every table
- Part 6Observability: Pulse, Telescope and OpenTelemetry, and what each one costs