Add temporary filters to a custom dashboard

This document describes how you can change what data is displayed on a custom dashboard—without having to modify each widget—by adding temporary groupings and temporary filters. After you add a dashboard-wide grouping or filter, the dashboard toolbar displays a menu item for that grouping or filter.

When troubleshooting, you can modify the data a dashboard displays by adding temporary groupings or filters. For example, if you are investigating an incident and want the dashboard to only display data for a specific virtual machine (VM), then add a temporary filter.

Temporary groupings and filters are automatically deleted when you reload the page; however, you can also delete them manually.

For information about how to create permanent filters, see Add permanent filters to custom dashboards.

How dashboard filters work

A dashboard filter specifies a label and a value. The time series that the dashboard displays determine the labels available for filtering. How a widget supports a dashboard-wide filter depends on the type of data the widget displays, and the configuration of the widget:

  • For widgets that display time-series data, such as a line charts, the following rules apply:

    • If the time series displayed by the widget doesn't support the label in a filter, then the dashboard-wide filter doesn't change the displayed data.

      For example, if you add a filter on the label instance_id, but a chart on the dashboard doesn't display data with an instance_id label, then the filter doesn't change the displayed data.

    • If the widget specifies a value for a label, then the dashboard-wide filter doesn't change the displayed data.

      For example, if you add a filter on the label instance_id, but a chart on the dashboard includes a filter based on the instance_id label, then the dashboard-wide filter doesn't change the displayed data.

    • Otherwise, the chart filters the data it displays to only those time series that satisfy the dashboard-wide filter.

  • For logs panel widgets, dashboard-wide filters that are based on a resource label update the query. For example, if you add the dashboard-wide filter cluster_name: mycluster, then the query is updated to include resource.labels."cluster_name"="mycluster".

You can add multiple dashboard-wide filters. These filters are joined with a logical AND.

Before you begin

To get the permissions that you need to add or modify temporary filters by using the Google Cloud console, ask your administrator to grant you the Monitoring Viewer (roles/monitoring.viewer) IAM role on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

For more information about roles, see Control access with Identity and Access Management.

Create or modify temporary groupings

When you add dashboard-wide groupings, the widgets on the dashboard display one time series for each set of time series that have the same values for the grouping labels. By default, the average of each set is shown. However, when the widget defines a grouping function, then that function is used.

For example, assume your dashboard contains a chart that displays the CPU utilization of your VM instances. To determine whether you need to deploy more VMs to a particular zone, you could edit the dashboard and that chart to change its grouping options. An alternative is to temporarily group the dashboard by zone, and then view the CPU utilization chart.

To create or modify the temporary groupings, do the following:

  1. In the Google Cloud console, go to the  Dashboards page:

    Go to Dashboards

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  2. Expand the Group By menu and then select the labels for grouping.
  3. Click OK.

When you navigate away from the dashboard, any groupings that you created are discarded.

Create a temporary filter

When you are investigating an incident, you might want to look at data in specific ways. For example, you might want to view only time series for a specific virtual machine or for resources in a specific region. When you create a temporary filter, all dashboard widgets are modified to show data that matches that filter. For example, to configure all charts to show only time series for a specific VM instance, create a filter based on the label instance_id. Similarly, to configure the dashboard to only show time series for a specific zone, create a filter based on the label zone.

To create a temporary filter, do the following:

  1. In the Google Cloud console, go to the  Dashboards page:

    Go to Dashboards

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  2. In the dashboard's filter bar, click Add filter, and then select a label from the menu.

    The menu lists the labels for every time series shown on the dashboard.

    After you select a label, a filter is added to the dashboard toolbar. The filter's name has the same name as your selection, and its value is set to *, which matches all values. For example, if you select zone, then the toolbar displays zone: *.

  3. To select a specific value to match, click the filter, for example, click zone: *, and then select a value from the menu. To reduce the number of menu options, enter part of the value into the Filter area.

When you navigate away from the dashboard, any filters that you created are discarded.

Modify or delete a temporary filter

Temporary filters are deleted automatically when you navigate away from the dashboard. To manually remove a temporary filter, on that filter, click Delete.

What's next