[ GLOSSARY ]

Distributed tracing in Laravel

QUICK ANSWER

What is distributed tracing and do I need it for Laravel?

Distributed tracing follows a single request as it hops across multiple services — each service adds a span to a shared trace ID passed in HTTP headers. You need it when a user request legitimately crosses service boundaries (Laravel + Node + Python, etc.). For a single Laravel monolith, per-request tracing (what NightOwl and Laravel Nightwatch Cloud provide out of the box) gives you the same visibility with much less setup.

Updated · 2026-04-13

What it actually is

A request lands on Service A. Service A calls Service B. Service B calls Service C. Each service does work and sends back a response. You want to answer: "why was the user's request slow?" Distributed tracing lets you see every hop with its duration on one timeline.

The mechanism: a traceparent header propagates through every outbound call. Each service emits spans linked to the same trace ID. A trace backend (Jaeger, Tempo, Honeycomb, etc.) assembles the spans into a waterfall.

The W3C trace context

Example traceparent header

text
traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01
             │  │                                 │                │
             │  │                                 │                └─ flags (sampled)
             │  │                                 └─ parent span id
             │  └─ trace id (16 bytes, hex)
             └─ version

Every service extracts the trace ID, creates a new span as a child of the parent span, and propagates a new traceparent (with its own span as the new parent) to downstream services.

When a Laravel monolith doesn't need it

If your architecture is:

  • A single Laravel app
  • A database (or a few)
  • A couple of external HTTP integrations
  • Some queued jobs running in the same codebase

...then per-request tracing within one app is all you need. Both Laravel Nightwatch Cloud and NightOwl record per-request data (DB queries, cache, queued jobs, outgoing HTTP, mail, notifications, exceptions) and let you drill into a single trace. Adding OpenTelemetry doesn't buy you more context — the bottleneck is always inside your one app or one of its direct dependencies.

When you do need it

  • User request fans out across Laravel + a Node frontend SSR + a Python ML service + a Go worker
  • Multiple teams own separate services that collaborate on user journeys
  • You're seeing "it's slow" without being able to tell which service is slow
  • You're building a platform where your Laravel app is called by many internal consumers

Setting it up in Laravel

Two credible paths:

  1. OpenTelemetry PHP SDK — install open-telemetry/sdk and open-telemetry/exporter-otlp. Instrument manually or use the auto-instrumentation packages. Ship to an OTel Collector, forward to Tempo/Jaeger/SigNoz/SaaS. See our OpenTelemetry in Laravel guide.
  2. Vendor SDK — Sentry, New Relic, Datadog all ship SDKs that include trace propagation. Less portable but less work.

Frequently asked questions

What is distributed tracing?

A technique for following a single user request as it hops across multiple services or processes. Every service adds a span to a shared trace ID passed in request headers. The resulting trace shows you, end-to-end, how long each service took — which is invaluable in microservices and useless overkill for a Laravel monolith.

Do I need distributed tracing for my Laravel app?

Only if your system crosses service boundaries. If you're one Laravel monolith talking to a database and a couple of external APIs, per-request tracing (what NightOwl and Nightwatch Cloud provide) covers the same ground. If you have a Laravel API, a Node.js WebSocket server, a Python ML service, and a Go background worker all serving one user journey, distributed tracing is worth the setup cost.

How does distributed tracing work in Laravel?

Usually via OpenTelemetry. The OTel PHP SDK instruments your Laravel app to emit spans, and propagates a W3C traceparent header on outbound HTTP calls. Downstream services (also instrumented with OTel) extract the header and continue the trace. All services ship spans to an OTel Collector, which forwards them to a backend like Grafana Tempo, Jaeger, or a SaaS APM.

Is distributed tracing the same as APM?

Distributed tracing is one capability inside the broader APM category. Traditional APMs (New Relic, Sentry) bundle it with error tracking, metrics, and dashboards. Modern observability stacks (OpenTelemetry + Grafana) separate concerns — tracing is its own product. Both camps ultimately show you the same thing: a flame-graph view of a single request across services.

What's a trace vs a span?

A trace is the entire request's journey across services — a tree of spans sharing one trace ID. A span is one unit of work within the trace — an HTTP call, a DB query, a computation. Spans have parent/child relationships that reconstruct the tree. A span's duration plus its parent-child pointers are what let you render the familiar waterfall diagram.

Does Laravel Nightwatch do distributed tracing?

Partially. The Nightwatch package records per-request traces within one Laravel app — every query, job, cache call, and outgoing HTTP span is tied to the originating request. It doesn't propagate trace context across services by default, so multi-service traces require adding OpenTelemetry on top. For a Laravel-only monolith, Nightwatch's per-request data is sufficient.

Is distributed tracing worth it for a small team?

Usually not. The operational cost of running an OTel Collector, trace backend (Tempo/Jaeger), and instrumenting every service adds up. Small teams benefit more from a focused APM on each service that speaks its language natively. Adopt distributed tracing when you've actually hit the problem it solves — requests that cross services and where you can't tell which service is slow.

PRICING

Flat pricing. No event caps. No per-seat fees.

14-day free trial, no credit card. Your PostgreSQL, your data.

HOBBY

$5 /month

1 app · 14 days lookback · all Laravel events

TEAM

$15 /month

Up to 3 connected apps · unlimited environments · all Laravel events

AGENCY

$69 /month

Unlimited apps · unlimited agent instances · same flat rate at any traffic