From 210bf85445f5d4cbc2f82cba63aa81fa1b6692e4 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 8 Dec 2025 10:28:05 +0100 Subject: [PATCH] Allow disabling tracing - register tracing middleware only when TRACING_ENABLED=="true" - this is required since tracing (jaeger) is not part of the default ONAP deployment Issue-ID: MULTICLOUD-1535 Change-Id: I6aae3ac1e7d3f322be50f1077e579c2a26aad746 Signed-off-by: Fiete Ostkamp --- src/k8splugin/api/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go index ef40cab4..e0ab60d8 100644 --- a/src/k8splugin/api/api.go +++ b/src/k8splugin/api/api.go @@ -17,6 +17,8 @@ limitations under the License. package api import ( + "os" + "github.com/gorilla/mux" "github.com/onap/multicloud-k8s/src/k8splugin/internal/app" "github.com/onap/multicloud-k8s/src/k8splugin/internal/connection" @@ -39,7 +41,9 @@ func NewRouter(defClient rb.DefinitionManager, router := mux.NewRouter() // adds a opentelemetry middleware for tracing - router.Use(otelmux.Middleware("multicloud-k8s")) + if os.Getenv("TRACING_ENABLED") == "true" { + router.Use(otelmux.Middleware("multicloud-k8s")) + } // Setup Instance handler routes if instClient == nil { -- 2.16.6