ADR-00003 — Four-Identifier Tracing Contract
- Status: Approved / Implemented
- Date: 2026-09-24
- Authors: Engineering Team
Context
Every request in the platform can cross a browser/mobile client, the Nginx gateway, multiple REST and gRPC hops across Go/Rust/Node microservices, and one or more Pub/Sub hops. SRE, support, and compliance all need to reconstruct “everything that happened for this one operation” without manually correlating disjoint per-service logs by timestamp. A tracing design was needed that works identically across three languages and three transports, without requiring bespoke design work each time a new service or transport is added.
Decision Drivers (FRs & NFRs)
See SR-003 for the full requirement list.
- FR-01 (Exactly Four Identifiers): the contract must be small and fixed, not grown ad hoc per service.
- FR-02 / FR-03 (Correlation Guarantee vs. Single-Hop IDs): exactly one identifier must be guaranteed identical on both sides of any hop; single-hop debugging IDs must stay local, never be mistaken for it.
- FR-06 / FR-07 / FR-09 (Transport-Scoped Propagation): each identifier’s propagation scope must be transport-appropriate — some identifiers make sense past the REST edge, some don’t.
- NFR-01 (Cross-Language Contract Parity): Go, Rust, and Node must implement the identical contract, not three divergent tracing designs.
Options Evaluated
Option 1 — Four purpose-built identifiers, each with a fixed per-transport scope (CHOSEN)
Standardize on traceparent/tracestate (W3C trace context, full distributed trace), correlation_id (app-level, cross-transport, the one guaranteed-consistent identifier), gateway_request_id (Nginx-local, REST-entry-point-only), and request_id (per-hop debugging UUID, Go’s Echo RequestID() / Rust’s request_logger, never propagated). Each identifier’s scope is fixed by transport, documented once, and reused identically by every language’s core lib.
- Pros:
- A support ticket or an alert always resolves to a complete cross-service log set via one identifier (
correlation_id), without needing full OTel trace lookup for routine cases (FR-02). traceparentstill gives full distributed-trace visualization when that level of detail is needed, without overloading it as the “put this in a ticket” identifier — OTel trace IDs are not designed to be human-facing lookup keys.gateway_request_id/request_idstay cheap, purely local debugging aids — no propagation code needed for them past their own hop, keeping the interceptor/middleware surface small (FR-03, FR-07, FR-09).- Identical contract across Go/Rust/Node core libs means a new service in any language needs zero new tracing design — just wire the documented middleware/interceptor/layer at the transport’s bootstrap chokepoint (NFR-01).
- A support ticket or an alert always resolves to a complete cross-service log set via one identifier (
- Cons & Accepted Trade-offs:
- Four identifiers is more surface area than a single ID — mitigated by the fixed “rule of thumb” (
traceparent= whole trace,correlation_id= whole operation’s logs, the other two = single-hop only) and by never letting a transport introduce a fifth. - Requires discipline to keep the propagation-scope table and each core lib’s
CLAUDE.mdin sync when a new transport is added — a real, previously observed risk (see Technical Debt, TD-01).
- Four identifiers is more surface area than a single ID — mitigated by the fixed “rule of thumb” (
Option 2 — Rely solely on OTel trace_id/span_id, no separate correlation_id
Use only the W3C trace context’s own trace_id as the cross-service correlation key, with no app-level correlation_id layered on top.
- Pros:
- One fewer identifier to mint, propagate, and document — every transport already carries
traceparentfor OTel’s own purposes, so no additional header/metadata key/envelope field is needed anywhere. - No risk of
correlation_idandtrace_idever drifting apart or disagreeing, since there is only one cross-service identifier to keep consistent in the first place.
- One fewer identifier to mint, propagate, and document — every transport already carries
- Cons (Why Rejected):
trace_idis a 32-hex-character OTel-internal identifier, awkward for a support agent to ask a customer for or paste into a ticket compared to a shorter, application-mintedcorrelation_id.- Couples the “give me every log line for this operation” use case to whatever the OTel SDK happens to generate, rather than to an identifier the platform controls end-to-end — e.g. minting one at the Nginx edge even before a trace formally starts.
Option 3 — Single universal identifier, merging gateway_request_id and correlation_id
Use one identifier for both the Nginx-local per-hop ID and the cross-service correlation key.
- Pros:
- One fewer identifier to mint and log at the REST edge — a simpler mental model for an engineer debugging a single hop, with nothing to distinguish between “this Nginx hop” and “this whole operation.”
- Fewer header/metadata keys to wire into Nginx and every REST-entry-point service.
- Cons (Why Rejected):
- Conflates a value that must never leave its minting hop (Nginx’s
$request_id) with one that must be identical on both sides of every hop — merging them either leaks a local-only ID cross-service or forcescorrelation_idto be regenerated at the gateway on every hop, defeating its purpose. - A gRPC-only or Pub/Sub-only path (no REST entry point at all) would have no way to mint the merged identifier, since
gateway_request_idis Nginx-only by construction.
- Conflates a value that must never leave its minting hop (Nginx’s
Option 4 — Ad hoc, per-service tracking identifiers, no monorepo-wide contract
Let each service mint and propagate whatever identifiers it individually needs.
- Pros:
- Maximum flexibility for a single service’s own internal debugging needs — a team can shape its identifiers exactly around its own log/query patterns, unconstrained by a shared contract.
- Zero upfront coordination cost — a new service can start logging something useful immediately, without waiting on or reading a documented cross-service standard first.
- Cons (Why Rejected):
- Directly defeats the goal of cross-service correlation — two services inventing differently-named or differently-scoped identifiers means no single value reliably ties a multi-service operation together.
- Every new service would re-derive its own tracing design from scratch, including language-specific mistakes (e.g. accidentally propagating a local-only ID over gRPC) that a shared, documented contract structurally prevents.
Final Decision
Option 1 is selected. It is the only candidate that gives support/on-call a single reliable cross-service correlation key (correlation_id) distinct from OTel’s own trace identifiers, keeps single-hop debugging aids cheap and structurally incapable of leaking cross-service, and is implemented identically across Go, Rust, and Node today.