Skip to content

Commit

Permalink
Add force flush method to metric exporter
Browse files Browse the repository at this point in the history
Fixes #2850
  • Loading branch information
ocelotl committed Aug 1, 2022
1 parent c9222bf commit d9266f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,6 @@ def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None:
@property
def _exporting(self) -> str:
return "metrics"

def force_flush(self, timeout_millis: float = 10_000) -> bool:
return True
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ def export(
The result of the export
"""

@abstractmethod
def force_flush(self, timeout_millis: float = 10_000) -> bool:
"""
Ensure that export of any metrics currently received by the exporter
are completed as soon as possible.
"""

@abstractmethod
def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None:
"""Shuts down the exporter.
Expand Down Expand Up @@ -125,6 +132,9 @@ def export(
def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None:
pass

def force_flush(self, timeout_millis: float = 10_000) -> bool:
return True


class MetricReader(ABC):
"""
Expand Down

0 comments on commit d9266f7

Please sign in to comment.