Browser
Server
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
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:
# install and use your library in your code pip install Boto Boto3SQS Celery Redis requests SQLAlchemy2
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# or with pip pip install highlight-io3
Initialize the Highlight SDK for your respective framework.
Setup the SDK. Supported libraries will be instrumented automatically.
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", ) 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>" 5
Verify your backend traces are being recorded.
Visit the highlight traces portal and check that backend traces are coming in.