Machine LearningTutorial

Getting started tutorial

In this guide, we will create a forecast for your Grafana Cloud metrics usage.

You can use this forecast to see if/when you are predicted to go over your limits, or if an unexpected increase in metrics occurs.

Create a forecast

  1. Navigate to Machine Learning > Forecasts.
  2. Click Create Forecast.
  3. In the Query builder choose Datasource grafanacloud-usage.
  4. Run the following query: sum(grafanacloud_instance_active_series).
  5. Click on the Training Model tab.
    • You do not need to adjust anything here, but look at what knobs are tuneable.
  6. Click Create Forecast.
  7. Name your forecast and click Confirm.

On the Forecasts page, your forecast is ready to generate predictions when the circle turns green.

View your forecast

  1. Click View on the Grafana Cloud Active Series forecast.
  2. Change the view to an interesting timeframe for your cast, by default the view is for this week.

Explore how the forecast matches your actual result, and be sure to include some days in the future to see how the model thinks your active series will evolve.

At the bottom of the screen, the UI displays your original query, as well as how you can query the forecast (grafanacloud_active_series:predicted) or actual(grafanacloud_active_series:actual) data. You can use these series to create panels or alerts.

Use the forecast in a panel

From the view page:

  1. Click the Copy as panel button in the upper right.
  2. Open an existing dashboard or create a new dashboard.
  3. Add a panel to the dashboard using Paste panel from clipboard.
  4. Edit the new panel and view the generated queries.

Use the forecast in an alert

  1. Click the Create Alert button from either the view page or the list page.
  2. Choose a folder in which to save the alert.
  3. Tune the alert conditions and labels, if desired.
  4. Click Save or Save and Exit to create the alert and navigate back to the previous page.

See Grafana Alerting for more information on alerting.