From b68e5f05029032bea7b158ffc1883aeb81539139 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 12 Nov 2024 12:08:31 +0100 Subject: [PATCH] Revise k8s operator docs for Python after latest releases (#5583) Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> --- .../en/docs/kubernetes/operator/automatic.md | 31 ++++++++++++------- content/en/docs/zero-code/python/operator.md | 4 +++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/content/en/docs/kubernetes/operator/automatic.md b/content/en/docs/kubernetes/operator/automatic.md index 2435e060b81a..887273ba3e12 100644 --- a/content/en/docs/kubernetes/operator/automatic.md +++ b/content/en/docs/kubernetes/operator/automatic.md @@ -361,17 +361,16 @@ time). This means that the configured endpoint must be able to receive OTLP over will connect to the `http` port of the `otlpreceiver` of the Collector created in the previous step. -> As of operator v0.67.0, the Instrumentation resource automatically sets -> `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` and `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` -> to `http/protobuf` for Python services. If you use an older version of the -> Operator you **MUST** set these env variables to `http/protobuf`, or Python -> auto-instrumentation will not work. +> As of operator v0.108.0, the Instrumentation resource automatically sets +> `OTEL_EXPORTER_OTLP_PROTOCOL` to `http/protobuf` for Python services. If you +> use an older version of the Operator you **MUST** set this env variable to +> `http/protobuf`, or Python auto-instrumentation will not work. #### Auto-instrumenting Python logs By default, Python logs auto-instrumentation is disabled. If you would like to -enable this feature, you must to set the `OTEL_LOGS_EXPORTER` and -`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED` environment variables as +enable this feature, you must to set +`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED` environment variable as follows: ```yaml @@ -389,14 +388,12 @@ spec: - baggage python: env: - - name: OTEL_LOGS_EXPORTER - value: otlp_proto_http - name: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED value: 'true' ``` -> Note that `OTEL_LOGS_EXPORTER` must be explicitly set to `otlp_proto_http`, -> otherwise it defaults to gRPC. +> As of operator v0.111.0 setting `OTEL_LOGS_EXPORTER` to `otlp` is not required +> anymore. #### Excluding auto-instrumentation {#python-excluding-auto-instrumentation} @@ -541,6 +538,18 @@ securityContext: runAsUser: 0 ``` +### Auto-instrumenting a Python musl based container {#annotations-python-musl} + +Since operator v0.113.0 Python auto-instrumentation also honors an annotation +that will permit it to run it on images with a different C library than glibc. + +```sh +# for Linux glibc based images, this is the default value and can be omitted +instrumentation.opentelemetry.io/otel-python-platform: "glibc" +# for Linux musl based images +instrumentation.opentelemetry.io/otel-python-platform: "musl" +``` + ## Troubleshooting If you run into problems trying to auto-instrument your code, here are a few diff --git a/content/en/docs/zero-code/python/operator.md b/content/en/docs/zero-code/python/operator.md index 9f5e6761b6dd..de64a15ff232 100644 --- a/content/en/docs/zero-code/python/operator.md +++ b/content/en/docs/zero-code/python/operator.md @@ -28,6 +28,10 @@ provides images for a single Python version based on the glibc C library. If you want to use it you might need to build your own image operator Docker image for Python auto-instrumentation. +Since operator v0.113.0 it is possible to build an image with both glibc and +musl based auto-instrumentation and +[configure it at runtime](/docs/kubernetes/operator/automatic/#annotations-python-musl). + #### Django applications Applications that run from their own executable like Django requires to set in