feat(openmetrics): add VM status and uptime metrics#9684
Open
feat(openmetrics): add VM status and uptime metrics#9684
Conversation
9f65f58 to
19a8d3f
Compare
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
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:
pool_id,uuid,power_state, 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: