Metrics, time series, and resources

Cloud Monitoring models the measurements it collects by using monitored-resource types, metric types, and time series so you can track how your applications and system services perform.

Monitored-resource types identify measurement sources. Metric types define what is measured, such as CPU utilization. Monitoring provides more than 6,500 types in the Metrics list for Google Cloud, AWS, and third-party software, and lets you create custom metrics. A time series collects the measurements from a specific monitored resource.

For labels and cardinality, see Components of the metric model. For Cloud Monitoring API representations and custom-metric details, see Structure of time series.

The Cloud Monitoring metric model

A metric is a set of related measurements of some attribute of a resource you are monitoring. Measurements might include the latency of requests to a service, the amount of disk space available on a machine, the number of tables in your SQL database, the number of widgets sold, and so forth. Resources might include virtual machines (VMs), database instances, disks, and so forth.

The general notion of a metric in Cloud Monitoring encompasses three primary components:

  • Information about the source of the measurements.
  • A set of measurements of some property. Each measurement is recorded as a time-stamped value.
  • Information about the values of the property being measured.

For example, suppose there is a metric that tracks the number of widgets sold by a store. The components of the model map to this example in the following ways:

  • Source of the measurements

    The metric model records information about each resource being monitored. The particular information captured depends on the type of resource being monitored: it might include geographical locations, method names, disk IDs, or anything else that might be the source of measurements.

    Source information: project? location? method?
    

    The source of monitoring data is called a monitored resource.

    Example: In the widget-sales example, the monitored resources are the stores selling the widgets.

  • Measurements

    The metric model captures measurements of a property as a set of data points, consisting of time-stamped values.

    Points: [(value1, time1), (value2, time2), ...]
    

    Values are typically numeric, but it depends on what you're measuring.

    Example: In the widget-sales example, the measurements record sales information at points in time. Such measurements might look like the following:

    [(150, 2024-05-23T17:37:00-04:00),
     (229, 2024-05-23T17:38:00-04:00),
     (138, 2024-05-23T17:39:00-04:00),
     ...]
  • Information about the values

    The measurement values are meaningless without information about how to interpret them. You need to have some “type” information about the values, like data type, unit, and kind of each measurement:

    • Is the value an integer or a string?
    • Does the value represent miles per hour or radians?
    • Does the value represent the total at the time or the change since the previous value?

      Type information: integer? incremental?
      

    Cloud Monitoring calls each set of characteristics about something you want to measure a metric type.

    Example: In the widget-sales example, this information might tell you the following:

    • Each value is recorded as a 64-bit integer.
    • Each value represents a count of widgets sold.
    • Each value represents the number of widgets sold since the last recorded measurement.

Time series: putting the components together

In Cloud Monitoring, the data structure that underlies this model is the time series (the singular and the plural forms are the same).

Each time series encompasses the three components of the model:

  • A description of the monitored resource from which the measurements originated.
  • The set of measurements associated with a single monitored resource.
  • A description of the metric type that describes what you are measuring.

    Time series:
    
      Source information: project? location? method?
      Points: [(value1, time1), (value2, time2), ...]
      Type information: integer? incremental?
    

Example: In the widget-sales example, a time series includes the following:

  • A description of the store that sold the widgets counted in this time series.
  • The set of measurements recorded for this store.
  • A description of the values: 64-bit integers measuring the number of widgets sold since the previous recorded value.

A single Cloud Monitoring metric type or monitored-resource type can be associated with many related time series. In the widget-sales example, each store that sells widgets stores its data in a time series, so if there are 15 stores selling widgets, there can be 15 time series recording widget sales.

What's next