Set up Python applications
Send Python application logs, traces and metrics with the OpenTelemetry zero-code agent. Start with the application connection details.
Install the agent
Run these commands in your application's Python environment:
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a installConfigure the process
Create the shared environment file and add:
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED="true"Load the file, then build authentication and set the standard SDK header. The endpoint is the base HTTPS URL and the protocol is http/protobuf.
Start the application
opentelemetry-instrument python app.pyReplace app.py with your entry point. opentelemetry-distro supplies the opentelemetry-instrument command. The agent reads the settings from the process environment on Linux or Windows.
Generate a Python log entry and application traffic, then check the result.