Cloud Monitoring Exporter Example

These examples show how to use OpenTelemetry to send metrics data to Cloud Monitoring.

Basic Example

To use this exporter you first need to:
  • Installation

pip install opentelemetry-api
pip install opentelemetry-sdk
pip install opentelemetry-exporter-cloud-monitoring
  • Run example

python basic_metrics.py

Viewing Output

After running the example:
  • Go to the Cloud Monitoring Metrics Explorer page.

  • In “Find resource type and metric” enter “OpenTelemetry/request_counter”.

  • You can filter by labels and change the graphical output here as well.