Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish typing InMemorySpanExporter #3285

Merged
merged 4 commits into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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