Allow to enable OpenTelemetry tracing on individual ingress resources

Author: sergk-mambuCreated Feb 2, 2024Updated Feb 2, 2026
Labelskind/featureneeds-triageneeds-priority

Currently if OpenTelemetry is disabled globally via the ConfigMap option enable-opentelemetry: "false" and enabled only in one ingress resource via the annotation nginx.ingress.kubernetes.io/enable-opentelemetry: "true" then OpenTelemetry tracing becomes implicitly enabled for all other ingress resources. It happens because in otel_ngx module tracing is enabled by default. So as soon as the module is loaded then tracing is enabled for all ingress instances (all servers in nginx config). The only way to make it enabled on one ingress instance is to add the annotation nginx.ingress.kubernetes.io/enable-opentelemetry: "false" to all other ingress instances which is cumbersome.

Previously with OpenTracing it worked fine because tracing was disabled by default in that module.

I propose to add here in nginx.tmpl a config option opentelemetry off; the next line after the option opentelemetry_config .... In this case it will mimic old OpenTracing behaviour, i.e. OpenTelemetry will be disabled in the http scope of nginx and then enabled per server/location if either global ConfigMap option or local annotation are enabled.

Source: kubernetes/ingress-nginx