File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -377,13 +377,25 @@ class MeterProvider(APIMeterProvider):
377377 metric_readers: Register metric readers to collect metrics from the SDK
378378 on demand. Each :class:`opentelemetry.sdk.metrics.export.MetricReader` is
379379 completely independent and will collect separate streams of
380- metrics. TODO: reference ``PeriodicExportingMetricReader`` usage with push
381- exporters here .
380+ metrics. For push-based export, use
381+ :class:`opentelemetry.sdk.metrics.export.PeriodicExportingMetricReader` .
382382 resource: The resource representing what the metrics emitted from the SDK pertain to.
383383 shutdown_on_exit: If true, registers an `atexit` handler to call
384384 `MeterProvider.shutdown`
385385 views: The views to configure the metric output the SDK
386386
387+ .. code-block:: python
388+ :caption: Push-based export with PeriodicExportingMetricReader
389+
390+ from opentelemetry.sdk.metrics import MeterProvider
391+ from opentelemetry.sdk.metrics.export import (
392+ ConsoleMetricExporter,
393+ PeriodicExportingMetricReader,
394+ )
395+
396+ reader = PeriodicExportingMetricReader(ConsoleMetricExporter())
397+ provider = MeterProvider(metric_readers=[reader])
398+
387399 By default, instruments which do not match any :class:`opentelemetry.sdk.metrics.view.View` (or if no :class:`opentelemetry.sdk.metrics.view.View`\ s
388400 are provided) will report metrics with the default aggregation for the
389401 instrument's kind. To disable instruments by default, configure a match-all
You can’t perform that action at this time.
0 commit comments