Distributed tracing records the path of a request through a distributed application. A checkout request, for example, might pass through an API gateway, an order service, an inventory service, and a payment provider. Each component can appear healthy in isolation while the complete checkout remains slow or fails. Tracing connects these operations so engineers can investigate the behavior experienced by the caller.
A trace contains spans, which represent individual operations such as handling an HTTP request, executing a database query, or calling another service. A span typically records its name, start time, duration, status, and attributes. A trace identifier associates related spans, while parent-child relationships describe how operations connect. Asynchronous workflows can also use span links to express relationships that do not fit a simple parent-child hierarchy.
Applications must propagate trace context across component boundaries, commonly through HTTP headers or message metadata. Instrumentation extracts incoming context, creates spans, and injects context into outgoing calls. Libraries and frameworks can automate much of this work, while custom instrumentation captures business operations that automatic instrumentation misses. OpenTelemetry provides vendor-neutral instrumentation and telemetry collection components. A tracing backend stores and analyzes the resulting data.
In a cloud application, engineers might instrument containerized services and serverless functions, then send their spans through a collector to a managed tracing backend. A trace could reveal that a two-second checkout spends most of its time waiting for an inventory lookup. Another might show repeated payment retries after an upstream timeout. These findings help engineers narrow an investigation, but a slow span does not by itself prove the underlying root cause.
Tracing complements rather than replaces metrics and logs. Metrics show trends such as rising error rates across thousands of requests. Traces show the execution of particular requests, and correlated logs provide detailed events from those executions. For AWS exam scenarios, AWS X-Ray is associated with tracing requests and analyzing application dependencies. Amazon CloudWatch provides complementary monitoring, logs, and application observability. AWS CloudTrail records account activity and API events; it is not a substitute for application request tracing.
Tracing introduces processing, network, storage, and operational costs. Sampling limits the requests retained, but it can omit rare failures, depending on the sampling policy. Broken context propagation creates incomplete traces, and unsupported libraries or external providers can leave visibility gaps. Trace attributes should exclude credentials, payment details, and unnecessary personal information. Finally, overlapping spans must not simply be added together: concurrent operations overlap in time, and asynchronous work may continue after the original response has returned.