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 c78c992
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Add `force_flush` method to metrics exporter
([#2852](https://github.com/open-telemetry/opentelemetry-python/pull/2852))
- Change tracing to use `Resource.to_json()`
([#2784](https://github.com/open-telemetry/opentelemetry-python/pull/2784))
- Fix get_log_emitter instrumenting_module_version args typo
Expand Down
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 c78c992

Please sign in to comment.