@@ -271,7 +271,7 @@ class _WrappedRustReporter(BaseReporter):
271
271
def set_process (self , * args , ** kwargs ):
272
272
return self ._reporter .set_process (* args , ** kwargs )
273
273
274
- def report_span (self , span ) :
274
+ def report_span (self , span : "opentracing.Span" ) -> None :
275
275
try :
276
276
return self ._reporter .report_span (span )
277
277
except Exception :
@@ -537,19 +537,19 @@ def start_active_span_follows_from(
537
537
538
538
539
539
def start_active_span_from_edu (
540
- edu_content ,
541
- operation_name ,
542
- references : Optional [list ] = None ,
543
- tags = None ,
544
- start_time = None ,
545
- ignore_active_span = False ,
546
- finish_on_close = True ,
547
- ):
540
+ edu_content : Dict [ str , Any ] ,
541
+ operation_name : str ,
542
+ references : Optional [List [ "opentracing.Reference" ] ] = None ,
543
+ tags : Optional [ Dict ] = None ,
544
+ start_time : Optional [ float ] = None ,
545
+ ignore_active_span : bool = False ,
546
+ finish_on_close : bool = True ,
547
+ ) -> "opentracing.Scope" :
548
548
"""
549
549
Extracts a span context from an edu and uses it to start a new active span
550
550
551
551
Args:
552
- edu_content (dict): and edu_content with a `context` field whose value is
552
+ edu_content: an edu_content with a `context` field whose value is
553
553
canonical json for a dict which contains opentracing information.
554
554
555
555
For the other args see opentracing.tracer
@@ -603,7 +603,7 @@ def set_tag(key: str, value: Union[str, bool, int, float]) -> None:
603
603
604
604
605
605
@ensure_active_span ("log" )
606
- def log_kv (key_values : Dict [str , Any ], timestamp = None ) -> None :
606
+ def log_kv (key_values : Dict [str , Any ], timestamp : Optional [ float ] = None ) -> None :
607
607
"""Log to the active span"""
608
608
assert opentracing .tracer .active_span is not None
609
609
opentracing .tracer .active_span .log_kv (key_values , timestamp )
@@ -636,7 +636,9 @@ def force_tracing(span=Sentinel) -> None:
636
636
span .set_baggage_item (SynapseBaggage .FORCE_TRACING , "1" )
637
637
638
638
639
- def is_context_forced_tracing (span_context ) -> bool :
639
+ def is_context_forced_tracing (
640
+ span_context : Optional ["opentracing.SpanContext" ],
641
+ ) -> bool :
640
642
"""Check if sampling has been force for the given span context."""
641
643
if span_context is None :
642
644
return False
@@ -708,13 +710,13 @@ def inject_response_headers(response_headers: Headers) -> None:
708
710
709
711
710
712
@ensure_active_span ("get the active span context as a dict" , ret = {})
711
- def get_active_span_text_map (destination = None ):
713
+ def get_active_span_text_map (destination : Optional [ str ] = None ) -> Dict [ str , str ] :
712
714
"""
713
715
Gets a span context as a dict. This can be used instead of manually
714
716
injecting a span into an empty carrier.
715
717
716
718
Args:
717
- destination (str) : the name of the remote server.
719
+ destination: the name of the remote server.
718
720
719
721
Returns:
720
722
dict: the active span's context if opentracing is enabled, otherwise empty.
@@ -733,7 +735,7 @@ def get_active_span_text_map(destination=None):
733
735
734
736
735
737
@ensure_active_span ("get the span context as a string." , ret = {})
736
- def active_span_context_as_string ():
738
+ def active_span_context_as_string () -> str :
737
739
"""
738
740
Returns:
739
741
The active span context encoded as a string.
0 commit comments