X-Ray Flashcards

1
Q

What service provides you with Automated Trace Analysis & Central Service Map Visualization?

A

X-Ray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is X-Ray?

A

AWS X-Ray helps developers analyze and debug production, distributed applications, such as those built using a microservices architecture. With X-Ray, you can understand how your application and its underlying services are performing to identify and troubleshoot the root cause of performance issues and errors. X-Ray provides an end-to-end view of requests as they travel through your application, and shows a map of your application’s underlying components. You can use X-Ray to analyze both applications in development and in production, from simple three-tier applications to complex microservices applications consisting of thousands of services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What services are compatible with X-Ray?

A
  • AWS Lambda
  • Elastic Beanstalk
  • ECS
  • ELB
  • API Gateway
  • EC2 Instances or any application server (even on premise)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you start using X-Ray in your instances, including on-prem?

A

Installing the daemon in the instance user data. The daemon is the only option for on-prem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What provides X-Ray for requests?

A
  • Tracing is an end to end way to following a “request”

* Each component dealing with the request adds its own “trace”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What options are provided by X-Ray to trace the requests?

A

Ability to trace:
o Every request
o Sample request (as a % for example or a rate per minute)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is X-Ray security?

A

X-Ray Security:
o IAM for authorization
o KMS for encryption at rest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you enable X-Ray?

A
  1. Your code (Java, Python, Go, Node.js, .NET) must import the AWS X-Ray SDK
  2. Install the X-Ray daemon or enable X-Ray AWS Integration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What will your application capture once the AWS X-Ray SDK is imported?

A

 Calls to AWS services
 HTTP / HTTPS requests
 Database Calls (MySQL, PostgreSQL, DynamoDB)
 Queue calls (SQS)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Do you need to perform heavy code modifications to use the AWS X-Ray SDK in your application?

A

Very little code modification needed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does work the X-Ray daemon?

A

X-Ray daemon works as a low level UDP packet interceptor (Linux / Windows / Mac…)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you install the X-Ray daemon in your Lambdas?

A

AWS Lambda / other AWS services already run the X-Ray daemon for you

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What must have each application to write data to X-Ray?

A

Each application must have the IAM rights to write data to X-Ray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What to do if X-Ray is not working on EC2?

A

o Ensure the EC2 IAM Role has the proper permissions

o Ensure the EC2 instance is running the X-Ray Daemon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What to do to enable X-Ray on AWS Lambda:?

A

o Ensure it has an IAM execution role with proper policy (AWSX-RayWriteOnlyAccess)
o Ensure that X-Ray is imported in the code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can you instrument X-Ray in your code?

A

You can modify your application code to customize and annotation the data that the SDK sends to XRay, using interceptors, filters, handlers, middleware… (ADVANCED)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a X-Ray segment?

A

each application / service will send them

18
Q

What is a X-Ray sub-segment?

A

if you need more details in your segment

19
Q

What is a X-Ray trace?

A

segments collected together to form an end-to-end trace

20
Q

What are X-Ray annotations?

A

Key Value pairs used to index traces and use with filters. Used for searching

21
Q

What is X-Ray metadata?

A

Key Value pairs, not indexed, not used for searching

22
Q

What can you do with X-Ray sampling rules?

A

With sampling rules, you control the amount of data that you record, reduce cost

23
Q

What is recorded by the X-Ray SDK by default?

A

By default, the X-Ray SDK records the first request each second, and five percent of any additional requests

24
Q

What are in X-Ray the reservoir and the rate?

A
  • One request per second is the reservoir, which ensures that at least one trace is recorded each second as long the service is serving requests.
  • Five percent is the rate at which additional requests beyond the reservoir size are sampled
25
Q

Can you create your own X-Ray Sampling Rules?

A

You can create your own rules with the reservoir and rate

26
Q

How is X-Ray Sampling Rules precedence determined?

A

Lower priority values have higher precedence

27
Q
Suppose you have these 2 X-Ray Sampling Rules and your app receives 100 requests per second; define the number of requests traced:
Example 1: 
- reservoir - 10
- rate - 0.10
Example 2: 
- reservoir - 1
- rate - 1
A

o 10 + 10% of 90 = 19

o 1 + 100% of 99 = 100

28
Q

Which are the X-Ray APIs used to write?

A
  • PutTraceSegments
  • PutTelemetryRecords
  • GetSamplingRules
  • GetSamplingTargets (Advanced)
  • GetSamplingStatisticSummaries (Advanced)
29
Q

What is used for X-Ray Write API PutTraceSegments?

A

Uploads segment documents to AWS X-Ray. Necessary to write into X-Ray

30
Q

What is used for X-Ray Write API PutTelemetryRecords?

A

Used by the AWS X-Ray daemon to upload telemetry. Helps with the metrics
o SegmentsReceivedCount
o SegmentsRejectedCounts
o BackendConnectionErrors

31
Q

What is used for X-Ray Write API GetSamplingRules?

A

Retrieve all sampling rules (to know what/when to send)

32
Q

What does need the X-Ray daemon to perform X-Ray Write API calls?

A

The X-Ray daemon needs to have an IAM policy authorizing the correct API calls to function correctly

33
Q

Which are the X-Ray APIs used to read?

A
  • GetServiceGraph
  • BatchGetTraces
  • GetTraceSummaries
  • GetTraceGraph
34
Q

What is used for X-Ray Read API GetServiceGraph?

A

main graph

35
Q

What is used for X-Ray Read API BatchGetTraces?

A

Retrieves a list of traces specified by ID. Each trace is a collection of segment documents that originates from a single request

36
Q

What is used for X-Ray Read API GetTraceSummaries?

A

Retrieves IDs and annotations for traces available for a specified time frame using an optional filter. To get the full traces, pass the trace IDs to BatchGetTraces

37
Q

What is used for X-Ray Read API GetTraceGraph?

A

Retrieves a service graph for one or more specific trace IDs

38
Q

How can you run the X-Ray daemon in Beanstalk?

A

You can run the daemon by setting an option in the Elastic Beanstalk console or with a configuration file (in .ebextensions/xray-daemon.config)

39
Q

Besides running the X-Ray daemon in Beanstalk, what else you must ensure?

A

Make sure to give your instance profile the correct IAM permissions so that the X-Ray daemon can function correctly.
Then make sure your application code is instrumented with the X-Ray SDK

40
Q

What Beanstalk platform does not work with X-Ray?

A

Multi container Docker

41
Q

How is X-Ray integrated to ECS?

A

ECS Classic Cluster:
o 1 X-Ray Daemon Container per EC2 instance
o 1 X-Ray Sidecar Container per Container
Fargate Cluster (no instance management)
o 1 X-Ray Sidecar Container per Container in a Fargate Task

42
Q

How does work X-Ray + ECS Sidecar pattern task definition?

A
  1. Map the Container Port of the X-Ray Daemon to 2000 UDP
  2. Set an environment variable called AWS_XRAY_DAEMON_ADDRESS
  3. Link these two containers from a networking perspective