Every metric in Cloud Monitoring has a *value type* and a *metric kind* that
define the data format of each point and how consecutive points relate over
time. Understanding these two attributes helps you interpret built-in metrics,
aggregate time series accurately, and choose valid combinations when you design
custom metrics. For an overview of all metric-type attributes, see
[Metric types](https://docs.cloud.google.com/monitoring/api/v3/metric-model.md.txt#metric_types).

### Value type

The *value type* is the data type for the measurements. Each time series
records the value type (type [`ValueType`](https://docs.cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors.md.txt#ValueType))
for its data points.

- For measurements consisting of a single value at a time, like boolean values and
  numeric 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 a
  group of values. The value type for distribution measurements is
  `DISTRIBUTION`.

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

Latency metrics typically capture data as distributions. For more information
about distributions, see the [`Distribution`](https://docs.cloud.google.com/monitoring/api/ref_v3/rest/v3/TypedValue.md.txt#Distribution) reference
page. For information about charting these metrics, see
[Distribution metrics](https://docs.cloud.google.com/monitoring/charts/charting-distribution-metrics.md.txt).


### Metric kind

Each time series includes the metric kind (type [`MetricKind`](https://docs.cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors.md.txt#MetricKind))
for its data points. This field tells you how to
interpret the values of data points relative to each other:

- 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 but
  includes the end time, `(startTime, endTime]`. For example, metrics measuring
  request counts are delta metrics; each value records how many requests were
  received after the start time, up to and including the end time.

  > [!NOTE]
  > **Note:** All metrics that count discrete items over a time interval are delta metrics. It is reasonable to expect such values to be integers, but for historical implementation reasons, they are reported as floating-point numbers.

- 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 combinations
that make sense together.

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

| Value type | GAUGE | DELTA | CUMULATIVE^4^ |
|---|---|---|---|
| BOOL | yes | no | no |
| INT64 | yes | yes^1^ | yes |
| DOUBLE | yes | yes^1^ | yes |
| STRING | yes^1^ | no | no |
| DISTRIBUTION | yes^2^ | yes^1, 3^ | yes |

^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](https://docs.cloud.google.com/logging/docs/logs-based-metrics/distribution-metrics.md.txt#api).  
^3^ This is the only combination permitted for log-based metrics, `logging.googleapis.com/user`, with value type `DISTRIBUTION`; for more information, see the [`metricDescriptor` field](https://docs.cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics.md.txt#LogMetric.FIELDS.metric_descriptor) in the Logging API `LogMetric` reference.  
^4^ Cumulative metrics can't be used directly for charting or alerting in Monitoring, but they can be aggregated into non-cumulative metrics that can be used in these ways. See [Metric kinds,
types, and conversions](https://docs.cloud.google.com/monitoring/api/v3/aggregation#ts-conversion) for more information.

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

#### Emulating string-valued custom metrics

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

- Create a GAUGE metric using an INT64 value as an enum that maps to a string value. Externally translate the enum to a string value when you query the metric.
- Create a GAUGE metric with a BOOL value and a label whose value is one of the strings you want to monitor. Use the boolean to indicate if the value is the active 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 metric
with 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".