Skip to content

fix(nova): report capacity metrics in bytes - #2

Open
davidhulick wants to merge 1 commit into
mainfrom
contrib/nova-bytes-2b2
Open

davidhulick wants to merge 1 commit into
mainfrom
contrib/nova-bytes-2b2

Conversation

@davidhulick

Copy link
Copy Markdown

Summary

Convert four existing Nova capacity metrics from MiB/GiB to bytes, following Prometheus metric naming and exporter best practices.

Metric changes:

  • openstack_nova_quota_ram → openstack_nova_quota_ram_bytes (MiB × 2^20)
  • openstack_nova_limits_memory_max → openstack_nova_limits_memory_max_bytes (MiB × 2^20)
  • openstack_nova_limits_memory_used → openstack_nova_limits_memory_used_bytes (MiB × 2^20)
  • openstack_nova_server_local_gb → openstack_nova_server_local_bytes (GiB × 2^30)

Motivation

The official Prometheus metric naming best practices recommend base units such as bytes rather than megabytes or gigabytes, with explicit unit suffixes. The exporter guidelines likewise recommend exposing base units and leaving human-readable conversions to visualization tools.

This PR deliberately addresses Nova first because these conversions are self-contained and require no new database APIs or accounting changes.

The remaining Cinder and Manila capacity metrics are planned for conversion alongside their respective quota and inventory improvements. Those changes affect collector behavior and dependencies, so combining the conversions with them avoids modifying legacy collectors twice.

This creates a temporary mixed-unit state during the migration but keeps each contribution independently reviewable while moving toward consistent byte-based metrics across the exporter.

Behavior and compatibility

  • Preserves -1 for unlimited quota and memory limits.
  • Scales usage and inventory values, including negative values, after conversion to floating point.
  • Preserves existing metric labels and accounting semantics.
  • Keeps Nova RAM usage Placement-derived and reservations at zero.
  • Reports root disk capacity only, excluding ephemeral disk.
  • Preserves Nova task-state, status, CPU, count, health, and unrelated metrics.
  • Requires no SQL or dependency changes; continues using public openstackdb v0.2.1.

Breaking metric changes

The four old metric families are removed without aliases.

PromQL queries, dashboards, alerts, recording rules, and allowlists must use the replacement names. Existing MiB/GiB-to-byte multipliers should be removed, and thresholds expressed in bytes.

Queries spanning the rollout may need to account for historical series using previous names and units. The README documents the migration.

Related upstream work

VEXXHOST PR #117 modifies Nova accounting, defaults, and label contracts but does not implement these four conversions.

This PR preserves the current upstream labels and does not incorporate vexxhost#117's unmerged changes. If both contributions are accepted, the later contribution will need to reconcile their label contracts.

Convert RAM quota and memory limits from MiB, and server root disk capacity from GiB, while preserving labels, unlimited limits and signed usage. Add capacity regression coverage and document the breaking metric migration.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
@davidhulick davidhulick changed the title fix: expose Nova capacity metrics in bytes fix(nova): report capacity metrics in bytes Nov 20, 2026
@davidhulick

Copy link
Copy Markdown
Author

Contribution relationship

Standalone change — targets main.

This PR converts existing Nova capacity metrics to Prometheus base units (bytes).

It does not depend on the other exporter contributions or any pending openstackdb APIs.

Related capacity conversions for Cinder and Manila are included separately in their respective service contributions:

Those contributions are not prerequisites for this fix. It can be reviewed and submitted upstream independently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant