Allow disabling tracing 79/142679/1
authorFiete Ostkamp <fiete.ostkamp@telekom.de>
Mon, 8 Dec 2025 09:28:05 +0000 (10:28 +0100)
committerFiete Ostkamp <fiete.ostkamp@telekom.de>
Mon, 8 Dec 2025 09:28:05 +0000 (10:28 +0100)
- 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 <fiete.ostkamp@telekom.de>
src/k8splugin/api/api.go

index ef40cab..e0ab60d 100644 (file)
@@ -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 {