DVA-C02 - Troubleshooting and Optimization - Section 4.3

Instrument application code for observability using distributed tracing, structured logging and X-Ray annotations.

Instrument application code to emit structured logs and propagate distributed tracing context across service boundaries, making individual requests traceable end-to-end. Add X-Ray annotations and metadata to segments so traces can be filtered and grouped in the AWS X-Ray console for targeted analysis.

Distributed tracingStructured loggingX-Ray annotationsObservability

Practice question for this objective

Free sampleTroubleshooting and Optimizationmedium

A team operates several services that each write structured JSON logs to CloudWatch Logs and are traced end to end with AWS X-Ray. During an incident an operator finds a slow trace in the X-Ray console and now wants to jump straight to the exact log lines emitted while handling that one request, across all the services it touched. The developer must make each log line correlate to its trace. Which value should the application include in every structured log entry to enable this correlation?

  • AThe CloudWatch Logs log stream name, so the operator can open the same stream that recorded the trace and scroll to the matching time window.
  • BThe X-Ray trace ID for the current request, so logs from every service handling that request can be filtered to the same trace identifier. Correct
  • CA freshly generated UUID created in each service, so every service stamps its own unique identifier onto the log lines it writes for the request.
  • DThe wall-clock timestamp at millisecond precision, so the operator can align log entries to the trace by matching their recorded times.
Including the shared X-Ray trace ID in every structured log line lets operators correlate logs across services back to a single traced request. An X-Ray trace ID is generated once per request and propagated through every downstream service, so writing it into each structured log entry gives a common key that joins logs across services to the matching trace, enabling a direct pivot from a trace to its log lines.

Why A is wrong: A stream name groups logs by execution environment, not by request, so it cannot tie a specific trace to the precise log lines for that one request.

Why B is correct: The trace ID is unique per request and shared across services, so logging it lets an operator pivot from a trace directly to all matching log lines.

Why C is wrong: Per-service UUIDs differ between services, so they cannot join logs from multiple services to one trace; only a shared identifier works.

Why D is wrong: Timestamps alone are ambiguous under concurrency because many requests overlap in time, so matching by time cannot reliably isolate one request's logs.

See more DVA-C02 practice questions, answers explained.

More in this domain

Back to all Troubleshooting and Optimization objectives, or the DVA-C02 cert hub.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.