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

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 Other options and then selecting Open in Metrics Explorer.

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.

Performance and limits related to charts

The performance of charts and dashboards depends in part of the amount of data each displays. In order to keep the performance within acceptable ranges, the following limits apply to charts:

Category Value
Dashboards per Workspace 1000
Charts on a dashboard 25
Lines on a chart 300

These provide upper limits for the number of charts on a dashboard or lines on a chart. However, it is unlikely that most charts with this many lines will be meaningful.

Structural causes of excess data

The performance of a chart is sensitive to the number of time series it is trying to display. The number of time series depends, in part, on the structure of the metric type and monitored-resource type associated with the time series. Each of these types has a number of labels; the Metrics list and Monitored resource list include the labels for each metric and monitored-resource type.

You have one time series for each unique combination of values for the set of labels. The number of possible combinations is called the cardinality.

For more information on labels, values, and cardinality, see Cardinality.

If you encounter performance issues when displaying metric data, you can often mitigate the issues by using the techniques described in Reducing chart data.

If the metric types are custom metrics created for your service, you might also be able to ask service developers to change their metric definitions to reduce the number of labels or the number of possible values for them, reducing the cardinality of the metric as a result.

Reducing chart data

To further improve performance, and simultaneously make charts more understandable, you can use the following techniques to reduce the number of lines on your charts:

What's next