CPU load measurement

Returns the most recent Cloud Bigtable CPU load measurement.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

Python

To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

client = monitoring_v3.MetricServiceClient()
cpu_query = query.Query(client,
                        project=PROJECT,
                        metric_type='bigtable.googleapis.com/'
                                    'cluster/cpu_load',
                        minutes=5)
cpu_query = cpu_query.select_resources(instance=bigtable_instance, cluster=bigtable_cluster)
cpu = next(cpu_query.iter())
return cpu.points[0].value.double_value

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.