Value types and metric kinds  |  Cloud Monitoring  |  Google Cloud (2024)

  • Home
  • Google Cloud Observability
  • Monitoring
  • Documentation
  • Guides
Stay organized with collections Save and categorize content based on your preferences.

In the discussion of the metric model, the sectionMetric types provides a general discussion of theattributes that describe a metric type. This section provides a more detaileddiscussion of two of those attributes:

  • Value type
  • Metric kind

Value type

The value type is the data type for the measurements. Each time seriesrecords the value type (type ValueType)for its data points.

  • For measurements consisting of a single value at a time, like boolean values andnumeric data, the value type tells you how the data is stored:

    • BOOL, a boolean
    • INT64, a 64-bit integer
    • DOUBLE, a double-precision float
    • STRING, a string
  • For distribution measurements, the value isn't a single value but agroup of values. The value type for distribution measurements isDISTRIBUTION.

    A distribution contains statistics that summarize a group of values.The values in a distribution include the mean, count, max, and otherstatistics, computed for a group of values. A distribution can alsoinclude a histogram that represents how the values are distributed acrossa set of ranges.

    Latency metrics typically capture data as distributions. For more informationabout distributions, see the Distribution referencepage.For information about charting these metrics, seeDistribution metrics.

Metric kind

Each time series includes the metric kind (type MetricKind)for its data points. The kind of metric data tells you how to interpret thevalues relative to each other. Cloud Monitoring metrics are one of threekinds:

  • A gauge metric, in which the value measures a specific instant in time.For example, metrics measuring CPU utilization are gauge metrics;each point records the CPU utilization at the time of measurement.Another example of a gauge metric is the current temperature.

  • A delta metric, in which the value measures the change in a time interval.For reads, the time interval is half-open, it excludes the start time butincludes the end time: (startTime, endTime]. For example, metrics measuringrequest counts are delta metrics; each value records how many requests werereceived after the start time, up to and including the end time.

  • A cumulative metric, in which the value constantly increases over time.For example, a metric for “sent bytes” might be cumulative;each value records the total number of bytes sent by a service at that time.

Supported combinations

Not all combinations of metric kind and value type make sense. For example,you never see a delta metric with boolean data. There are certain combinationsthat make sense together.

The following table lists the supported metric kinds and value types:

Value typeGAUGEDELTACUMULATIVE4
BOOLyesnono
INT64yesyes1yes
DOUBLEyesyes1yes
STRINGyes1nono
DISTRIBUTIONyes2yes1, 3yes

1 This combination isn't permitted in custom metrics,custom.googleapis.com.
2 This combination isn't permitted for log-based metrics. For more information, see Configure distribution-type log-based metrics.
3 This is the only combination permitted forlog-based metrics, logging.googleapis.com/user, with value typeDISTRIBUTION; for more information, see the metricDescriptor fieldin the Logging API LogMetric reference.
4 Cumulative metrics can't be used directly for charting oralerting in Monitoring, but they can be aggregated intonon-cumulative metrics that can be used in these ways. See Kinds,types, and conversions for more information.

Additionally, if you are creating your own metrics, you must use onlyvalid combinations of value types and metric kinds.

Emulating string-valued custom metrics

String values in custom metrics are not supported, but you can replicatestring-valued metric functionality in the following ways:

  • Create a GAUGE metric using an INT64 value as an enum that maps to a stringvalue. Externally translate the enum to a string value when you query themetric.
  • Create a GAUGE metric with a BOOL value and a label whose value is one of thestrings you want to monitor. Use the boolean to indicate if the value is theactive value.

For example, suppose you want to create a string-valued metric called "status"with possible options OK, OFFLINE, or PENDING. You could make a GAUGE metricwith a label called status_value. Each update would write three time series,one for each status_value (OK, OFFLINE, or PENDING), with a value of 1 for"true" or 0 for "false".

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-06-03 UTC.

Value types and metric kinds  |  Cloud Monitoring  |  Google Cloud (2024)
Top Articles
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 5813

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.