This repo contains two simple Python services that have been instrumented with OpenTelemetry-Python that you can configure to export traces to your New Relic account!
The service main.py
simply creates spans, while app.py
does the same but includes Flask and Flask instrumentation.
-
Sign up for a free New Relic account.
-
Copy your New Relic account ingest license key.
-
This assumes you have
pip
andpython3
installed on your machine.
-
Run
pip install -r requirements.txt
. -
Set the following environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317 export OTEL_EXPORTER_OTLP_HEADERS=api-key=<your_license_key_here>
- Replace
<your_license_key_here>
with your New Relic account ingest license key.
- Replace
You have two options
-
To run the application that doesn't have Flask:
python3 main.py
- Run that command as many times as you like to generate trace data.
- This application produces trace data reporting to a service called
python-app
.
-
To run the application that contains Flask:
python3 app.py
- This application exposes a simple endpoint at
http://127.0.0.1:5000/
. You can either open it in a browser and refresh as many times as you like to generate trace data, or you can invoke it by runningcurl http://127.0.0.1:5000/
. - This application produces trace data reporting to a service called
python-flask-app
.
- This application exposes a simple endpoint at
Depending on which app you ran, you should see either python-app
or python-flask-app
under Services - OpenTelemetry
in your New Relic account.