From 527ab267e87d5e6413c34b6094869fe112d6f706 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 27 Jan 2022 14:40:53 +0100 Subject: [PATCH] only enable OpenTelemetry if the module has been loaded --- internal/ingress/controller/template/template.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/ingress/controller/template/template.go b/internal/ingress/controller/template/template.go index c7b10d92c2..37b938c2e5 100644 --- a/internal/ingress/controller/template/template.go +++ b/internal/ingress/controller/template/template.go @@ -1653,6 +1653,14 @@ func shouldLoadOpenTelemetryModule(c interface{}, s interface{}) bool { return false } + if _, err := os.Stat("/etc/nginx/modules/otel_ngx_module.so"); err != nil { + klog.Errorf("couldn't retrieve otel_ngx_module.so. Got %#v", err) + + // Switch the config to false so the templates don't try loading the plugin + cfg.EnableOpenTelemetry = false + return false + } + if cfg.EnableOpenTelemetry { return true }