Skip to content

Commit

Permalink
Remove metric exporters from MeterProvider (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl authored Jan 11, 2022
1 parent 6b655ce commit 13fa220
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
ObservableUpDownCounter as APIObservableUpDownCounter,
)
from opentelemetry._metrics.instrument import UpDownCounter as APIUpDownCounter
from opentelemetry.sdk._metrics.export import MetricExporter
from opentelemetry.sdk._metrics.instrument import (
Counter,
Histogram,
Expand Down Expand Up @@ -100,7 +99,6 @@ class MeterProvider(APIMeterProvider):

def __init__(
self,
metric_exporters: Sequence[MetricExporter] = (),
metric_readers: Sequence[MetricReader] = (),
resource: Resource = Resource.create({}),
shutdown_on_exit: bool = True,
Expand All @@ -116,8 +114,6 @@ def __init__(
for metric_reader in self._metric_readers:
metric_reader._register_meter_provider(self)

self._metric_exporters = metric_exporters

self._resource = resource
self._shutdown = False

Expand All @@ -126,7 +122,6 @@ def force_flush(self) -> bool:
# FIXME implement a timeout

metric_reader_result = True
metric_exporter_result = True

for metric_reader in self._metric_readers:
metric_reader_result = (
Expand All @@ -136,15 +131,7 @@ def force_flush(self) -> bool:
if not metric_reader_result:
_logger.warning("Unable to force flush all metric readers")

for metric_exporter in self._metric_exporters:
metric_exporter_result = (
metric_exporter_result and metric_exporter.force_flush()
)

if not metric_exporter_result:
_logger.warning("Unable to force flush all metric exporters")

return metric_reader_result and metric_exporter_result
return metric_reader_result

def shutdown(self):
# FIXME implement a timeout
Expand All @@ -161,12 +148,6 @@ def shutdown(self):
if not result:
_logger.warning("A MetricReader failed to shutdown")

for metric_exporter in self._metric_exporters:
result = result and metric_exporter.shutdown()

if not result:
_logger.warning("A MetricExporter failed to shutdown")

self._shutdown = True

if self._atexit_handler is not None:
Expand Down

0 comments on commit 13fa220

Please sign in to comment.