[ GLOSSARY ]

What is a trace?

QUICK ANSWER

What is a trace in observability?

A trace is the full record of one request's journey through your system — every operation it triggered, in order, with durations. Traces are trees of spans sharing a single trace ID, rendered as waterfall diagrams so you can see at a glance which step ate the time budget. Laravel's nightwatch package records a complete per-request trace automatically; NightOwl renders the waterfall in its request detail view.

Updated · 2026-04-13

The shape of a trace

A trace is a tree. The root span is the whole request. Child spans are the operations that ran inside it. Each span has a start time, end time, and optional parent pointer.

A simplified Laravel trace

text
POST /api/checkout                        [root, 980ms]
├── middleware.auth                       [3ms]
├── middleware.throttle                   [1ms]
├── Controller@store                      [962ms]
│   ├── db.query SELECT user              [4ms]
│   ├── db.query SELECT cart WITH items   [820ms]   ← the bottleneck
│   ├── http.out stripe.com/v1/charges    [140ms]
│   └── view.render checkout.success      [12ms]
└── response.send                         [2ms]

At a glance you can see db.query SELECT cart WITH items owns 84% of the request. No guessing — you drill in and inspect the SQL, see it's loading every cart item for every user ever (an N+1 disguised as an inefficient join), and fix it.

Trace IDs and span IDs

Every span carries a trace ID (shared across the whole trace) and its own span ID. Parent-child pointers rebuild the tree. In a multi-service architecture, trace IDs propagate between services via HTTP headers (traceparent) so spans from different services stitch into one trace.

Traces within a Laravel monolith

Every Laravel request is already a trace once instrumented. The Nightwatch package auto-instruments the framework's common operations — DB queries, cache, mail, queue dispatches, outgoing HTTP — and ties them back to the originating request. NightOwl and Laravel Nightwatch Cloud both consume this data and render the waterfall.

What traces don't solve

  • Aggregation — one trace tells you about one request. For patterns you still need aggregated metrics (p95 per route).
  • Long-running work — queue jobs after the HTTP response need their own trace or a linked span.
  • Cost — storing every trace at high traffic is expensive. Sampling is usually required.

Frequently asked questions

What is a trace in observability?

A trace is the full record of one request's journey through your system — every operation it triggered, in order, with durations. Represented as a tree of spans sharing a trace ID. Tracing tools render traces as waterfall diagrams so you can see at a glance which step ate the time budget.

What's the difference between a trace, a span, and a log?

A trace is the whole request. A span is one operation inside the trace (a DB query, an HTTP call, a function). A log is a free-text event associated with a point in time. Spans have start/end timestamps and parent-child relationships; logs don't. Traces are structured; logs are ad hoc. Modern observability correlates all three — a log within a span within a trace.

How long should I keep traces?

Depends on storage cost. A fully-sampled trace is often 10-100x larger than an equivalent log line. Common retention: 7-14 days for raw traces, aggregated metrics (request counts, percentiles per endpoint) kept for months. Tail-sampling (keep only interesting traces like errors and slow requests) cuts storage by 90%+.

Do I need to instrument every call to get useful traces?

You want enough to find bottlenecks. At minimum: HTTP receipt + DB queries + external HTTP + cache calls + queued job dispatch. Laravel's nightwatch package covers all of these automatically. Adding custom spans for expensive internal operations (image processing, PDF rendering) refines traces further — do it when the framework-level view isn't enough.

Is a trace the same as an APM transaction?

Functionally yes, naming varies. 'Transaction' is New Relic / Datadog's term for a top-level span grouping everything inside one request. 'Trace' is the OpenTelemetry-era term. Same idea: the root span with children. Different vendors also use 'web request,' 'operation,' or just 'request.'

How do traces help debug Laravel apps?

A trace turns 'the checkout page is slow' into a waterfall showing: middleware took 8ms, authentication 3ms, the orders query took 820ms (here's your bottleneck), Stripe API took 140ms, view rendering 12ms. You point at the problem instead of guessing. Without traces you'd profile locally and hope to reproduce.

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