feat(openmetrics): add VM status and uptime metrics#9684
Merged
Conversation
9f65f58 to
19a8d3f
Compare
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
spacotte-vates
approved these changes
Apr 13, 2026
Collaborator
spacotte-vates
left a comment
There was a problem hiding this comment.
The PR description says that xcp_vm_uptime_seconds should have a power_state label but it's missing. Since the label would always be "Running" I think you can just remove it from the description.
Otherwise looks solid.
19a8d3f to
265ce57
Compare
b-Nollet
requested changes
Apr 20, 2026
b-Nollet
approved these changes
Apr 20, 2026
Collaborator
b-Nollet
left a comment
There was a problem hiding this comment.
LGTM, you can rebase and merge
d3855ce to
e8961b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add VM status and uptime metrics to the OpenMetrics/Prometheus endpoint.
Two new gauge metrics are exposed:
xcp_vm_statuspower_statelabel (Running,Paused,Halted,Suspended)xcp_vm_uptime_secondsLabels for
xcp_vm_status:pool_id,uuid,power_state, and optionallypool_name,vm_name.Labels for
xcp_vm_uptime_seconds:pool_id,uuid, and optionallypool_name,vm_name.The implementation follows the existing host status/uptime patterns:
VmStatusItemviaGET_VM_STATUS/VM_STATUS), ensuring all VMs are included regardless of RRD data availabilityLabelContextenrichment (VmLabelInfowithstartTime,power_state,pool_id,pool_name), only emitted for running VMs to avoid stalestartTimeon halted/suspended VMsVM-controllers (dom0) are excluded from both metrics.
Tested on XOA with real infrastructure — both metrics correctly exposed on
/metricsendpoint.Fixes XO-1993
Checklist
Fixes XO-1993)Introduced byCHANGELOG.unreleased.mdReview process
If you are an external contributor, you can skip this part. Simply create the pull request, and we'll get back to you as soon as possible.
Notes: