| order | -5 |
|---|---|
| label | Python |
The Baselime Python OpenTelemetry SDK enables you to instrument your Python services with OpenTelemetry without the boilerplate of using the OpenTelemetry SDK directly.
This SDK uses OpenTelemetry for Python and provides a layer that facilitates instrumenting your Python applications.
!!!info Is your application already instrumented with OpenTelemetry?
!ref icon="../../assets/images/logos/logo_open_telemetry.png" text="Configure endpoint and headers" !!!
Install the Baselime Python OpenTelemetry SDK.
poetry add baselime-opentelemetryAutomatically install instrumentation for the python libraries you use with opentelemetry-bootstrap
poetry run opentelemetry-bootstrapSet the environment variables of your comntainer service to include the Baselime API Key
export BASELIME_API_KEY=<YOUR_API_KEY>
export OTEL_SERVICE_NAME='<NAME_OF_YOUR_APP_OR_SERVICE>'poetry run opentelemetry-instrument python myapp.py
Once these steps are completed, distributed traces from your Python container applications should be available in Baselime to query via the console or the Baselime CLI.
When running your application locally you can set the environment variable EXPORT_CONSOLE=TRUE to print all the telemetry to the console. This can help make sure you have instrumented your application correctly