A basic Python Flask application that randomly returns an HTTP error for 25% of queries.
By default, this works in AWS only and is configured to use X-Ray and Prometheus.
Prometheus should scrape the /metrics
endpoint of this application
- Create a virtualenv
- Activate the virtualenv
- Install the requirements:
pip install -r requirements.txt
- Set the
OBSDEMO_OTLP_ENDPOINT
environment variable to point to your OTLP collector - Set the
OBSDEMO_APP_SECRET
environment variable to the value you want to use for your app secret key - Assuming you're running in AWS, set
OTEL_PROPAGATORS=xray
to send traces to XRay - Alternatively, copy
.env.sample
to.env
, update the values, and source it to setup the environment - Run the app
python demo.py
The app is now available at http://localhost:5000/, with metrics at http://localhost:5000/metrics.
Point Prometheus at the /metrics
endpoint, and then launch something like apache bench against the root:
ab -n 5000000 -c 5 http://localhost:5000/
Once the Prometheus data is flowing, you can hook Grafana up and use this dashboard to view the data.
Whilst the traces aren't anything particularly special, they will prove whether your X-Ray setup is working.
Make sure that AWS OpenTelemetry Collector is running somewhere, then update the OBSDEMO_OTEL_ENDPOINT
to point to that location. As long as your IAM policies are correct, your traces should start to show up in X-Ray