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.ExportRecord(instrument, labels, aggregator, resource)[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(export_records)[source]

Exports a batch of telemetry data.

Parameters

export_records (Sequence[ExportRecord]) – A sequence of ExportRecord s. A ExportRecord 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(export_records)[source]

Exports a batch of telemetry data.

Parameters

export_records (Sequence[ExportRecord]) – A sequence of ExportRecord s. A ExportRecord 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