Star us on GitHub
Star
Menu

Python Libraries Tracing

Learn how to set up highlight.io tracing for common Python Libraries.
1
Supported Python libraries

highlight.io supports tracing for the following Python libraries:

Boto

Boto3 (sqs only)

Celery

Redis

Requests

SQLAlchemy

# install your library pip install highlight-io[Boto] pip install highlight-io[Boto3SQS] pip install highlight-io[Celery] pip install highlight-io[Redis] # requests is installed by default pip install highlight-io[SQLAlchemy]
Copy
2
Install the highlight-io python package.

Download the package from pypi and save it to your requirements. If you use a zip or s3 file upload to publish your function, you will want to make sure highlight-io is part of the build.

poetry add highlight-io[{YOUR LIBRARY}]
Copy
# or with pip pip install highlight-io[{YOUR LIBRARY}]
Copy
3
Initialize the Highlight SDK for your respective framework.

Setup the SDK.

import highlight_io # `instrument_logging=True` sets up logging instrumentation. # if you do not want to send logs or are using `loguru`, pass `instrument_logging=False` H = highlight_io.H( "<YOUR_PROJECT_ID>", instrument_logging=True, service_name="my-app", service_version="git-sha", environment="production", )
Copy
4
Setup a test.

Setup a endpoint or function with HTTP trigger that utilizes the library you are trying to test. For example, if you are testing the requests library, you can setup a function that makes a request to a public API.

import requests # from a flask app @app.route("/external") def external(): r = requests.get(url="http://app.highlight.io/health_check") logging.info(f"received {r.status_code} response") return "<h1>External Request</h1>"
Copy
5
Verify your backend traces are being recorded.

Visit the highlight traces portal and check that backend traces are coming in.