OpenTelemetry AutoInstrumentation
Use OpenTelemetry AutoInstrumentation when you want to collect application traces from Kubernetes workloads without changing application code. The Coralogix OpenTelemetry Integration Helm chart can deploy a webhook that injects OpenTelemetry AutoInstrumentation into annotated pods and sends traces to the node-local opentelemetry-agent DaemonSet.
This mode does not require Instrumentation Custom Resource Definitions (CRDs). The instrumentation settings are configured once in Helm values and reused for all annotated workloads in the release.
Prerequisites
- Install Kubernetes Observability using OpenTelemetry with the OpenTelemetry Integration Helm chart v0.0.320 or later
- Linux worker nodes for the webhook and supported auto-instrumentation images
Supported languages are Java, Python, and .NET.
Warning
Do not enable opentelemetry-autoinstrumentation in a cluster that already has an OpenTelemetry Operator admission webhook installed, unless webhook names and selectors are configured to avoid collisions.
Enable OpenTelemetry AutoInstrumentation
Add the following values to your Helm values file:
Install or upgrade the chart:
helm upgrade --install otel-coralogix-integration \
coralogix-charts-virtual/otel-integration \
-f values.yaml \
--set global.clusterName=<cluster_name> \
--set global.domain=<domain>
Annotate workloads
Add one of these annotations to the pod template of the workload you want to instrument:
instrumentation.opentelemetry.io/inject-java: "true"
instrumentation.opentelemetry.io/inject-python: "true"
instrumentation.opentelemetry.io/inject-dotnet: "true"
Example deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: checkout
spec:
replicas: 1
selector:
matchLabels:
app: checkout
template:
metadata:
labels:
app: checkout
annotations:
instrumentation.opentelemetry.io/inject-java: "true"
spec:
containers:
- name: checkout
image: "<your_app_image>"
Restart existing pods after adding the annotation. The webhook only mutates pods during creation.
Default trace export path
Injected workloads export traces to the OpenTelemetry Agent running on the same Kubernetes node:
- Java and .NET: OTLP/gRPC to
http://$(OTEL_NODE_IP):4317 - Python: OTLP HTTP/protobuf to
http://$(OTEL_NODE_IP):4318
The chart sets OTEL_NODE_IP from the pod status.hostIP field, so each instrumented workload sends telemetry to its local node agent.
Configure instrumentation settings
The chart uses a static instrumentation configuration under:
Use this section to override exporter settings, propagators, sampler settings, resource attributes, or language-specific environment variables.
Example:
opentelemetry-autoinstrumentation:
enabled: true
manager:
config:
instrumentations:
spec:
propagators:
- tracecontext
- baggage
sampler:
type: parentbased_traceidratio
argument: "1.0"
env:
- name: OTEL_RESOURCE_ATTRIBUTES
value: deployment.environment=production
java:
env:
- name: OTEL_SERVICE_NAME
value: checkout
python:
env:
- name: OTEL_SERVICE_NAME
value: checkout
dotnet:
env:
- name: OTEL_SERVICE_NAME
value: checkout
Limitations
- One static instrumentation configuration is used per Helm release.
- .NET auto-instrumentation requires x64 Linux runtime support.
- The webhook creates cluster-scoped RBAC and admission webhook resources.
- This chart option does not install OpenTelemetry Operator CRDs and does not support per-namespace
InstrumentationCRs.
Validate the setup
Check that the webhook manager is running:
Check that an annotated pod has an injected init container:
Expected init container names include:
opentelemetry-auto-instrumentation-javaopentelemetry-auto-instrumentation-pythonopentelemetry-auto-instrumentation-dotnet
Then generate traffic to the application and verify traces in Coralogix APM.