diff options
-rw-r--r-- | changelog.d/10799.misc | 1 | ||||
-rw-r--r-- | synapse/logging/opentracing.py | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/changelog.d/10799.misc b/changelog.d/10799.misc new file mode 100644 index 0000000000..91f7ede096 --- /dev/null +++ b/changelog.d/10799.misc @@ -0,0 +1 @@ +Add a max version for the `jaeger-client` dependency for an incompatibility with the rust reporter. diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py index ecd51f1b4a..d20f6e9106 100644 --- a/synapse/logging/opentracing.py +++ b/synapse/logging/opentracing.py @@ -236,8 +236,17 @@ except ImportError: try: from rust_python_jaeger_reporter import Reporter + # jaeger-client 4.7.0 requires that reporters inherit from BaseReporter, which + # didn't exist before that version. + try: + from jaeger_client.reporter import BaseReporter + except ImportError: + + class BaseReporter: # type: ignore[no-redef] + pass + @attr.s(slots=True, frozen=True) - class _WrappedRustReporter: + class _WrappedRustReporter(BaseReporter): """Wrap the reporter to ensure `report_span` never throws.""" _reporter = attr.ib(type=Reporter, default=attr.Factory(Reporter)) @@ -382,6 +391,7 @@ def init_tracer(hs: "HomeServer"): # If we have the rust jaeger reporter available let's use that. if RustReporter: logger.info("Using rust_python_jaeger_reporter library") + assert config.sampler is not None tracer = config.create_tracer(RustReporter(), config.sampler) opentracing.set_global_tracer(tracer) else: |