Add doc for disabling instrumentation for python (#2196)

Co-authored-by: Phillip Carter <pcarter@fastmail.com>
This commit is contained in:
Tyler Helmuth 2023-01-30 02:04:12 -07:00 committed by GitHub
parent ea1db6ddf7
commit d697d11f3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 0 deletions

View File

@ -81,3 +81,21 @@ desired configuration property:
For example, `exporter_otlp_endpoint` would convert to
`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`.
### Disabling Specific Instrumentations
The Python agent by default will detect a python program's packages and
instrument any packages it can.
This makes instrumentation easy, but can result in too much or unwanted data.
You can omit specific packages from instrumentation by using the
`OTEL_PYTHON_DISABLED_INSTRUMENTATIONS` environment variable. The environment
variable can be set to a comma-separated list of package names to exclude from
instrumentation.
For example, if your Python program uses the `redis` and `kafka-python`
packages, by default the agent will use the
`opentelemetry-instrumentation-redis` and
`opentelemetry-instrumentation-kafka-python` packages to instrument them. To
disable this, you can set
`OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=redis,kafka-python`.

View File

@ -153,6 +153,36 @@ otlpreceiver of the Collector created in the previous step.
> Operator you **MUST** set these env variables to `http/proto`, or python
> auto-instrumentation will not work.
By default the Python auto-instrumentation will detect the packages in your
Python service and instrument anything it can. This makes instrumentation easy,
but can result in too much or unwanted data. If there are any packages you do
not want to instrument, you can set the `OTEL_PYTHON_DISABLED_INSTRUMENTATIONS`
environment variable
```yaml
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: demo-instrumentation
spec:
exporter:
endpoint: http://demo-collector:4318
propagators:
- tracecontext
- baggage
sampler:
type: parentbased_traceidratio
argument: "1"
python:
env:
- name: OTEL_PYTHON_DISABLED_INSTRUMENTATIONS
value:
<comma-separated list of package names to exclude from
instrumentation>
```
[See the Python Agent Configuration docs for more details.](/docs/instrumentation/python/automatic/agent-config/#disabling-specific-instrumentations)
---
Now that your Instrumentation object is created, your cluster has the ability to