Skip to content

fix(cinder): deduplicate volume inventory metrics - #1

Open
davidhulick wants to merge 1 commit into
mainfrom
contrib/cinder-inventory-2b1
Open

davidhulick wants to merge 1 commit into
mainfrom
contrib/cinder-inventory-2b1

Conversation

@davidhulick

Copy link
Copy Markdown

Summary

Fix duplicate Cinder volume inventory metrics caused by attachment joins returning multiple rows for the same logical volume.

The collector now:

  • Emits volume capacity and status metrics once per unique volume ID.
  • Aggregates distinct, nonempty server IDs into a deterministic, sorted label value.
  • Counts logical volumes and their statuses once, regardless of attachment multiplicity.
  • Preserves existing metric names, types, label keys, and GiB units.

No database queries, dependencies, or unrelated collectors are changed. The fix works with the existing public openstackdb v0.2.1.

Related upstream work

This change is related to [VEXXHOST PR #110](vexxhost#110), which also addresses potential duplicate Cinder volume metrics.

This PR specifically addresses duplication at the collector level. Even with SQL-side attachment filtering, legitimate multi-attach volumes can produce multiple rows for one logical volume, so collector-side deduplication remains useful.

The approaches may be complementary. We are explicitly acknowledging the overlap and welcome coordination on the preferred upstream solution.

Database query changes are intentionally outside this PR's scope and belong in openstackdb.

Compatibility

For multi-attached volumes, the existing server_id label now contains a sorted, comma-separated list of distinct server IDs instead of producing separate samples for each attachment.

For example, server_id="A,B" replaces separate samples labeled server_id="A" and server_id="B".

Consumers matching individual server IDs must account for this behavior change.

Other metric names, types, label keys, and capacity units remain unchanged.

Group attachment rows by volume ID for inventory and status counts. Retain distinct nonempty server IDs in sorted order while preserving GiB capacity and existing labels.

Cover duplicate and reordered attachments with pedantic gathering and repeated HTTP exposition alongside Heat metrics.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
@davidhulick davidhulick reopened this Nov 18, 2026
@davidhulick davidhulick changed the title fix(cinder): emit volume inventory once per volume fix(cinder): deduplicate volume inventory metrics Nov 20, 2026
@davidhulick

Copy link
Copy Markdown
Author

Contribution relationship

Standalone change — targets main.

This PR fixes duplicate Cinder volume inventory metrics independently of the quota-monitoring contributions. It uses the existing released openstackdb APIs and does not require another exporter PR.

Related work:

This fix 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