Query billing metrics

To query and visualize billing metrics, use the Billing Usage and Projected Cost dashboards.

These dashboards provide visualizations on the following billing related metrics:

  • server_org_count
  • kube_namespace_resource_usage
  • pod:kube_pod_container_resource_requests:sum
  • metering_storage_organization_allocated_capacity_bytes
  • metering_storage_allocated_capacity_bytes
  • metering_gdcbackup_protected_pods_count
  • metering_gdcbackup_protected_vms_count
  • ai_vision_usage
  • ai_speech_audio_length_sum
  • ai_translation_usage_codepoints

Through these dashboards, you can filter the metric values by namespace, project name, or billing account ID.

Before you begin

Before accessing the Billing reports page, request the required Grafana Viewer role from your IAM Org Admin:

  • Organization: Request the Organization Grafana Viewer (organization-grafana-viewer) role.
  • Project: Request the Project Grafana Viewer (project-grafana-viewer) role for your project.

Filter namespace metric values

  • To filter metric values by labels on namespaces, perform the following query in the Explore page of the monitoring instance:
  sum by (label_CONVERTED_LABEL_NAME) (METRIC_NAME{} * on (cluster, namespace) group_left(label_CONVERTED_LABEL_NAME) kube_namespace_labels{label_CONVERTED_LABEL_NAME="LABEL_VALUE"})

Replace the following variables:

  • CONVERTED_LABEL_NAME: the label key to filter metric values. Replace all non-alphabetic characters in this label with the underscore _. For example: app.kubernetes.io/component becomes app_kubernetes_io_component.
  • METRIC_NAME: the name of the billing-related metrics.
  • LABEL_VALUE: the label value to filter metrics.

Filter pod metric values

  • To filter metric values by labels on pods, perform the following query in the Explore page of the monitoring instance:
  sum by (label_CONVERTED_LABEL_NAME) (METRIC_NAME{} * on (cluster, namespace, pod) group_left(label_CONVERTED_LABEL_NAME) kube_pod_labels{label_CONVERTED_LABEL_NAME="LABEL_VALUE"})