File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
opentelemetry-sdk/src/opentelemetry/sdk/trace Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 89
89
_ENV_VALUE_UNSET = ""
90
90
91
91
92
- class SpanProcessor :
92
+ @typing .runtime_checkable
93
+ class SpanProcessor (typing .Protocol ):
93
94
"""Interface which allows hooks for SDK's `Span` start and end method
94
95
invocations.
95
96
@@ -112,7 +113,6 @@ def on_start(
112
113
span: The :class:`opentelemetry.trace.Span` that just started.
113
114
parent_context: The parent context of the span that just started.
114
115
"""
115
- ...
116
116
117
117
def on_end (self , span : "ReadableSpan" ) -> None :
118
118
"""Called when a :class:`opentelemetry.trace.Span` is ended.
@@ -123,11 +123,9 @@ def on_end(self, span: "ReadableSpan") -> None:
123
123
Args:
124
124
span: The :class:`opentelemetry.trace.Span` that just ended.
125
125
"""
126
- ...
127
126
128
127
def shutdown (self ) -> None :
129
128
"""Called when a :class:`opentelemetry.sdk.trace.TracerProvider` is shutdown."""
130
- ...
131
129
132
130
def force_flush (self , timeout_millis : int = 30000 ) -> bool :
133
131
"""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:
140
138
Returns:
141
139
False if the timeout is exceeded, True otherwise.
142
140
"""
143
- ...
144
141
145
142
146
143
# Temporary fix until https://github.com/PyCQA/pylint/issues/4098 is resolved
Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ class SpanExportResult(Enum):
51
51
FAILURE = 1
52
52
53
53
54
- class SpanExporter :
54
+ @typing .runtime_checkable
55
+ class SpanExporter (typing .Protocol ):
55
56
"""Interface for exporting spans.
56
57
57
58
Interface to be implemented by services that want to export spans recorded
@@ -72,21 +73,18 @@ def export(
72
73
Returns:
73
74
The result of the export
74
75
"""
75
- ...
76
76
77
77
def shutdown (self ) -> None :
78
78
"""Shuts down the exporter.
79
79
80
80
Called when the SDK is shut down.
81
81
"""
82
- ...
83
82
84
83
def force_flush (self , timeout_millis : int = 30000 ) -> bool :
85
84
"""Hint to ensure that the export of any spans the exporter has received
86
85
prior to the call to ForceFlush SHOULD be completed as soon as possible, preferably
87
86
before returning from this method.
88
87
"""
89
- ...
90
88
91
89
92
90
class SimpleSpanProcessor (SpanProcessor ):
You can’t perform that action at this time.
0 commit comments