Managing GPU metrics

GPU metrics define how GPU usage is recorded and exposed through the metering system for billing and reporting.

When you create or modify a GPU metric, it is saved as a draft. To make your metrics available for metering, you need to pass their configuration to Ceilometer by applying pending changes.

Limitations

  • Metric names must be unique. The metric name format is gpu.<name>, where <name> contains only letters (a-z, A-Z), numbers (0-9), dots (.), and underscores (_). For example: gpu.l40s, gpu.nvidia_232, or gpu.t4.

Prerequisites

To create a GPU metric

Admin panel

  1. Go to the Compute > Billing metering screen.
  2. Click Add metric.
  3. In the Add metric window, specify a metric name and select GPU aliases.

  4. Click Add. The metric is created in the draft state.
  5. On the Billing metering screen, click Apply.

Command-line interface

Use the following command:

vinfra service compute gpu-metric create --metric-name <metric-name> [--aliases <alias>] [--status <status>]
--metric-name <metric-name>
Metric name (e.g., gpu.t4, gpu.h200)
--aliases <alias>
Comma-separated alias names to associate with this metric (e.g., teslaT4, nvidia-224)
--status <status>
Metric status (default: active)

For example, to create the GPU metric gpu.nvidia_319 with the alias nvidia-319, run:

# vinfra service compute gpu-metric create --metric-name gpu.nvidia_319 --aliases nvidia-319

The metric is created in the draft state. To apply the pending changes, run:

# vinfra service compute gpu-metric apply

You can check that the metric is successfully created in the vinfra service compute gpu-metric list output:

# vinfra service compute gpu-metric list
+---------------+----------------+--------+-----------+--------------------------------------------+
| id            | metric_name    | status | state     | aliases                                    |
+---------------+----------------+--------+-----------+--------------------------------------------+
| 81e31f00<...> | gpu.nvidia_319 | active | unchanged | - id: 9ce13ad6-f9e7-44c1-9d27-5106868b4bfe |
|               |                |        |           |   name: nvidia-319                         |
|               |                |        |           |   nodes:                                   |
|               |                |        |           |   - 78a80b1a-dd17-4637-88f8-ab0d1af4db0c   |
|               |                |        |           |   - bcedcef0-88bd-442e-8d1d-8aa376e0aa0c   |
+---------------+----------------+--------+-----------+--------------------------------------------+

To edit a GPU metric

Admin panel

  1. On the Compute > Billing metering screen, click the required metric.
  2. On the metric right pane, click Edit metric.
  3. Change the metric name or GPU aliases and click Save. The updated metric is saved in the draft state.
  4. On the Billing metering screen, click Apply.

Command-line interface

Use the following command:

vinfra service compute gpu-metric update [--metric-name <metric-name>] [--aliases <alias>] <metric-id>
--metric-name <metric-name>
New metric name
--aliases <alias>
Comma-separated alias names to associate with this metric (replaces existing values; e.g., teslaT4, nvidia-224)
<metric-id>
Metric ID

For example, to change the alias of the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2 to gpu, run:

# vinfra service compute gpu-metric update --aliases gpu 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2

The updated metric is saved in the draft state. To apply the pending changes, run:

# vinfra service compute gpu-metric apply

To enable or disable a metric

Admin panel

  1. On the Compute > Billing metering screen, click the required metric.
  2. On the metric right pane, click Enable or Disable. The updated metric is saved in the draft state.
  3. On the Billing metering screen, click Apply.

Command-line interface

Use the following command:

vinfra service compute gpu-metric update [--status <status>] <metric-id>
--status <status>
Metric status (active or disabled)
<metric-id>
Metric ID

For example, to diable the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2, run:

# vinfra service compute gpu-metric update --status disabled

The updated metric is saved in the draft state. To apply the pending changes, run:

# vinfra service compute gpu-metric apply

To delete a GPU metric

Admin panel

  1. On the Compute > Billing metering screen, click the required metric.
  2. On the metric right pane, click Delete.
  3. In the confirmation window, click Confirm. The marked metric is saved in the draft state.
  4. On the Billing metering screen, click Apply.

Command-line interface

Use the following command:

vinfra service compute gpu-metric delete <metric-id>
<metric-id>
Metric ID

For example, to mark the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2 for deletion, run:

# vinfra service compute gpu-metric delete 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2

The marked metric is saved in the draft state. To apply the pending changes, run:

# vinfra service compute gpu-metric apply

To discard pending changes

Admin panel

  1. On the Compute > Billing metering screen, click Discard.
  2. In the confirmation window, click Discard.

Command-line interface

Use the following command:

vinfra service compute gpu-metric discard <metric-id>
<metric-id>
Metric ID (if not provided, all pending changes are discarded)

For example, to discard changes to the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2, run:

# vinfra service compute gpu-metric discard 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2
+----------------+-------+
| Field          | Value |
+----------------+-------+
| deleted_count  | 0     |
| reverted_count | 1     |
+----------------+-------+