From 9c815553ed061d2d9288c9756f12a473c67ff869 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 12 Jul 2023 15:07:13 +0100 Subject: Fix exemplars --- synapse/logging/opentracing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'synapse/logging') diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py index f5e4993fab..9a7fd7026b 100644 --- a/synapse/logging/opentracing.py +++ b/synapse/logging/opentracing.py @@ -672,8 +672,12 @@ def active_span() -> Optional["opentracing.Span"]: return opentracing.tracer.active_span -def get_prometheus_exemplar() -> Optional[Dict[str, str]]: - span = active_span() +def get_prometheus_exemplar( + span: Optional["opentracing.Span"] = None, +) -> Optional[Dict[str, str]]: + if not span: + span = active_span() + if not span: return None -- cgit 1.4.1