Get started with Key Visualizer

Overview

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_reader system 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:

    • spanner.databases.read

For more information, see About fine-grained access control and Fine-grained access control system roles.

The Key Visualizer interface

You access the Key Visualizer tool from the Google Cloud console.

To access Key Visualizer:

  1. From the Spanner page of the Google Cloud console, select an instance.

  2. Select a database to investigate.

  3. Fine-grained access control users only: On the database Overview page, in the Current role field, specify the spanner_sys_reader system role or a role that is a member of (or a descendent of a member of) spanner_sys_reader.

    For more information, see About fine-grained access control and Fine-grained access control system roles.

  4. In the left navigation menu, under Observability, select Key Visualizer.

Disable Key Visualizer

Key Visualizer enablement is controlled by the enable_key_visualizer database option. The default value is true.

To disable Key Visualizer, set the value of the enable_key_visualizer database option to false. The DDL syntax to disable Key Visualizer is:

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 UpdateDatabaseDdl 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 true.

When first re-enabled for a database, the Key Visualizer heatmap will be empty for the first few minutes while Spanner collects metrics.

What's next