Creating charts

This guide introduces Monitoring charts. There are two ways to build charts:

  • Building an ad-hoc chart using Metrics Explorer.
  • Creating a chart to be added to a dashboard.

Charts created for dashboards are persistent; they become part of a set of monitoring tools. Charts built with Metrics Explorer are transient and used for investigating specific issues. The techniques for building them are the same.

Charts can display any metric type collected by your project, including custom metrics.

The following screenshot shows a chart that displays a server-latency metric:

Show a CPU-usage chart with legend.

As seen in this screenshot, each time series in the charted metric shows up as a colored line. Each of these is keyed by color to an entry in the legend under the chart.

Before you begin

Ensure that you have one of the roles described in Authorization.

Building a new chart with Metrics Explorer

Metrics Explorer lets you build ad-hoc charts for any metric collected by your project. You can use Metrics Explorer to explore data you that you may not necessarily need on a dashboard, although charts built with Metrics Explorer can be saved to dashboards. You can also create a URL for the chart so it can be shared.

To build a new chart using Metrics Explorer:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. Select Metrics Explorer.

  3. Ensure the Metric tab is selected.

  4. Specify a metric by filling in the following fields or by leaving them at their default values:

    • Find resource type and metric (required)
    • Filter
    • Group By
    • Aggregator
    • Advanced Options
  5. (Optional) Click Add Metric and repeat the previous step to add a metric to your chart. A chart can display a maximum of 10 metrics.

  6. (Optional) To save the chart to a dashboard, select Save chart, enter a name for the chart, select the dashboard, and then click Save.

Creating a new chart for a dashboard

Dashboards typically display a set of related charts that you want to have available at all times. These resources can include charts, uptime checks, alerts, and others.

To create a new chart on a dashboard, do the following:

  1. In the dashboard, click Add Chart button:

    Show the dashboard toolbar.

  2. Specify a metric by filling in the following fields or by leaving them at their default values:

    • Find resource type and metric (required)
    • Filter
    • Group By
    • Aggregator
    • Advanced Options
  3. (Optional) Click Add Metric and repeat the previous step to add a metric to your chart. A chart can display a maximum of 10 metrics.

  4. Click Save.

You can put up to 25 charts on a dashboard.

You can also look at any chart on the dashboard in Metrics Explorer by clicking More and then selecting Open in Metrics Explorer. The More control also lets you edit, copy, and delete charts after you have created them.

Designing charts

Whether you are creating a chart to be installed on a dashboard or building an ad-hoc chart in Metrics Explorer, the chart-definition interface is nearly identical.

The process of designing a chart involves two tasks:

  • Specifying the data to appear on the chart.
  • Configuring the appearance of the chart.

These task are indicated by the two tabs on a chart-definition page (that is, either the Add Chart page or the Metrics Explorer page), as seen in the following screenshot, taken from the Add Chart page:

Display the chart-definition tabs.

  • The Metric tab is where you specify the metrics that you want to appear on the chart; this is covered in Selecting Metrics.
  • The View options tab is where you specify the appearance of the chart itself; this is covered in Setting View Options.

In addition, a chart on a dashboards gets a name; this is represented by the Chart Title value in the screenshot. Charts in Metrics Explorer do not have names; this field does not appear on the Metrics Explorer page. See Titling charts for more information about titling charts on dashboards.

After you have added a chart to a dashboard, you can edit it using the same interface.

Interacting with charts

Charts in Monitoring are dynamic constructs, not static images. There are many ways to interact with the charts, whether they are on a dashboard or built in Metrics Explorer; these are described in Working with Charts.

You can also select the metric and resource labels you want to see in the legend. See Configuring Legends for more information.

Titling charts

When adding a chart to a dashboard, a title is generated based on the metrics specified for the chart:

Show how to title a chart.

You can edit the generated title.

Chart type

In addition to the options on the View options tab, you can also specify the how the chart graphs the data. The default style is a line chart, but other styles, stacked bar and stacked area, are also available. To change the display style of a chart, select the desired type from the pull-down menu located just above the chart on the upper left. The pull-down shows the current style, which is most typically Line.

The complete set of options is not always available; for example, bar charts are not appropriate for data being viewed in X-ray mode. If you choose a chart type that is incompatible with a chosen chart mode, the chart mode reverts to Color.

The first three screenshots show the same chart using three display styles. There are two types of line charts and one bar chart. The line charts are higher resolution than bar charts; this is due to the alignment period used. The final chart is an example of a heatmap.

Standard line chart

Chart displaying lines

Stacked area chart

Chart displaying stacked areas

Stacked bar chart

Chart displaying stacked bars

Heatmap

If you are viewing a distribution metric, then you can display the time series as a heatmap. The following image displays the request latencies for the Cloud Spanner API in one Google Cloud project:

Chart displaying a heatmap

What's next