Browsing Metric and Resource Types

Get a list or description of built-in metric types, which can help you
design your custom metrics. This list also appears in the documentation;
see Metrics List.

Get a list or description of the available monitored resource types, which
you can use to label your custom metrics' time series data. This list also
appears in the documentation;
see Monitored Resource List.

To run the methods without writing any code, the
examples in the PROTOCOL tabs on this page use the forms-based
API Explorer. (See API Explorer for more
information on this tool.)

To learn how to use the methods from selected programming languages,
see the runnable code samples on this page.

Workspace not required

Except when working with custom metrics, you can use any existing project in
metricDescriptors.list and
get invocations,
even if the project is not in a Workspace. If you are working with custom
metrics, then you must specify the project where the custom metrics are defined.

Example: Listing metric types

To get a current list of metric types, use the
metricDescriptors.list method. Use a filter to narrow the set of metric
types that are returned. See
Metric types for help deciding which
metric type names to search for.

The type value here identifies the metric descriptor, for example,
compute.googleapis.com/firewall/dropped_packets_count. This value is
sometimes also called the “metric type^” or the
“metric type name”.

Example: Getting metric descriptors

To retrieve a specific metric descriptor, you need the full name of the
descriptor. This value is constructed from two components:

A prefix consisting of projects/[PROJECT_ID]/metricDescriptors.

The type value that identifies the metric descriptor, for example,
compute.googleapis.com/firewall/dropped_packets_count. See the
PROTOCOL tab in Example: Listing metric types
for more on the type value.

Finding resources

Monitored resource objects are included in time series data. You can usually
guess which metrics include monitored resources of specific types. For example,
if you want to see a gce_instance monitored resource, look at time series data
from a metric like compute.googleapils.com/instance/cpu/utilization. After
you've identified a likely metric time series, see
Reading metric data.