OpenTelemetry Cloud Monitoring Exporter
class opentelemetry.exporter.cloud_monitoring.CloudMonitoringMetricsExporter(project_id=None, client=None, add_unique_identifier=False, prefix='')[source]

Bases: opentelemetry.sdk.metrics._internal.export.MetricExporter

Implementation of Metrics Exporter to Google Cloud Monitoring

You can manually pass in project_id and client, or else the Exporter will take that information from Application Default Credentials.

  • project_id (Optional[str]) – project id of your Google Cloud project.

  • client (Optional[MetricServiceClient]) – Client to upload metrics to Google Cloud Monitoring.

  • add_unique_identifier (bool) – Add an identifier to each exporter metric. This must be used when there exist two (or more) exporters that may export to the same metric name within WRITE_INTERVAL seconds of each other.

  • prefix (Optional[str]) – the prefix of the metric. It is “” by default if not specified.

export(metrics_data, timeout_millis=10000, **kwargs)[source]

Exports a batch of telemetry data.


metrics – The list of opentelemetry.sdk.metrics.export.Metric objects to be exported

Return type



The result of the export


Ensure that export of any metrics currently received by the exporter are completed as soon as possible.

Return type


shutdown(timeout_millis=30000, **kwargs)[source]

Shuts down the exporter.

Called when the SDK is shut down.

Return type