Key Visualizer is enabled by default.
There are some situations in which data may not be immediately available in Key Visualizer.
- Storage and traffic statistics for newly created databases may not be available immediately.
- Traffic statistics for newly inserted rows may be attributed to existing key ranges.
Before you begin
To view Key Visualizer, you need the following:
If you are a fine-grained access control user, you must have been granted access to the
spanner_sys_readersystem role or one of its member roles.
If you are not a fine-grained access control user, you need the following Identity and Access Management (IAM) permission:
The Key Visualizer interface
You access the Key Visualizer tool from the Google Cloud console.
To access Key Visualizer:
From the Spanner page of the Google Cloud console, select an instance.
Select a database to investigate.
Fine-grained access control users only: On the database Overview page, in the Current role field, specify the
spanner_sys_readersystem role or a role that is a member of (or a descendent of a member of)
In the left navigation menu, under Observability, select Key Visualizer.
Disable Key Visualizer
Key Visualizer enablement is controlled by the
database option. The default value is
To disable Key Visualizer, set the value of the
database option to
false. The DDL syntax to disable Key Visualizer
ALTER DATABASE `database_id` SET OPTIONS (enable_key_visualizer=false)
If your database ID contains characters other than letters, numbers, or underscores, be sure to enclose the ID with backticks (``).
The statement can be sent using a gcloud command, or in an
gRPC/REST request. For example:
gcloud spanner databases ddl update database_id --instance=instance_id \ --ddl='ALTER DATABASE `database_id` SET OPTIONS ( enable_key_visualizer=false )'
Once you've explicitly set the value for
enable_key_visualizer, you can check
its value by clicking SHOW EQUIVALENT DDL in the overview page, or using the
ddl describe gcloud command:
gcloud spanner databases ddl describe `database_id` --instance=instance_id
Re-enable Key Visualizer
To re-enable Key Visualizer, follow the instructions in
Disable Key Visualizer, setting the value of the
enable_key_visualizer database option to
When first re-enabled for a database, the Key Visualizer heatmap will be empty for the first few minutes while Cloud Spanner collects metrics.
- Learn to recognize common patterns in heatmaps.
- Find out how to explore a heatmap in depth.
- Read about the metrics you can view in a heatmap.