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
pip install -r requirements.txt
OBSDEMO_OTLP_ENDPOINT
environment variable to point to your OTLP collectorOBSDEMO_APP_SECRET
environment variable to the value you want to use for your app secret keyOTEL_PROPAGATORS=xray
to send traces to XRay.env.sample
to .env
, update the values, and source it to setup the environmentpython 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