This page describes the metrics that you can view in Key Visualizer heatmaps.

## Metrics

Key Visualizer automtically captures and aggregates metrics about performance
and resource usage for Spanner databases that have enabled it. All
metrics in Key Visualizer are normalized by the number of rows. This means
that the metric value inside a row range is the aggregated count divided by the
number of rows inside the range.

| Metrics | Description |
|---|---|
| CPU seconds | Number of CPU seconds spent per (wall clock) second reading / writing in a row range. |
| Logical stored bytes | Bytes used to store data in a row range. |
| Number of rows read | Number of rows read per second from a row range. |
| Number of bytes read | Number of bytes read (not bytes returned) per second from a row range. |
| Number of rows written | Number of rows inserted / updated per second in a row range. |
| Number of bytes written | Number of bytes inserted / updated per second in a row range. |

## Time window granularity

Spanner Key Visualizer aggregates metrics at several different
granularities over time. The most recent data is aggregated at the finest
granularity, while earlier data is aggregated more coarsely.

| Period | Granularity |
|---|---|
| Past 6 hours | 1 minute |
| Past 4 days | 10 minutes |
| Past 28 days | 1 hour |

## Data retention and wipeout

Spanner stores key ranges and metrics in an internal metadata table
as part of the user's database. Spanner Key Visualizer data retention
is as follows:

- Data that is collected every minute will be deleted after six hours.
- Data that is collected every ten minutes will be deleted after four days.
- Data that is collected every hour will be deleted after 28 days.

Key Visualizer stores row key data in the metadata table. If your data retention
requirements aren't compatible with Key Visualizer's data retention schedule,
you can
[disable Key Visualizer](https://docs.cloud.google.com/spanner/docs/key-visualizer/getting-started.md.txt#enabling_key_visualizer).

## Limitations

There are some situations in which new data might not be immediately available in
Key Visualizer.

- Storage and traffic statistics for newly created databases might not be available immediately.
- Traffic statistics for newly inserted rows might be attributed to existing key ranges.

## What's next

- [Get started with Key Visualizer](https://docs.cloud.google.com/spanner/docs/key-visualizer/getting-started.md.txt).
- Learn [how Key Visualizer displays data in heatmaps](https://docs.cloud.google.com/spanner/docs/key-visualizer/exploring-heatmaps.md.txt#heatmaps).
- Find out [how to explore Key Visualizer heatmaps](https://docs.cloud.google.com/spanner/docs/key-visualizer/exploring-heatmaps.md.txt).