summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-07-27 01:12:48 -0500
committerEric Eastwood <erice@element.io>2022-07-27 01:12:48 -0500
commit6406fd5d84fc3f0a2ac7624258e5824e2aa9521f (patch)
treefb57876df7fde42207fbd08bd586b3276f144f9a
parentProgress towards OTEL (diff)
downloadsynapse-6406fd5d84fc3f0a2ac7624258e5824e2aa9521f.tar.xz
Server running
-rw-r--r--synapse/logging/tracing.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/logging/tracing.py b/synapse/logging/tracing.py
index e437b2b627..15d1f384b8 100644
--- a/synapse/logging/tracing.py
+++ b/synapse/logging/tracing.py
@@ -216,7 +216,10 @@ class _DummyLookup(object):
 # These dependencies are optional so they can fail to import
 # and we
 try:
+    import opentelemetry
     import opentelemetry.trace
+    import opentelemetry.sdk.trace
+    import opentelemetry.sdk.trace.export
     import opentelemetry.semconv.trace
 
     SpanKind = opentelemetry.trace.SpanKind
@@ -370,12 +373,12 @@ def init_tracer(hs: "HomeServer") -> None:
 
     # TODO: opentelemetry_whitelist
 
-    provider = opentelemetry.TracerProvider()
-    processor = opentelemetry.BatchSpanProcessor(opentelemetry.ConsoleSpanExporter())
+    provider = opentelemetry.sdk.trace.TracerProvider()
+    processor = opentelemetry.sdk.trace.export.BatchSpanProcessor(opentelemetry.sdk.trace.export.ConsoleSpanExporter())
     provider.add_span_processor(processor)
 
     # Sets the global default tracer provider
-    trace.set_tracer_provider(provider)
+    opentelemetry.trace.set_tracer_provider(provider)
 
 
 # Whitelisting