Skip to content

Commit b504184

Browse files
committed
Please pylint and pyright at the same time
1 parent fd382c9 commit b504184

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
_ENV_VALUE_UNSET = ""
9090

9191

92-
class SpanProcessor:
92+
@typing.runtime_checkable
93+
class SpanProcessor(typing.Protocol):
9394
"""Interface which allows hooks for SDK's `Span` start and end method
9495
invocations.
9596
@@ -112,7 +113,6 @@ def on_start(
112113
span: The :class:`opentelemetry.trace.Span` that just started.
113114
parent_context: The parent context of the span that just started.
114115
"""
115-
...
116116

117117
def on_end(self, span: "ReadableSpan") -> None:
118118
"""Called when a :class:`opentelemetry.trace.Span` is ended.
@@ -123,11 +123,9 @@ def on_end(self, span: "ReadableSpan") -> None:
123123
Args:
124124
span: The :class:`opentelemetry.trace.Span` that just ended.
125125
"""
126-
...
127126

128127
def shutdown(self) -> None:
129128
"""Called when a :class:`opentelemetry.sdk.trace.TracerProvider` is shutdown."""
130-
...
131129

132130
def force_flush(self, timeout_millis: int = 30000) -> bool:
133131
"""Export all ended spans to the configured Exporter that have not yet
@@ -140,7 +138,6 @@ def force_flush(self, timeout_millis: int = 30000) -> bool:
140138
Returns:
141139
False if the timeout is exceeded, True otherwise.
142140
"""
143-
...
144141

145142

146143
# Temporary fix until https://github.com/PyCQA/pylint/issues/4098 is resolved

opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class SpanExportResult(Enum):
5151
FAILURE = 1
5252

5353

54-
class SpanExporter:
54+
@typing.runtime_checkable
55+
class SpanExporter(typing.Protocol):
5556
"""Interface for exporting spans.
5657
5758
Interface to be implemented by services that want to export spans recorded
@@ -72,21 +73,18 @@ def export(
7273
Returns:
7374
The result of the export
7475
"""
75-
...
7676

7777
def shutdown(self) -> None:
7878
"""Shuts down the exporter.
7979
8080
Called when the SDK is shut down.
8181
"""
82-
...
8382

8483
def force_flush(self, timeout_millis: int = 30000) -> bool:
8584
"""Hint to ensure that the export of any spans the exporter has received
8685
prior to the call to ForceFlush SHOULD be completed as soon as possible, preferably
8786
before returning from this method.
8887
"""
89-
...
9088

9189

9290
class SimpleSpanProcessor(SpanProcessor):

0 commit comments

Comments
 (0)