Skip to content

GCP Filtered Metrics

The Google Cloud Platform let you gather a lot of useful metrics regarding your cloud assets, through the use of its Metrics Explorer. Our GCP Filtered Metrics connector allow you to build a custom query using this tool and export it back to SenHub to help exploit of the output metrics in your monitoring tool.

To use it, you must enable the monitoring API for your relevant Google Cloud Project. Google Stackdriver Monitoring API Follow the link, connect to your google cloud account, select your gcp project, and then click enable API. The api might already be enabled if you previously used the Metrics Explorer.

When it is done, you can begin to make your query using the Metrics Explorer tool from GCP. GCP Metrics Explorer Here is some reference from google to help you create your query. GCP Metrics Explorer Reference

We suggest that you narrow down your query as much as possible, using filters. This way the SenHub output can be more precise.

When it is done, you can export your graph using the JSON editor, which will download a JSON file. This file will be used to create your SenHub GCP Filtered metrics instance. Options

  • Name*: A simple label for easier identification in the SenHub interface.
  • Description: For your personal reference only.
  • Vault: Select the appropriate vault for this resource from the modal.
  • Group: optional — assign this instance to a group to organise it within SenHub.
  • Metrics Explorer JSON: The query that was exported from the Metrics Explorer.

Example output

The output channels are not fixed: for each series returned by your exported Metrics Explorer query, the connector emits one metric whose channel is the GCP metric's display name, its value is the most recent point, and its unit is taken from the GCP metric descriptor (a dimensionless GCP unit 1 becomes #). A simple query returns one metric per series:

{
  "metrics": [
    { "channel": "CPU utilization", "value": 42.5, "unit": "%" },
    { "channel": "Received bytes", "value": 1048576, "unit": "By" }
  ],
  "message": "Metrics successfully retrieved.",
  "status": "OK",
  "date": 1725981405127
}

A ratio query returns a single percentage metric whose channel combines the numerator and denominator display names, with value (numerator / denominator) * 100 and unit %:

{
  "metrics": [
    { "channel": "5xx response count / Response count", "value": 1.2, "unit": "%" }
  ],
  "message": "Metrics successfully retrieved.",
  "status": "OK",
  "date": 1725981405127
}

A boolean/status metric (a BOOL descriptor carrying a state label) is emitted only for the active state, with the state name as the value and no unit:

{
  "metrics": [
    { "channel": "Instance status", "value": "RUNNING" }
  ],
  "message": "Metrics successfully retrieved.",
  "status": "OK",
  "date": 1725981405127
}