DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Data
  4. Taking a Look at Amazon X-Ray

Taking a Look at Amazon X-Ray

As the adoption of microservices grows and as IT as a whole becomes more distributed, the case for distributed stack tracing for app performance monitoring is obvious.

Daniel Berman user avatar by
Daniel Berman
·
Mar. 23, 17 · Opinion
Like (4)
Save
Tweet
Share
7.39K Views

Join the DZone community and get the full member experience.

Join For Free

back at aws re:invent in november, one could not help but feel overwhelmed by the amount — and the potential impact — of the new features and services announced. i covered some of these new features in this blog post , but one announcement i missed out on was amazon x-ray.

x-ray, as its name implies, allows you to get visibility into the performance of your deployed applications by providing traces of requests as they are routed through the different service waypoints. it can thus be used to not only monitor the performance of the requests but also to identify bottlenecks and errors.

x-ray works by adding http headers to each request and passing on those headers to request handlers. at each waypoint, data “segments” are collected and then later aggregated into individual traces.

the service is currently in preview mode and supports only .net, java, and node.js apps running on ec2, ecs, elastic beanstalk, and api gateway, and the x-ray sdk captures metadata for a variety of databases.

let’s take a closer look.

getting started

since x-ray is in preview mode, you have to sign up first .

once you’re given access, head over to the x-ray console , where you will be presented with two ways to get started:

getting started with aws x-ray

you can use your own application, and if that’s the path you’re interested in taking, you’re going to want to check out the documentation on the various available sdks for java, node.js, and .net applications.

however, the easiest and fastest way to get acquainted with x-ray — and also the one used for the purposes of writing this post — is using the supplied node.js demo application .

at the end of the detailed steps, you will have an express (node.js) app deployed on elastic beanstalk that serves a simple signup service that stores data on aws dynamodb and uses aws sns to send notifications.

aws x-ray sample application

next, start generating requests! as specified in the app, hitting the start button will generate up to ten signup requests per minute with a duplicate signup each minute.

after a while, stop the requests and open the service map tab in the console. as you can see, it now starts to get interesting:

map of aws requests

what you see is a nice map of all the requests routed between the different aws service endpoints. in the case of the demo app, we can see requests coming from the client to ec2 and then on to dynamodb and sns.

as you can see, the folks at aws made sure our data contains some warnings. opening the legend on the right gives us insight into the meanings of the different colors:

aws request map

each of the nodes in the map represents a request waypoint, and behind them are tracked traces. clicking any of the nodes will lead you to these traces:

aws x-ray traces

note the filter field at the top of the console. this field allows you to search traces using a simple filtering syntax. you can build your own custom filter or use the provided filters.

for example, say we want to narrow down the list of service requests to only those with errors:

service("xray-demo.htuaqjkx9a.us-east-1.elasticbeanstalk.com") {error = true}

aws service request error log

we can see that post requests originating from the signup page are triggering 409 errors. to troubleshoot the root cause, we’re going to open one of the available traces:

available traces

what we see is a timeline of the request — and we can see that calls to dynamodb are failing, for some reason.

clicking on the dynamodb segment provides us with additional insight. we can see that the request to dynamodb is resulting in a 400 response:

dynamo db traces

taking a look at the dynamodb subsegment traced by x-ray, we can see that a conditionalcheckexceptionfailed exception was triggered by the request:

dynamodb subsegment traced by x-ray

summary

with the growing adoption of microservices and as it as a whole becomes more distributed, the case for distributed stack tracing for application performance monitoring is obvious. the ability to trace requests from clients to the various the services running behind the scenes is crucial to be able to troubleshoot issues and identify bottlenecks in real-time.

aws did not invent the wheel in this case — there are some big players in the space that do an exceptionally good job at apm and stack tracing. being only a preview, x-ray still has some way to go before it can take on these players. the ability to seamlessly access logs for the services represented in the service map is one missing feature, for example, as is support for other languages and frameworks.

Requests microservice application app Data (computing) Console (video game CLI) Node.js Filter (software) Java (programming language) POST (HTTP)

Published at DZone with permission of Daniel Berman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 7 Awesome Libraries for Java Unit and Integration Testing
  • Microservices Discovery With Eureka
  • What Is a Kubernetes CI/CD Pipeline?
  • Deploying Java Serverless Functions as AWS Lambda

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: