Skip to content

Commit

Permalink
Merge pull request #9 from monocle2ai/kshitiz/fix_warnings_opentelemetry
Browse files Browse the repository at this point in the history
Added handling for opentelemetry warnings
  • Loading branch information
kshitiz-okahu authored Jul 9, 2024
2 parents 0309457 + 179a84f commit 319d026
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/monocle_apptrace/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 319d026

Please sign in to comment.