opentelemetry.exporter.cloud_monitoring.CloudMonitoringMetricsExporter

class opentelemetry.exporter.cloud_monitoring.CloudMonitoringMetricsExporter(project_id=None, client=None, add_unique_identifier=False, prefix='workload.googleapis.com')[source]

Bases: 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.

Parameters:
  • 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 “workload.googleapis.com” by default if not specified.

Methods

export

Exports a batch of telemetry data.

force_flush

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

shutdown

Shuts down the exporter.

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

Exports a batch of telemetry data.

Parameters:

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

Return type:

MetricExportResult

Returns:

The result of the export

force_flush(timeout_millis=10000)[source]

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

Return type:

bool

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

Shuts down the exporter.

Called when the SDK is shut down.

Return type:

None