@@ -52,7 +52,9 @@ class MetricExporter(ABC):
52
52
"""
53
53
54
54
@abstractmethod
55
- def export (self , metrics : Sequence [Metric ]) -> "MetricExportResult" :
55
+ def export (
56
+ self , metrics : Sequence [Metric ], * args , ** kwargs
57
+ ) -> "MetricExportResult" :
56
58
"""Exports a batch of telemetry data.
57
59
58
60
Args:
@@ -63,7 +65,7 @@ def export(self, metrics: Sequence[Metric]) -> "MetricExportResult":
63
65
"""
64
66
65
67
@abstractmethod
66
- def shutdown (self ) -> None :
68
+ def shutdown (self , * args , ** kwargs ) -> None :
67
69
"""Shuts down the exporter.
68
70
69
71
Called when the SDK is shut down.
@@ -87,13 +89,15 @@ def __init__(
87
89
self .out = out
88
90
self .formatter = formatter
89
91
90
- def export (self , metrics : Sequence [Metric ]) -> MetricExportResult :
92
+ def export (
93
+ self , metrics : Sequence [Metric ], * args , ** kwargs
94
+ ) -> MetricExportResult :
91
95
for metric in metrics :
92
96
self .out .write (self .formatter (metric ))
93
97
self .out .flush ()
94
98
return MetricExportResult .SUCCESS
95
99
96
- def shutdown (self ) -> None :
100
+ def shutdown (self , * args , ** kwargs ) -> None :
97
101
pass
98
102
99
103
@@ -123,11 +127,11 @@ def get_metrics(self) -> List[Metric]:
123
127
self ._metrics = []
124
128
return metrics
125
129
126
- def _receive_metrics (self , metrics : Iterable [Metric ]):
130
+ def _receive_metrics (self , metrics : Iterable [Metric ], * args , ** kwargs ):
127
131
with self ._lock :
128
132
self ._metrics = list (metrics )
129
133
130
- def shutdown (self ):
134
+ def shutdown (self , * args , ** kwargs ):
131
135
pass
132
136
133
137
@@ -193,7 +197,9 @@ def _ticker(self) -> None:
193
197
# one last collection below before shutting down completely
194
198
self .collect ()
195
199
196
- def _receive_metrics (self , metrics : Iterable [Metric ]) -> None :
200
+ def _receive_metrics (
201
+ self , metrics : Iterable [Metric ], * args , ** kwargs
202
+ ) -> None :
197
203
if metrics is None :
198
204
return
199
205
token = attach (set_value (_SUPPRESS_INSTRUMENTATION_KEY , True ))
@@ -203,7 +209,7 @@ def _receive_metrics(self, metrics: Iterable[Metric]) -> None:
203
209
_logger .exception ("Exception while exporting metrics %s" , str (e ))
204
210
detach (token )
205
211
206
- def shutdown (self ):
212
+ def shutdown (self , * args , ** kwargs ):
207
213
def _shutdown ():
208
214
self ._shutdown = True
209
215
0 commit comments