To query and visualize billing metrics, use the
[Billing Usage](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/platform/pa-user/billing/track-resource-consumption.md.txt)
and
[Projected Cost](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/platform/pa-user/billing/estimate-projected-costs.md.txt)
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:

- <var translate="no">CONVERTED_LABEL_NAME</var>: 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`.
- <var translate="no">METRIC_NAME</var>: the name of the billing-related metrics.
- <var translate="no">LABEL_VALUE</var>: 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"})