From 179a84f80505d2bb092080ebe7cba1eb71d56c3d Mon Sep 17 00:00:00 2001 From: Kshitiz Vijayvargiya Date: Tue, 9 Jul 2024 10:02:43 +0530 Subject: [PATCH] added handling for warning Signed-off-by: Kshitiz Vijayvargiya --- src/monocle_apptrace/instrumentor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/monocle_apptrace/instrumentor.py b/src/monocle_apptrace/instrumentor.py index 298e695..4506833 100644 --- a/src/monocle_apptrace/instrumentor.py +++ b/src/monocle_apptrace/instrumentor.py @@ -94,13 +94,18 @@ def setup_monocle_telemetry( SERVICE_NAME: workflow_name }) traceProvider = TracerProvider(resource=resource) + tracerProviderDefault = trace.get_tracer_provider() + providerType = type(tracerProviderDefault).__name__ for processor in span_processors: processor.on_start = on_processor_start + tracerProviderDefault.add_span_processor(processor) traceProvider.add_span_processor(processor) - trace.set_tracer_provider(traceProvider) + if "Proxy" in providerType : + trace.set_tracer_provider(traceProvider) instrumentor = MonocleInstrumentor(user_wrapper_methods=wrapper_methods) instrumentor.app_name = workflow_name - instrumentor.instrument() + if not instrumentor.is_instrumented_by_opentelemetry: + instrumentor.instrument() def on_processor_start(span: Span, parent_context):