Python
<!-- status: ga language: python -->
Python: zero-code instrumentation
opentelemetry-instrument wraps the interpreter and patches the libraries it finds (Django, Flask, FastAPI, requests, psycopg, ...) without a code change. Nothing Watchtower-specific is installed: it reads the standard OTEL_* variables.
Create a project, then an ingestion key (
wti_...) with theingest:tracesscope. The key is shown once.Point the instrumentation at the gateway and pass the key in the
x-watchtower-keyheader:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.example.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS=x-watchtower-key=wti_YOUR_KEY
export OTEL_SERVICE_NAME=my-serviceInstall the distro and let it find the instrumentations for the libraries you use, then start the service through the wrapper:
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a install
opentelemetry-instrument python app.pySend one request to the service, then open the project's onboarding screen: it turns green when the first span arrives.
Updated