Flask
Send traces to Last9 from a Flask app using OpenTelemetry
Flask is a lightweight WSGI web application framework. This comprehensive guide will help you instrument your Flask application with OpenTelemetry and smoothly send the traces to a Last9 cluster. You can also check out the example application on GitHub↗.
Pre-requisites
- You have a Flask application
- You have signed up for Last9, created a cluster, and obtained the following OTLP credentials from the Integrations page:
endpoint
auth_header
Install OpenTelemetry packages
To install the required packages, run the following command:
After, installing the required packages, run the following command to install the required instrumentation packages:
Set the environment variables
Now, that you’ve installed all the packages. Run the following command to initialize environment variables:
Note: Replace
<BASIC_AUTH_HEADER>
with the URL encoded value of the basic auth header.
Run the application
After setting the environment variables, run the Flask application:
Visualize data
After running the Flask app, you can visualize the traces in the Last9’s APM dashboard.
Troubleshooting
Please get in touch with us on Discord or Email if you have any questions.