Skip to content

Commit

Permalink
Finish typing InMemorySpanExporter (#3285)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngnpope committed Jul 12, 2023
1 parent f86d2fd commit 04ab744
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ class InMemorySpanExporter(SpanExporter):
:func:`.get_finished_spans` method.
"""

def __init__(self):
self._finished_spans = []
def __init__(self) -> None:
self._finished_spans: typing.List[ReadableSpan] = []
self._stopped = False
self._lock = threading.Lock()

def clear(self):
def clear(self) -> None:
"""Clear list of collected spans."""
with self._lock:
self._finished_spans.clear()

def get_finished_spans(self):
def get_finished_spans(self) -> typing.Tuple[ReadableSpan, ...]:
"""Get list of collected spans."""
with self._lock:
return tuple(self._finished_spans)
Expand All @@ -50,7 +50,7 @@ def export(self, spans: typing.Sequence[ReadableSpan]) -> SpanExportResult:
self._finished_spans.extend(spans)
return SpanExportResult.SUCCESS

def shutdown(self):
def shutdown(self) -> None:
"""Shut downs the exporter.
Calls to export after the exporter has been shut down will fail.
Expand Down

0 comments on commit 04ab744

Please sign in to comment.