Filed underL03 · Cloud & DevOps
Published
Reading time24 min
Updated
Field notes · L03 Cloud & DevOps

Anatomy of a requestOne click traced through CDN, WAF, load balancer, app and database

Distributed tracing explained hop by hop: DNS, TLS, CDN, WAF, load balancer, app, cache, database and queue, with W3C traceparent propagation.

The short answer

Distributed tracing records one request as a tree of timed spans, one per unit of work, joined by a shared trace ID that every hop passes to the next. On the web that ID travels in the W3C traceparent header: 32 hex characters of trace ID, 16 of parent span ID and a sampling flag. A request's lifecycle runs DNS, TLS, CDN, WAF, load balancer, application, cache, database and often a queue. Each hop can add latency or fail on its own. You only get a complete trace if every hop that does work also forwards that header.

That's the short answer. The rest of this post follows one click, a user pressing "Pay" on a checkout page, through every hop between the browser and the database. For each hop we cover what it does, where latency and failures hide, how trace context gets through (or gets lost), and which part of the organisation owns it. Most "we have tracing" set-ups go dark at one or two of these hops. Usually it's the edge and the queue.

01What distributed tracing actually is (and isn't)

A trace is the whole journey of one request. A span is one timed operation within it: "WAF evaluated managed rules", "SELECT on orders", "published to payments.captured". Each span records a start time, a duration, a status, attributes, and the ID of its parent span. Rebuild the parent links and you get a tree. Draw it against time and you get the waterfall every tracing UI shows.

Three things make it work:

  1. Context propagation. Each hop reads the incoming trace context, creates its own span as a child, and writes updated context onto every outbound call. Skip one hop and the tree breaks in two.
  2. Instrumentation. Something has to create the spans: a library, an agent, a proxy module or the platform itself.
  3. Sampling and export. You can't afford to keep every span of every request. Something decides what to keep and ships it to a backend.

Tracing is not logging with extra steps, and it doesn't replace metrics. Metrics tell you that p99 checkout latency doubled. Traces tell you which hop doubled in the slow requests. Logs tell you why that hop misbehaved. Use the trace ID to join all three.

02The W3C traceparent header, field by field

W3C Trace Context has been a W3C Recommendation since 23 November 2021. It defines two headers. traceparent carries the identity. tracestate carries vendor-specific extras.

Text
traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01

version      00
trace-id     4bf92f3577b34da6a3ce929d0e0e4736
             16 bytes, constant for the whole request
parent-id    00f067aa0ba902b7
             8 bytes, the caller's span ID
trace-flags  01
             8 bits; 01 = sampled

Rules worth knowing:

  • An all-zeros trace ID or parent ID is invalid. A receiver should discard that header and start a new trace.
  • Each hop that creates a span replaces the parent-id with its own span ID before calling downstream. The trace ID never changes.
  • The sampled flag tells downstream services that the caller is recording this trace. Most SDKs default to a "parent-based" sampler, so downstream services do whatever the caller decided.
  • Trace Context Level 2, still a Candidate Recommendation Draft (last published 28 March 2024), adds a random flag. It asserts that at least the right-most 7 bytes of the trace ID are random. Samplers can then make consistent probabilistic decisions from the ID alone.
  • tracestate is limited to 32 list members. The spec says vendors should handle at least 512 characters, and if the traceparent wasn't changed then tracestate must not be either.

W3C Baggage, a Candidate Recommendation Snapshot since 30 May 2024, is the companion header for application key/value pairs such as tenant.id=acme. It is useful, but it goes to every downstream service, including third parties. Never put anything in baggage you wouldn't put in a URL.

03The request path at a glance

Diagram
 Browser
   │  1 DNS lookup ──────────────► resolver ─► authoritative DNS
   │  2 TCP + TLS 1.3 (or QUIC)
   ▼
 CDN edge PoP ──3 cache lookup ──(hit)──► response
   │  4 WAF / bot / rate-limit rules
   │  (miss or dynamic)
   ▼
 Origin load balancer ──5 route, health check, retry
   ▼
 Application ──6 handler ──┬─7 cache (Redis)
                           ├─8 database (Postgres)
                           └─9 queue ──► worker ──► payment provider

The ownership map below matches the eight layers we work across. It's the same map we use when someone asks "whose problem is this p99?"

Hop What it does Primary owner Also involved
1. DNS Name to address L03 Cloud & DevOps L01 Managed IT (internal resolvers, office networks)
2. TLS / QUIC Encrypted session L02 Security (cert and cipher policy) L03 (termination point, renewal automation)
3. CDN Caching, edge compute L03 Cloud & DevOps L05 Software (cache headers)
4. WAF Filtering, bot and rate limits L02 Security L03 (rule deploys)
5. Load balancer Routing, health, retries L03 Cloud & DevOps –
6. Application Business logic L05 Software L06 AI & Automation (model calls in the path)
7. Cache Hot reads L05 Software (semantics) L03 (runs it)
8. Database Durable state L04 Data L05 (query shape, pool size)
9. Queue / worker Async work L05 Software L04 (streams), L06 (pipelines)
Browser timing What the user felt L07 Design L05
Sampling, SLOs, cost What's worth recording L08 Strategy L03

04Hop 1: DNS, the latency nobody traces

What happens. Before anything else, the browser resolves checkout.example.com. It checks its own cache, then the OS cache, then a recursive resolver, which may in turn ask your authoritative nameservers. Usually it's answered from cache in microseconds. Sometimes it takes a full walk.

Where latency hides. Very low TTLs, set "so failover is fast", turn cache hits into lookups. CNAME chains (checkout → CDN hostname → regional hostname) add a lookup per link on a cold cache. Corporate resolvers and VPN split-DNS add their own delay. That's an L01 problem that looks like an L03 one.

Where failures hide. DNS failures don't show up as errors in your server logs, because the request never arrives. The clearest recent example is AWS's us-east-1 outage of 19–20 October 2025. A latent race condition in DynamoDB's automated DNS management left the regional endpoint with an empty record. Every client that resolved it, AWS's own internal services included, failed to connect. The service behind the name was fine. The name wasn't.

Tracing. No trace context exists yet, so there's nothing to propagate. Measure this hop from the client with Navigation Timing (domainLookupStart → domainLookupEnd) in your real-user monitoring, and with synthetic checks from several networks. If your RUM tool can start the trace in the browser and send traceparent on the API call, the DNS and connect phases can sit as the first spans of the same trace.

05Hop 2: TLS 1.3 and QUIC, where round trips go

What happens. Over TCP you pay one round trip to open the connection, then one for the TLS 1.3 handshake, before the request goes out. QUIC and HTTP/3 merge transport and crypto setup into a single round trip (RFC 9001).

Worked example: why the edge matters (illustrative assumptions). Take a user 120 ms RTT from your origin and 10 ms from the nearest CDN PoP. Assume a cold connection, no packet loss, and ignore TCP slow start and server time.

Path Round trips before the response starts Network time
Direct to origin, TCP + TLS 1.3 TCP 1 + TLS 1 + request 1 = 3 × 120 ms 360 ms
Via CDN, TCP + TLS 1.3, warm edge-to-origin pool 3 × 10 ms + 1 × 120 ms 150 ms
Via CDN, HTTP/3, warm pool 2 × 10 ms + 1 × 120 ms 140 ms

Most of the gain comes from terminating TLS close to the user and reusing a warm connection to origin. HTTP/3 shaves a little more. TLS 1.3's 0-RTT early data can save another round trip, but RFC 8446 §8 is explicit that early data can be replayed. Never accept it on non-idempotent routes like POST /pay.

Where failures hide. Expired certificates. That one is still embarrassing in 2026, and it's why renewal is automated and owned (L02 sets the policy, L03 runs the automation). Intermediate chains that work in Chrome but fail in older Java trust stores. Mutual TLS between edge and origin that breaks quietly when a client certificate rotates.

Tracing. Edge platforms that trace natively record handshake timing. Otherwise, use the browser's connectStart, secureConnectionStart and connectEnd, and add your load balancer's TLS negotiation fields from its access logs.

06Hop 3: the CDN, where most requests should end

What happens. The PoP looks up the cache key. A hit returns straight away. A miss, or a dynamic route such as our POST /pay, goes to origin, ideally over a pooled, already-warm connection.

Where latency hides. Cache keys that include a query parameter or cookie you didn't mean to vary on, which quietly turns your hit ratio into a miss ratio. Tiered caching that adds an extra PoP-to-PoP hop on misses. Edge compute (Workers, Lambda@Edge, Compute) that calls back to origin, which turns one origin round trip into two.

Where failures hide. Origin timeouts surface as CDN-branded errors, not yours. On Cloudflare, the origin gets 125 seconds to respond before a 524. Only Enterprise plans can raise that. A request that takes 130 seconds succeeds at your origin and fails for the user, and your app logs show a 200.

Tracing. This is the hop that was historically a black box, and it's changing. Cloudflare announced Cloudflare Traces in open beta on 2 October 2026. It emits spans for security rules, transforms, cache decisions, routing, Workers and origin handling. It can accept an incoming traceparent and forward a new one to your origin, and it exports over OTLP. Cloudflare has published pricing that starts on 1 December 2026: paid plans include 50 GB of ingestion and 10 GB-month of storage per billing cycle, then $0.25 per GB ingested and $0.10 per GB-month stored. The free plan gets 0.5 GB a day. Other CDNs differ. Check whether yours (a) emits spans at all, (b) forwards traceparent unchanged, rewrites it, or strips it, and (c) lets you choose. If it can't emit spans, the minimum is to log the trace ID in edge logs so you can join them later.

07Hop 4: the WAF, which makes real decisions in the request path

What happens. Managed rules, custom rules, bot scoring and rate limits run on every request before it reaches you. Each is a small program executed in your critical path.

Where latency and failures hide. Two Cloudflare postmortems are worth reading in full for this hop. On 2 July 2019, a WAF managed rule with a catastrophically backtracking regular expression exhausted CPU across the network, causing 502s for about 27 minutes. On 18 November 2025, a database permissions change doubled the size of the Bot Management feature file. That pushed it past a hard limit of 200 features in the core proxy, which then panicked. Proxies on the older path didn't fail. They returned bot scores of zero, so customers with bot-score rules blocked real users. The lesson for your own WAF rules is the same at smaller scale. Rule changes are code deploys. They need progressive delivery with a kill switch, and a span or log line that records which rule acted, so "the user got a 403" can be traced to a specific rule ID.

Tracing. A WAF block ends the trace at the edge. If you don't record edge spans, a blocked request simply doesn't exist from your origin's point of view. That's why support tickets saying "checkout is broken" sometimes have no matching trace. Record rule ID, action and score as span attributes, or at least log them alongside the trace ID.

08Hop 5: the load balancer, home of the mystery 502

What happens. The load balancer terminates or passes through TLS, picks a healthy target, and possibly retries.

Where latency hides. Queueing at the target when the balancing algorithm ignores load. Cross-zone hops. Retries the LB makes on your behalf, which double the latency of an already slow request and hide it inside one span.

Where failures hide. The classic is a keep-alive mismatch. AWS documents that an ALB's idle timeout defaults to 60 seconds, and recommends that your application's idle timeout be longer. Otherwise the app can close a connection just as the LB sends a request down it, and the client gets a 502. Node.js's server.keepAliveTimeout defaults to 5 seconds, including in v26.10.0, the latest release at the time of writing. A semver-major change merged to Node's main branch raises it to 65 seconds, but it isn't in a release yet, so check the line you actually run. An unmodified Express app behind a default ALB is exactly this failure. It's intermittent, low-rate and maddening.

js
// Behind an ALB with a 60s idle timeout: keep app-side keep-alive longer.
server.keepAliveTimeout = 65_000;
server.headersTimeout   = 66_000; // must exceed keepAliveTimeout

Tracing. Many managed load balancers don't speak W3C Trace Context natively. The AWS ALB adds or updates its own X-Amzn-Trace-Id (Root=1-<8 hex epoch>-<24 hex>) and passes other headers through untouched, so traceparent survives but the LB creates no span. Two consequences. First, LB time shows up as the gap between the edge's "origin request" span and your app's server span. Learn to read gaps. Second, if you have both header formats, configure your SDK to read both (OTEL_PROPAGATORS=tracecontext,baggage,xray) so the trace joins whichever one arrives. Also note the ALB's own limit: if request headers exceed 7 KB, it rewrites X-Amzn-Trace-Id with a fresh Root.

09Hop 6: the application, where you have full control

What happens. Your handler authenticates, validates, reads and writes state, and calls other services.

This is the hop most teams instrument first, and auto-instrumentation gets you most of the way. Here's a current Node.js set-up per the OpenTelemetry docs, exporting OTLP to a local Collector rather than the console:

js
// instrumentation.mjs — load with: node --import ./instrumentation.mjs server.js
import { NodeSDK } from '@opentelemetry/sdk-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';

const sdk = new NodeSDK({
  traceExporter: new OTLPTraceExporter(), // honours OTEL_EXPORTER_OTLP_ENDPOINT
  instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();
bash
export OTEL_SERVICE_NAME=checkout-api
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318
export OTEL_PROPAGATORS=tracecontext,baggage
export OTEL_TRACES_SAMPLER=parentbased_always_on   # let the Collector decide (see tail sampling below)

Where latency hides inside the app. Time between spans: GC pauses, event-loop blocking, CPU throttling from a container limit set too low. Serial calls that could run in parallel. That one is obvious in a waterfall and invisible in metrics. Connection pool waits (see hop 8).

Fan-out amplifies the tail. If the handler calls n backends in parallel and each is slow 1% of the time on its own, the chance that at least one is slow is 1 − 0.99ⁿ. For n = 20 that's 1 − 0.818 = 18%. For n = 100 it's 63%. That's the arithmetic behind Dean and Barroso's The Tail at Scale. Traces are how you find which of the twenty is the 1%.

Model calls in the path. If the handler calls an LLM, for fraud scoring or address normalisation, that call is often the largest span by an order of magnitude and the least predictable. Give it its own span, following the OpenTelemetry GenAI conventions for tracing LLM calls, a hard timeout and a fallback. This is where L06 work lands in L03's latency budget.

10Hop 7: the cache, where a miss can hurt more than having no cache

What happens. A read-through lookup in Redis or Memcached before the database.

Where latency and failures hide. Hot keys that pin one shard. Large values that make a "fast" GET slow. The stampede: a popular key expires, a thousand requests miss at once, and all of them hit the database together. In a trace, a stampede looks like many concurrent identical DB spans under different traces that all start within milliseconds of each other. Use request coalescing, or refresh the value early, before it expires.

Tracing. Auto-instrumentation for Redis clients creates client spans. Add a cache.hit boolean attribute yourself. It's the most useful attribute you can put on this hop, because it lets you split latency by hit and miss in one query.

11Hop 8: the database, where p99 usually lives

What happens. The app checks out a connection from a pool, sends a query, the database plans and executes it, and returns rows.

Where latency hides. Mostly before the query. If the pool is exhausted, the request waits for a connection, and many instrumentations start the DB span only once the query is sent. The wait shows up as an unexplained gap. OpenTelemetry defines a db.client.connection.wait_time histogram for exactly this. It's still in Development status, so check whether your driver emits it. Then lock contention (a schema change stuck in the Postgres lock queue is a classic), plan regressions after a statistics change, and N+1 query patterns. That last one looks like a comb of forty identical short spans.

Tracing into the database itself. The client span tells you how long the app waited. It doesn't tell the DBA which application request a slow query belonged to. SQL commenter closes that gap by appending context as a SQL comment, and the OpenTelemetry database span conventions, which are stable, describe it:

sql
SELECT id, status FROM orders WHERE id = $1
/*traceparent='00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'*/

Now pg_stat_activity, slow-query logs and auto_explain output carry a trace ID you can paste into your tracing UI. The conventions say it should not be on by default, and they flag performance effects on some engines. They name MySQL prepared statements, and Oracle and SQL Server for both prepared and non-prepared statements, because a unique comment on every query can defeat statement or plan caching. Postgres isn't on that list, but turn it on deliberately and measure on whichever engine you run.

12Hop 9: the queue, where traces usually break

What happens. The handler writes the order, publishes payments.capture, and returns 202. A worker picks the message up seconds or minutes later and calls the payment provider.

Where failures hide. Everywhere async systems hide them: poison messages, redelivery storms, a consumer lagging behind and nobody noticing because the HTTP request "succeeded". Redelivery is also why the worker's call to the payment provider needs an idempotency key, so a retried capture can't charge twice.

Trace context across a queue. HTTP instrumentation won't carry context through Kafka, SQS or RabbitMQ unless the client library is instrumented too, and many in-house wrappers aren't. Put the context in message headers yourself:

js
import { context, propagation, trace, SpanKind, ROOT_CONTEXT } from '@opentelemetry/api';
const tracer = trace.getTracer('checkout');

// Producer: inject the current context into message headers
export async function publishCapture(producer, order) {
  return tracer.startActiveSpan('payments.capture publish', { kind: SpanKind.PRODUCER }, async (span) => {
    const headers = {};
    propagation.inject(context.active(), headers);          // writes traceparent (+ tracestate, baggage)
    await producer.send({ topic: 'payments.capture',
      messages: [{ key: order.id, value: JSON.stringify(order), headers }] });
    span.end();
  });
}

// Consumer: extract and LINK (don't parent) for async work
export async function onMessage({ message }) {
  const carrier = Object.fromEntries(
    Object.entries(message.headers ?? {}).map(([k, v]) => [k, v?.toString()]) // Kafka headers are Buffers
  );
  const producerCtx = trace.getSpanContext(propagation.extract(ROOT_CONTEXT, carrier));
  const links = producerCtx ? [{ context: producerCtx }] : [];
  await tracer.startActiveSpan('payments.capture process', { kind: SpanKind.CONSUMER, links }, async (span) => {
    try { await capturePayment(JSON.parse(message.value.toString())); }
    finally { span.end(); }
  });
}

Parent or link? The OpenTelemetry messaging conventions, still in Development status, make links the default, because they're the only structure that works across every messaging model. A single-message consumer may use the producer context as its parent. Our rule: parent if the work is logically part of the user's request and finishes within seconds. Link if it's batched, delayed, retried or fanned out. Otherwise a 400 ms checkout trace grows a 40-minute tail every time a retry fires, and your latency views become useless.

13Sampling: deciding what to keep

Worked cost model (illustrative assumptions). 2,000 requests/s, 25 spans per request, 600 bytes per span on the wire.

  • Unsampled: 2,000 × 25 × 86,400 × 600 B ≈ 2.6 TB/day.
  • 1% head sampling: ≈ 26 GB/day. Cheap, but you keep a random 1% of errors too, so the one failed payment you need is probably gone.
  • Tail sampling that keeps all errors (assume 0.5% of traffic), everything above a latency threshold (assume 1%) and a 1% baseline: at most ≈ 2.5% of traces, ≈ 65 GB/day, and every interesting trace kept.

Head sampling decides at the root, before anything interesting has happened. Tail sampling decides after the trace is complete. You want tail sampling as soon as error and slow traces matter more than volume, which is almost always. (For the wider bill, including cardinality budgets, see how to cut a Datadog bill with OpenTelemetry.) The OpenTelemetry Collector's tail_sampling processor (beta for traces) does this. It has one hard requirement: every span of a trace must reach the same Collector instance. Run two tiers. The first tier routes by trace ID with the load_balancing exporter, renamed from loadbalancing, which remains as a deprecated alias. The second tier samples.

yaml
# Tier 1: agents / gateways — route by trace ID
receivers:
  otlp:
    protocols: { grpc: {}, http: {} }
exporters:
  load_balancing:
    routing_key: traceID
    protocol:
      otlp:
        timeout: 1s
        tls: { insecure: true }   # in-cluster; use mTLS across networks
    resolver:
      dns:
        hostname: otel-sampler-headless.observability.svc.cluster.local
        port: "4317"
service:
  pipelines:
    traces: { receivers: [otlp], exporters: [load_balancing] }
yaml
# Tier 2: samplers — decide once the trace is complete
receivers:
  otlp:
    protocols: { grpc: {} }
processors:
  tail_sampling:
    decision_wait: 15s          # longer than your slowest synchronous request
    num_traces: 200000          # traces held in memory awaiting a decision
    policies:
      - name: errors
        type: status_code
        status_code: { status_codes: [ERROR] }
      - name: slow
        type: latency
        latency: { threshold_ms: 1500 }
      - name: baseline
        type: probabilistic
        probabilistic: { sampling_percentage: 1 }
  batch: {}
exporters:
  otlp:
    endpoint: tracing-backend.example.internal:4317
service:
  pipelines:
    traces: { receivers: [otlp], processors: [tail_sampling, batch], exporters: [otlp] }

Both configs pass otelcol-contrib validate on Collector contrib v0.162.0, the latest release at the time of writing. Note that the resolver's port is a string. Pin your version, because contrib component configs do change.

Two cautions. decision_wait must cover your slowest synchronous trace, or late spans arrive after the decision and get dropped. This is one more reason to link async consumers rather than parent them. And size num_traces for peak traffic × decision_wait, then add headroom. Running out of memory silently degrades the sampling decisions.

14Trust at the edge: don't let the internet pick your trace IDs

An under-discussed point: traceparent arriving from the public internet is user input. A client can set the sampled flag on every request and inflate your tracing bill. It can reuse a trace ID to pollute someone else's trace, or send malformed values to probe your parsers. Our default:

  • At the public edge, start a new trace. Keep the client's context only if you want the link, and only from first-party clients you trust (your own RUM script, your mobile app).
  • On internal hops, propagate.

With the NGINX ngx_otel_module, that's one directive per tier:

nginx
# Public-facing proxy: ignore client-supplied context, start a fresh trace
location / {
    otel_trace         on;
    otel_trace_context inject;      # overwrites any incoming traceparent
    proxy_pass         http://checkout_upstream;
}

# Internal proxy between services: continue the trace
location /internal/ {
    otel_trace         on;
    otel_trace_context propagate;   # extract + inject
    proxy_pass         http://internal_upstream;
}

Cloudflare Traces exposes the same choice as an "incoming propagation policy". Whatever your edge is, make the choice explicitly rather than inheriting a default.

15The request-path trace audit: a hop-by-hop reference

This is the asset we use when we take over an estate and someone says "we have tracing". Walk it top to bottom. Each row is pass/fail, and each fail is a place where traces go dark.

# Hop Pass condition How to check Typical silent failure Owner
1 Browser API calls carry traceparent from RUM; navigation timings recorded DevTools → request headers; RUM dashboard shows DNS/connect/TLS CORS preflight blocks the header on cross-origin APIs (allow traceparent, tracestate in Access-Control-Allow-Headers) L07 / L05
2 DNS Resolution time and failure rate measured from outside Synthetic checks from ≥3 networks; RUM domainLookup* TTLs of 30 s on records that never change L03 / L01
3 TLS Handshake time visible; renewal automated with alerting ≥14 days out LB/edge logs; cert monitor 0-RTT accepted on non-idempotent routes L02 / L03
4 CDN Edge spans or edge logs carry the trace ID; hit/miss recorded Search backend for a known trace ID from an edge log line CDN strips or regenerates traceparent and nobody noticed L03
5 WAF Blocks recorded with rule ID, action, trace ID Trigger a test rule; find the event by trace ID 403s with no origin trace and no edge record L02
6 Load balancer Gap between edge and app spans understood; vendor header bridged OTEL_PROPAGATORS includes vendor format if present Keep-alive mismatch producing low-rate 502s L03
7 App Server span per request; outbound HTTP/gRPC spans; service.name set One trace shows inbound and every outbound call Custom HTTP client wrapper that drops headers L05
8 Cache Client spans with cache.hit attribute Query latency grouped by cache.hit Stampede invisible because cache spans aren't recorded L05
9 Database Client spans, pool wait measured, SQL commenter where cheap Slow-query log line contains a trace ID Pool wait hidden in a gap before the DB span L04
10 Queue Producer and consumer spans joined by link or parent Open a worker span; follow link to the request Context lost in an in-house queue wrapper L05 / L04
11 Third parties Outbound spans with timeouts; no baggage leaked Inspect outbound headers to the payment provider Baggage carrying tenant or user IDs to an external API L02 / L05
12 Sampling Errors and slow traces kept regardless of rate Force an error with a test header; confirm it's retained Head sampling at 1% drops the failure you need L08 / L03
13 Correlation Logs carry trace_id and span_id Click from a trace to its logs and back Logs and traces in different tools with no shared key L03

A ten-minute propagation smoke test. Generate an ID, send it, then look for it everywhere:

bash
TRACE_ID=$(openssl rand -hex 16)
SPAN_ID=$(openssl rand -hex 8)
curl -s -o /dev/null -w '%{http_code} %{time_total}s\n' \
  -H "traceparent: 00-${TRACE_ID}-${SPAN_ID}-01" \
  https://staging.example.com/api/checkout/ping
echo "Now search for trace ${TRACE_ID} in: edge logs, LB access logs, tracing backend, app logs, DB slow log, worker logs"

Run it against a staging environment that trusts the header. Production's public edge, configured as above, should not honour it, and checking that it doesn't is part of the test. Every place the ID fails to appear is a row in the table that failed.

16How this crosses the other layers

A trace is the one artefact where all eight layers show up on the same screen, and we find that's its most underrated property. The 403 is a Security decision (L02) inside Cloud's edge (L03). The pool wait is a Data problem (L04) caused by a Software setting (L05). The model call that blew the budget is AI & Automation (L06). What the user felt is Design's measurement (L07), and for AI features that means designing for time-to-first-token and streaming, and the sampling budget is a Strategy decision about what's worth knowing (L08). When those layers belong to different vendors, every gap in the waterfall is a gap in accountability as well. If you own the whole path, the trace becomes the shared language for it.

17When you probably don't need distributed tracing yet

If you run a monolith with one database and no queue, a well-structured request log with a request ID, timings for DB calls, and a Server-Timing header gets you most of the value at a fraction of the cost. Server-Timing is still a W3C Working Draft, but MDN lists it as Baseline widely available across major browsers since March 2023. It shows server-side phase timings in the browser's DevTools:

Text
Server-Timing: db;dur=53, cache;desc="miss";dur=2.1, app;dur=47.2

Browsers expose it only to same-origin scripts unless you send Timing-Allow-Origin. Leave that off in production if the timings reveal more about your infrastructure than you'd like. Adopt full tracing when you have a second service, a queue, or a latency problem that metrics can locate but not explain. Even then, use OpenTelemetry and a vendor-neutral Collector, so the backend stays a choice you can revisit.

18FAQ

What's the difference between a trace ID and a request ID? A request ID is usually created and logged by one service. A trace ID follows the W3C format, is created once, and is shared by every service the request touches, with a separate span ID per hop. If you already have a request ID, log both during migration, then retire the request ID or derive it from the trace ID.

Does adding tracing slow down requests? Creating spans in-process costs microseconds. Export is asynchronous and batched. The real costs are elsewhere: storage, egress, and on some databases, unique SQL comments defeating plan or statement caches. Measure overhead on your own hot path before and after, rather than trusting anyone's general figure, ours included.

Should I use head-based or tail-based sampling? Start with parent-based head sampling at a modest rate if you have no Collector tier yet. Move to tail sampling once you care about keeping every error and slow request, which for a checkout path is immediately. Tail sampling needs the two-tier Collector set-up above. Budget for the memory it holds while waiting.

How do I trace through a managed service that doesn't support traceparent? Bridge the vendor's format (xray, b3 and others are standard propagator options in OpenTelemetry SDKs). Read the gap between spans either side as that service's time, and log the trace ID at both ends. For queues, carry the context in message headers or attributes yourself.

Is it safe to forward traceparent to third-party APIs? traceparent itself is random IDs and a flag. It's generally harmless, and some providers use it to help debug your calls. Baggage is the risk, because it carries whatever your services put in it. Strip baggage at your egress proxy for external destinations unless there's a specific agreement.

Can the CDN be part of the same trace as my backend? Increasingly, yes. Cloudflare's tracing, in open beta since October 2026, accepts and forwards traceparent and exports spans over OTLP. Check your CDN's current documentation for whether it emits spans, forwards the header, or both. If it does neither, log the trace ID at the edge so you can at least join records by hand.

If this is the layer that hurts, we should talk.

Tell us which layer hurts →