From: Fiete Ostkamp Date: Mon, 8 Dec 2025 09:28:05 +0000 (+0100) Subject: Allow disabling tracing X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F142679%2F1;p=multicloud%2Fk8s.git 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 --- 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 {