Connect Google Cloud Monitoring

Google Cloud Monitoring is a data source for error budgets. Agile Analytics reads your metrics every 30 minutes and measures each SLO against them. If you already have SLOs in Cloud Monitoring, Agile Analytics can also import them.

settings-15-add-data-source

1. Let Agile Analytics read your project

There are two ways. Our service account is the simpler one and keeps every key inside Google; a service account key of your own is there for SLOs written in Cloud Monitoring's own filter language.

Our service account (no key)

Your organisation has a service account of its own in our project, named slo-<organisation>@…iam.gserviceaccount.com. You let it read your project and nothing is stored anywhere: the card shows the account, with the command to grant it.

gcloud projects add-iam-policy-binding <project-id> \
  --member=serviceAccount:<the account on the card> \
  --role=roles/monitoring.viewer --condition=None

Or give it the Monitoring Viewer role under IAM in the Google Cloud console. Then press Test; a fresh grant can take a minute to take effect, and you can revoke it at any time.

A backend that reads as our service account measures SLOs written in PromQL, which is what new SLOs on Google Cloud Monitoring use anyway. An SLO you saved earlier with Cloud Monitoring filters (MQL) needs a key of your own, or a rewrite in PromQL.

A service account key (JSON)

  1. In the Google Cloud console, open IAM & Admin → Service accounts in the project that holds the metrics and create a service account, for example agile-analytics-slo.
  2. Give it the Monitoring Viewer role on the project. Nothing else is needed; Agile Analytics only reads.
  3. Open the account, go to Keys → Add key → Create new key, choose JSON and download the file.

2. Add the data source

  1. In Agile Analytics, go to Settings → Error Budgets, press Add Data Source and choose Google Cloud Monitoring.
  2. Give it a name and enter the Project ID (Cloud console → the project's dashboard, or Manage resources). Under Access, pick Our service account (no key) and grant it as above, or Service account key (JSON) and upload the file.
  3. Press Test to check the credentials, then Save.

settings-05-error-budgets

3. Add services and SLOs

Continue on the Error budgets page: Error budgets. You can:

  • Import SLOs that already exist in Cloud Monitoring. Choose Import from GCP when you add an SLO. The Monitoring Viewer role from step 1 is enough to list and read them. See Importing SLOs from Google Cloud or AWS.
  • Define SLOs in Agile Analytics with filters in Cloud Monitoring's filter syntax. Examples are on that page.

Replacing the key

Upload a new JSON on the existing card and press Update backend. All SLOs on this data source use the new key from the next measurement. You can also switch Access to our service account and drop the key altogether, as long as the SLOs on it are written in PromQL.