Auto-instrumentation is ideal when you need quick visibility into running workloads or when you want consistent observability settings across many deployments and namespaces.

- Fast path to visibility when you lack instrumentation in running workloads.
- Centralized configuration reduces duplication and human error.
- Operator ensures consistent agent injection and environment configuration across pods.
- Injects language-specific instrumentation libraries or agents into targeted pods.
- Sets environment variables and runtime flags required by those agents.
- Routes telemetry to a configured OpenTelemetry Collector or exporter endpoint.


spec.exporter.endpoint→OTEL_EXPORTER_OTLP_ENDPOINT(or agent-specific equivalent).spec.propagators→OTEL_PROPAGATORSwith comma-separated values.spec.sampler→OTEL_TRACES_SAMPLERandOTEL_TRACES_SAMPLER_ARG(or similar).
| Sampler type | Behavior |
|---|---|
always_on | Sample all traces |
always_off | Sample no traces |
traceidratio | Sample approximately the fraction set by argument (e.g., "0.2" = 20%) |
parentbased_traceidratio | Parent-based sampling; when no parent exists, argument controls the fraction |
| Annotation value | Meaning |
|---|---|
"true" | Use the default Instrumentation CR in the same namespace |
"name" | Use an Instrumentation CR in the same namespace by name |
"ns/name" | Use an Instrumentation CR from another namespace (useful for shared config) |
"false" | Explicitly opt out of injection for this workload |

Use namespace-level injection with care. It will affect all pods in the namespace, including system, test, or utility pods that may not need instrumentation.

- The OpenTelemetry Operator centralizes observability settings through the Instrumentation custom resource.
- Instrumentation CRs define exporters, propagators, samplers, and other shared configuration to avoid per-deployment duplication.
- Workloads opt in to auto-instrumentation via pod annotations or namespace annotations; annotations can reference Instrumentation CRs across namespaces.
- Apply namespace-level injection carefully to prevent unintentional agent injection.

- OpenTelemetry: https://opentelemetry.io/
- OpenTelemetry Operator (GitHub): https://github.com/open-telemetry/opentelemetry-operator
- OpenTelemetry Collector: https://opentelemetry.io/docs/collector/