Lesson 2 of 3 Monitoring Serverless and AI Workloads

Tracing Requests with X-Ray, Application Signals and Synthetics

This lesson explains how AWS X-Ray and CloudWatch Application Signals follow requests across services to find the failing or slow component, and how Synthetics canaries test endpoints continuously.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe traces, segments and the trace map.
  • Describe what Application Signals provides.
  • Monitor endpoints with Synthetics canaries.

AWS X-Ray

AWS X-Ray collects traces, each made of segments for every service a request passes through and subsegments for downstream calls such as DynamoDB or HTTP requests. A trace map (service map) shows services as nodes with latency and error rates, so a red DynamoDB node immediately points to the dependency causing errors. Annotations are indexed key-value pairs that can be used to filter traces; metadata is not indexed. Sampling rules control how many requests are traced, which keeps cost predictable.

Enabling X-Ray depends on the service. Lambda and API Gateway have an active tracing setting; the Lambda execution role needs xray:PutTraceSegments and xray:PutTelemetryRecords (AWSXRayDaemonWriteAccess). Applications on EC2, ECS and EKS are instrumented with the AWS Distro for OpenTelemetry (ADOT) or X-Ray SDKs and send data through the CloudWatch agent or the X-Ray daemon on UDP port 2000. The X-Ray SDKs and daemon have been in maintenance mode since 25 February 2026, with end of support on 25 February 2027, so AWS recommends OpenTelemetry-based instrumentation for new applications; X-Ray itself continues to receive and display traces.

CloudWatch Application Signals

CloudWatch Application Signals automatically instruments applications on EKS, ECS, EC2 and Lambda with OpenTelemetry and builds a view of each service's golden signals: request volume, availability (fault rate), latency and errors, broken down by operation and dependency. It discovers services and their dependencies without manual dashboards and lets you define service level objectives (SLOs), such as 99.9% of requests under 300 ms over 28 days, with error budgets and burn-rate alarms. Traces are correlated with logs and with CloudWatch Synthetics canaries and real user monitoring.

The following table compares the main tracing and application monitoring features.

FeatureWhat it givesTypical exam trigger
X-Ray traces and trace mapPer-request path through services with timing"identify which downstream service causes latency"
Application SignalsAutomatic service golden signals, dependencies and SLOs"monitor SLOs for microservices with least effort"
CloudWatch SyntheticsScripted canaries that test endpoints and user flows on a schedule"detect problems before customers report them"
CloudWatch RUMReal user page load and error data from browsers"measure the experience of real web users"

CloudWatch Synthetics canaries

A canary is a Node.js or Python script, run on a schedule by Lambda, that checks an endpoint, API or multi-step user journey (for example sign in, add to basket, check out) using a headless browser. Canaries publish success percentage and duration metrics, store screenshots and HAR files in S3, and can run inside a VPC to test internal endpoints. Blueprints cover heartbeat monitoring, API testing, broken link checking and visual monitoring. An alarm on SuccessPercent detects an outage even when no real users are active, for example at night.

The following diagram shows a canary walking through a checkout journey.

A CloudWatch Synthetics canary. On a schedule, Lambda runs a Node.js or Python script that walks through a user journey in a headless browser. The canary publishes SuccessPercent and duration metrics and stores screenshots and HAR files in S3, so an alarm on SuccessPercent detects an outage even when no real users are active.
The schedule and steps are illustrative.
Sort into groups

Which tool?

Exam skills 1.1.1 · 1.2.1

Choose the observability feature for each need.

Log in to try this activity Interactive activities are free with an account.
Worked example

Locating a slow dependency

An order API built from API Gateway, Lambda and DynamoDB has a p99 latency of 3 seconds. The operator enables active tracing on the API stage and the function. The trace map shows the function's own processing takes 40 ms but a subsegment calling an external payment API takes 2.8 seconds for 1% of requests. Adding an annotation paymentProvider to the subsegment lets the operator filter traces by provider and prove that one provider is responsible. An Application Signals SLO on the payment operation, with a burn-rate alarm, now alerts the team before the error budget is spent.

Check yourself

Which X-Ray data can be used to filter traces: annotations or metadata?

Show answer

Annotations, which are indexed. Metadata is stored with the trace but not indexed.

Exam Tips

Remember for the exam

  • X-Ray trace maps show which service or dependency adds latency or errors.
  • Lambda needs active tracing and xray:PutTraceSegments permission.
  • Annotations are indexed for filtering; metadata is not.
  • Application Signals gives automatic golden signals and SLOs.
  • Synthetics canaries test endpoints on a schedule, even with no real traffic.