open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
697 stars 578 forks source link

Automatic Instrumentation: docs improvements and sanity check #2157

Open gsakkis opened 7 months ago

gsakkis commented 7 months ago

After wasting half a day trying to figure out why even the simplest auto instrumentation examples for several different frameworks don't work (i.e. they don't emit anything to the console or the OTEL collector), I eventually found the reason: the opentelemetry-distro package was not installed. So two issues:

emdneto commented 1 month ago

We can always improve the documentation to make things explicit. However, opentelemetry-bootstrap and open telemetry-instrument exist for different purposes. The first installs default instrumentation packages and detects active Python site packages to determine which the user might want to install. The instrument command will try to automatically detect packages used by your Python program and, when possible, apply automatic tracing instrumentation on them. I don't think we want to mixup those two things in opentelemetry-instrument.

In the docs here we have this note:

You need to install a distro package to get auto instrumentation working. The opentelemetry-distro package contains the default distro and configurator and automatically configures some of the common options for users.