Skip to content

Commit

Permalink
Add missing args
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed May 4, 2022
1 parent e45c7c3 commit 6bf8feb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MetricExporter(ABC):

@abstractmethod
def export(
self, metrics: Sequence[Metric], **kwargs
self, metrics: Sequence[Metric], *args, **kwargs
) -> "MetricExportResult":
"""Exports a batch of telemetry data.
Expand All @@ -65,7 +65,7 @@ def export(
"""

@abstractmethod
def shutdown(self, **kwargs) -> None:
def shutdown(self, *args, **kwargs) -> None:
"""Shuts down the exporter.
Called when the SDK is shut down.
Expand All @@ -90,14 +90,14 @@ def __init__(
self.formatter = formatter

def export(
self, metrics: Sequence[Metric], **kwargs
self, metrics: Sequence[Metric], *args, **kwargs
) -> MetricExportResult:
for metric in metrics:
self.out.write(self.formatter(metric))
self.out.flush()
return MetricExportResult.SUCCESS

def shutdown(self, **kwargs) -> None:
def shutdown(self, *args, **kwargs) -> None:
pass


Expand Down Expand Up @@ -127,11 +127,11 @@ def get_metrics(self) -> List[Metric]:
self._metrics = []
return metrics

def _receive_metrics(self, metrics: Iterable[Metric], **kwargs):
def _receive_metrics(self, metrics: Iterable[Metric], *args, **kwargs):
with self._lock:
self._metrics = list(metrics)

def shutdown(self, **kwargs):
def shutdown(self, *args, **kwargs):
pass


Expand Down Expand Up @@ -197,7 +197,9 @@ def _ticker(self) -> None:
# one last collection below before shutting down completely
self.collect()

def _receive_metrics(self, metrics: Iterable[Metric], **kwargs) -> None:
def _receive_metrics(
self, metrics: Iterable[Metric], *args, **kwargs
) -> None:
if metrics is None:
return
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
Expand All @@ -207,7 +209,7 @@ def _receive_metrics(self, metrics: Iterable[Metric], **kwargs) -> None:
_logger.exception("Exception while exporting metrics %s", str(e))
detach(token)

def shutdown(self, **kwargs):
def shutdown(self, *args, **kwargs):
def _shutdown():
self._shutdown = True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ def _set_collect_callback(
self._collect = func

@abstractmethod
def _receive_metrics(self, metrics: Iterable[Metric], **kwargs):
def _receive_metrics(self, metrics: Iterable[Metric], *args, **kwargs):
"""Called by `MetricReader.collect` when it receives a batch of metrics"""

@abstractmethod
def shutdown(self, **kwargs):
def shutdown(self, *args, **kwargs):
"""Shuts down the MetricReader. This method provides a way
for the MetricReader to do any cleanup required. A metric reader can
only be shutdown once, any subsequent calls are ignored and return
Expand Down

0 comments on commit 6bf8feb

Please sign in to comment.