Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 1.95 KB

File metadata and controls

59 lines (37 loc) · 1.95 KB
order -5
label Python

OpenTelemetry for 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.


Instrumentation

!!!info Is your application already instrumented with OpenTelemetry?

!ref icon="../../assets/images/logos/logo_open_telemetry.png" text="Configure endpoint and headers" !!!

Step 1: Install the SDKs

Install the Baselime Python OpenTelemetry SDK.

poetry add baselime-opentelemetry

Step 2: Install Instrumentations

Automatically install instrumentation for the python libraries you use with opentelemetry-bootstrap

poetry run opentelemetry-bootstrap

Step 3: Set the Baselime environment variables

Set 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>'

Step 4: Run the Opentelemetry Instrumentation

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.


Configuration

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