Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ class MeterProvider(APIMeterProvider):
metric_readers: Register metric readers to collect metrics from the SDK
on demand. Each :class:`opentelemetry.sdk.metrics.export.MetricReader` is
completely independent and will collect separate streams of
metrics. TODO: reference ``PeriodicExportingMetricReader`` usage with push
exporters here.
metrics. For push-based export, use
:class:`opentelemetry.sdk.metrics.export.PeriodicExportingMetricReader`.
resource: The resource representing what the metrics emitted from the SDK pertain to.
shutdown_on_exit: If true, registers an `atexit` handler to call
`MeterProvider.shutdown`
Expand All @@ -400,6 +400,18 @@ class MeterProvider(APIMeterProvider):
],
# ...
)

.. code-block:: python
:caption: Push-based export with PeriodicExportingMetricReader

from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import (
ConsoleMetricExporter,
PeriodicExportingMetricReader,
)

reader = PeriodicExportingMetricReader(ConsoleMetricExporter())
provider = MeterProvider(metric_readers=[reader])
"""

_all_metric_readers_lock = Lock()
Expand Down
Loading