Create charts with Metrics Explorer

To explore metric data, build a temporary chart with Metrics Explorer. For example, if you want to view the CPU utilization of a virtual machine (VM), you can use Metrics Explorer to construct a chart that displays the most recent data. When you navigate away from the Metrics Explorer page, the chart is discarded and you don't have any unwanted artifacts to delete.

You can create simple charts, such as those that chart a single metric, and complex charts, such as those that chart multiple metrics. A chart can display a maximum of 10 metrics.

When you manage custom dashboards by using the Cloud Monitoring API, Metrics Explorer provides you two useful utilities:

  • To generate the JSON representation for a chart that you plan to add to a dashboard, configure the chart with Metrics Explorer. You can then use options within Metrics Explorer to view and copy the chart's JSON representation.

  • To identify the syntax for a Monitoring filter, which is used with the Cloud Monitoring API, use the menu-driven interface of Metrics Explorer to configure the chart. After you select the metric and filters, switch to direct filter mode to view the equivalent Monitoring filter.

After you create a chart with Metrics Explorer, you can discard it, save it to a custom dashboard, or share it.

The following screenshot shows a metric charted on the Metrics Explorer page:

Metric charted using Metrics Explorer.

Chart a single metric

To configure a chart by using Metrics Explorer, do the following:

  1. In the Cloud Console, select Monitoring or click the following button:
    Go to Monitoring

  2. In the navigation pane, select Metrics Explorer .

  3. Specify the data to appear on the chart. To use a menu-driven interface or to enter a Monitoring filter, select the Configuration tab. To use the Monitoring Query Language (MQL), select the MQL tab.

    Configuration tab

    Select the resource and metric by doing one of the following:

    • To chart a metric, such as the CPU utilization of a VM, make selections for the Resource type and Metric fields. You can select values from the menus or you can enter the name. You can complete these fields in any order.

    • To chart a service level objective or the count of processes running on VMs, then enter a Monitoring filter. To access the Monitoring filter field, expand the Resource type menu and select Direct filter mode.

    (Optional) Use the following options to refine the display:

    • To specify a subset of data to display, add filters. To add a filter, select Add filter and complete the dialog. For more information, see Filter charted data.
    • To group time series by a label, use the Group By field. Selecting a value for this field automatically selects a value for the Aggregator field.
    • To specify how to combine time series, set the Aggregator field. For example, if the Group by field is empty and the Aggregator field is set to mean, then the chart displays the average of the time series.
    • To configure how the individual time series are processed, select Advanced Options.

    For more information about Metrics Explorer fields, see Selecting metrics and Choosing how to display charted data.

    MQL tab

    Enter your query into the query editor. The following documents provide information about MQL:

  4. If you've charted a quota metric or a metric with a Distribution value type, then update the chart style and time control setting. For other metric types, changing the default values is optional.

    For quota metrics, use the following settings:

    • Set the time control to be at least one week because these metrics typically report one sample per day.
    • In the Metrics Explorer toolbar, select Line chart, and then select Stacked area chart from the menu.

    For distribution-valued metrics, use the following settings:

    • In the Metrics Explorer toolbar, select Line chart, and then select Heatmap chart. For more information, see Chart distribution metrics.
  5. (Optional) To add a threshold to the chart, view only outliers, compare current data to past data, or change the color-setting, select Settings. For more information about your choices, see View options.

Chart multiple metrics

In some situations, you might want to display multiple metrics on the same chart. For example, to compare the read and write loads on a VM, configure a chart to display the number of bytes read and the number of bytes written.

To display multiple metrics on a chart, do the following:

  1. In the Cloud Console, select Monitoring or click the following button:
    Go to Monitoring
  2. In the navigation pane, select Metrics Explorer .
  3. Select the Configuration tab.
  4. Select the resource and metric by doing one of the following:

    • To chart a metric, such as the CPU utilization of a VM, make selections for the Resource type and Metric fields. You can select values from the menus or you can enter the name. You can complete these fields in any order.

    • To chart a service level objective or the count of processes running on VMs, then enter a Monitoring filter. To access the Monitoring filter field, expand the Resource type menu and select Direct filter mode.

  5. (Optional) Use the following options to refine the display:

    • To specify a subset of data to display, add filters. To add a filter, select Add filter and complete the dialog. For more information, see Filter charted data.
    • To group time series by a label, use the Group By field. Selecting a value for this field automatically selects a value for the Aggregator field.
    • To specify how to combine time series, set the Aggregator field. For example, if the Group by field is empty and the Aggregator field is set to mean, then the chart displays the average of the time series.
    • To configure how the individual time series are processed, select Advanced Options.
  6. Add additional metrics to the chart. A chart can display a maximum of 10 metrics. For each additional metric, do the following:

    1. Select Add another metric.
    2. Select a metric, and then specify how to display the time series for that metric.

Save a chart for future reference

Metrics Explorer lets you create a chart that you can use to explore a metric. However, the charts created by this tool aren't persistent. When you navigate away from the Metrics Explorer page, the chart is discarded.

To save a chart you've configured with Metrics Explorer for future reference, add the chart to a custom dashboard or save the chart's URL:

  • To add the chart to a custom dashboard, do one of the following:

    • If you use the Google Cloud Console to manage your custom dashboards, then select Save Chart in the Metrics Explorer toolbar, and complete the dialog. You can save the chart to an existing custom dashboard or you can create a dashboard.

    • If you use the Cloud Monitoring API to manage your custom dashboards, then update the JSON file that defines the dashboard and its contents. You can access the JSON representation from the More options menu that is located in the Metrics Explorer toolbar.

      For detailed information about using the API to manage your custom dashboards, see Managing dashboards by API.

  • To keep a reference to the chart configuration, save the chart URL. Because the chart URL encodes the chart configuration, when you paste this URL into a browser the chart you configured is displayed.

    To obtain the chart's URL, select More options in the Metrics Explorer toolbar, and then select Share by URL.

What's next