2.1.0 Instrument X-Ray
0. Learning Materials
Video: Week 2 Instrument XRay
Andrew's repo: week-2-xray
My branch repo: 02-01-instrument-xray
Task List
Env variables
backend
HONEYCOMB_API_KEY
OTEL_SERVICE_NAME
OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_EXPORTER_OTLP_HEADERS
AWS_XRAY_URL
AWS_XRAY_DAEMON_ADDRESS
x-ray daemon
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION
1. Workflow
1.1 Install AWS SDK
Install AWS SDK.
Then run:
pip install -r requirements.txt
Create a json file for samling rules.
This is necessary because the X-Ray tracing can become expensive very quickly so we are reducing the amount of tgracing analysis by sampling only a limited amount.
1.2 Add X-ray daemon to DC (Docker Compose)
line 9: run
xray
on port 2000.-b
: Overrides default UDP address (127.0.0.1:2000).
1.2.1 Add backend variables in DC
Every time we add a container definition to the docker-compose
file or we use env variables in the code base, it is important to add the env variables in the docker-compose
file.
We can commit the implementation at this point.
1.2 Troubleshooting
2. Discussion
2.1 AWS X-Ray
In our Bootcamp context, this X-ray is another container running alongside our application (the other containers -
backend-flask
,frontend-react-js
,dynamodb-local
, anddb
).X-Ray collects the data from our local machine, and send them in batches to AWS using the AWS APIs.
2.2 Middleware
Middleware is a type of computer software programme that provides services to software applications beyond those available from the operating system. It can be described as "software glue" (Wikipedia).
Last updated