import { css } from '@emotion/css'; import React, { PureComponent } from 'react'; import { QueryEditorHelpProps } from '@grafana/data'; import { CloudMonitoringQuery } from '../types'; export default class CloudMonitoringCheatSheet extends PureComponent< QueryEditorHelpProps, { userExamples: string[] } > { render() { return (

Cloud Monitoring alias patterns

Format the legend keys any way you want by using alias patterns. Format the legend keys any way you want by using alias patterns.

Example: {`${'{{metric.name}} - {{metric.label.instance_name}}'}`}
Result:   cpu/usage_time - server1-europe-west-1


  • {`${'{{metric.type}}'}`} = metric type e.g. compute.googleapis.com/instance/cpu/usage_time
  • {`${'{{metric.name}}'}`} = name part of metric e.g. instance/cpu/usage_time
  • {`${'{{metric.service}}'}`} = service part of metric e.g. compute
  • {`${'{{metric.label.label_name}}'}`} = Metric label metadata e.g. metric.label.instance_name
  • {`${'{{resource.label.label_name}}'}`} = Resource label metadata e.g. resource.label.zone
  • {`${'{{metadata.system_labels.name}}'}`} = Meta data system labels e.g. metadata.system_labels.name. For this to work, the needs to be included in the group by
  • {`${'{{metadata.user_labels.name}}'}`} = Meta data user labels e.g. metadata.user_labels.name. For this to work, the needs to be included in the group by
  • {`${'{{bucket}}'}`} = bucket boundary for distribution metrics when using a heatmap in Grafana
  • {`${'{{project}}'}`} = The project name that was specified in the query editor
  • {`${'{{service}}'}`} = The service id that was specified in the SLO query editor
  • {`${'{{slo}}'}`} = The SLO id that was specified in the SLO query editor
  • {`${'{{selector}}'}`} = The Selector function that was specified in the SLO query editor
); } }