opentelemetry.sdk.metrics.export

class opentelemetry.sdk.metrics.export.MetricsExportResult[source]

Bases: enum.Enum

An enumeration.

SUCCESS = 0
FAILURE = 1
class opentelemetry.sdk.metrics.export.MetricRecord(aggregator, labels, metric)[source]

Bases: object

class opentelemetry.sdk.metrics.export.MetricsExporter[source]

Bases: object

Interface for exporting metrics.

Interface to be implemented by services that want to export recorded metrics in its own format.

export(metric_records)[source]

Exports a batch of telemetry data.

Parameters

metric_records (Sequence[MetricRecord]) – A sequence of MetricRecord s. A MetricRecord contains the metric to be exported, the labels associated with that metric, as well as the aggregator used to export the current checkpointed value.

Return type

MetricsExportResult

Returns

The result of the export

shutdown()[source]

Shuts down the exporter.

Called when the SDK is shut down.

Return type

None

class opentelemetry.sdk.metrics.export.ConsoleMetricsExporter[source]

Bases: opentelemetry.sdk.metrics.export.MetricsExporter

Implementation of MetricsExporter that prints metrics to the console.

This class can be used for diagnostic purposes. It prints the exported metrics to the console STDOUT.

export(metric_records)[source]

Exports a batch of telemetry data.

Parameters

metric_records (Sequence[MetricRecord]) – A sequence of MetricRecord s. A MetricRecord contains the metric to be exported, the labels associated with that metric, as well as the aggregator used to export the current checkpointed value.

Return type

MetricsExportResult

Returns

The result of the export