From a027c6e9fe1122e9279f9158386a4e218d8f9433 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 14 Sep 2022 01:59:37 -0500 Subject: Maybe fix positional argument mismatch for DummyLink Hopefully fix: ``` File "/home/runner/work/synapse/synapse/synapse/storage/controllers/persist_events.py", line 246, in add_to_queue links=[Link(end_item.tracing_span_context)], builtins.TypeError: __init__() takes 1 positional argument but 2 were given ``` --- synapse/logging/tracing.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'synapse/logging/tracing.py') diff --git a/synapse/logging/tracing.py b/synapse/logging/tracing.py index b92c1d96e3..d594ab735b 100644 --- a/synapse/logging/tracing.py +++ b/synapse/logging/tracing.py @@ -216,7 +216,7 @@ class _DummyLookup(object): class DummyLink(ABC): """Dummy placeholder for `opentelemetry.trace.Link`""" - def __init__(self) -> None: + def __init__(self, *args: Any) -> None: self.not_implemented_message = ( "opentelemetry isn't installed so this is just a dummy link placeholder" ) @@ -547,7 +547,7 @@ def start_active_span( name: str, *, context: Optional["opentelemetry.context.context.Context"] = None, - kind: Optional["opentelemetry.trace.SpanKind"] = SpanKind.INTERNAL, + kind: "opentelemetry.trace.SpanKind" = SpanKind.INTERNAL, attributes: "opentelemetry.util.types.Attributes" = None, links: Optional[Sequence["opentelemetry.trace.Link"]] = None, start_time: Optional[int] = None, @@ -560,11 +560,6 @@ def start_active_span( if opentelemetry is None: return contextlib.nullcontext() # type: ignore[unreachable] - # TODO: Why is this necessary to satisfy this error? It has a default? - # ` error: Argument "kind" to "start_span" of "Tracer" has incompatible type "Optional[SpanKind]"; expected "SpanKind" [arg-type]` - if kind is None: - kind = SpanKind.INTERNAL - span = start_span( name=name, context=context, -- cgit 1.5.1