-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[receiver/vcenter] Adds vCenter VM CPU readiness metric #33608
[receiver/vcenter] Adds vCenter VM CPU readiness metric #33608
Conversation
6c99f2f
to
f4a517e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BominRahmani Overall looks OK. Have a few questions though. Also think it needs an integration test update.
receiver/vcenterreceiver/testdata/metrics/expected-all-enabled.yaml
Outdated
Show resolved
Hide resolved
9a14bb3
to
2d172a6
Compare
receiver/vcenterreceiver/metrics.go
Outdated
|
||
// OverallCpuReadiness is only available in vSphere API 7.0 | ||
// https://vdc-repo.vmware.com/vmwb-repository/dcr-public/d1902b0e-d479-46bf-8ac9-cee0e31e8ec0/07ce8dbd-db48-4261-9b8f-c6d3ad8ba472/vim.vm.Summary.QuickStats.html | ||
vsphereAPIVersion, err := version.NewVersion(v.scrapeData.apiVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth on whether I was going to comment more on this or just leave it be.
It seems like this logic could be moved to a new function (or maybe even to the client as a helper function). The client could be reworked to have a private method like "refreshVsphereAPIVersion" which stores its own version. We could make sure we call this once a collection (or on client initialization). Then we could have another method vsphereAPIVersionMeetsMin(minVsphereAPIVersion string) bool
that would be used here where you just pass in "7.0.0". It could do all this logic (making use of the stored version (possibly calling refresh
if it's empty) and then return a true/false for the conditional for lines 158/159. This would be reusable for other cases too.
Ultimately I think I'm fine with it as is, just thinking that it feels a little out of place here and would likely be better placed elsewhere. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a good idea, there may be more of these metrics that require a check on the API in the future. I'll look into changing it up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will be a great add-on, Readiness is the most important CPU metric for a VM. I had started to worked on a PR to add it, glad I checked here again!
For the documentation you refer to, maybe we can use the one hosted by Broadcom as it will be updated there: https://developer.broadcom.com/xapis/virtual-infrastructure-json-api/latest/data-structures/VirtualMachineQuickStats/
The API version requirement (7.0.0) for overallCpuReadiness
is not in it, not sure why, as there are other recommendations. Same for grantedMemory
.
The others metrics that required a recent API version are not used in the receiver yet:
activeMemory
memoryTierStats
But we could probably add them at some point, especially grantedMemory
, so good idea @StefanKurek for the private method.
I can check the other requirements for Host, Cluster and Datastore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlg-io That JSON API is a totally different (and would require major changes to the vcenterreceiver) from how we're currently collecting. In addition, it looks like it's only been available since vCenter 8.0+. I do agree that a note in the README would be a good add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StefanKurek, my bad! I guess the right one is there: https://dp-downloads.broadcom.com/api-content/apis/API_VMA_001/8.0U2/html/vim.vm.Summary.QuickStats.html
It has been updated more recently than the one on VMware website, so I guess it will be the reference for the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll add in a section in the readme and also update the link in the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Maybe we could update vcenterreceiver/README.md
to either drop support for 6.7
or add a comment that overallCpuReadiness
won't work with this version?
receiver/vcenterreceiver/metrics.go
Outdated
|
||
// OverallCpuReadiness is only available in vSphere API 7.0 | ||
// https://vdc-repo.vmware.com/vmwb-repository/dcr-public/d1902b0e-d479-46bf-8ac9-cee0e31e8ec0/07ce8dbd-db48-4261-9b8f-c6d3ad8ba472/vim.vm.Summary.QuickStats.html | ||
vsphereAPIVersion, err := version.NewVersion(v.scrapeData.apiVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will be a great add-on, Readiness is the most important CPU metric for a VM. I had started to worked on a PR to add it, glad I checked here again!
For the documentation you refer to, maybe we can use the one hosted by Broadcom as it will be updated there: https://developer.broadcom.com/xapis/virtual-infrastructure-json-api/latest/data-structures/VirtualMachineQuickStats/
The API version requirement (7.0.0) for overallCpuReadiness
is not in it, not sure why, as there are other recommendations. Same for grantedMemory
.
The others metrics that required a recent API version are not used in the receiver yet:
activeMemory
memoryTierStats
But we could probably add them at some point, especially grantedMemory
, so good idea @StefanKurek for the private method.
I can check the other requirements for Host, Cluster and Datastore.
c65c735
to
6de60f2
Compare
55d2863
to
c742018
Compare
c7ca22d
to
3430d83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough to move out of Draft form. Thanks!
receiver/vcenterreceiver/client.go
Outdated
@@ -74,6 +76,7 @@ func (vc *vcenterClient) EnsureConnection(ctx context.Context) error { | |||
vc.finder = find.NewFinder(vc.vimDriver) | |||
vc.pm = performance.NewManager(vc.vimDriver) | |||
vc.vm = view.NewManager(vc.vimDriver) | |||
vc.apiVersion = vc.getVsphereAPIVersion() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we drop support for 6.7 we don't need this check. Perhaps there is a reasonable way to fail gracefully if the server does not support the new metric?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just drop support for 6.7 in this case. The problem with this metric is it doesn't really fail, rather it returns 0 if the server doesn't support the metric, but 0 in of itself is a valid value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As 6.7 is "End of General Support" since October 15, 2022 (https://core.vmware.com/blog/reminder-vsphere-6567-end-general-support), it would make sense to drop the support here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djaglowski To drop support for a version do we need to make a new pr / add warnings anywhere? or are we allowed to just remove it from the readme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BominRahmani, a separate PR would be ideal but I think it's ok to do here as long as there's a separate changelog entry for it. You can just add a second changelog yaml file and note it there.
c39b81d
to
d77a71e
Compare
Description:
This PR adds the
vcenter.vm.cpu.readiness
metric.More information on this metric can be found here.
Link to tracking Issue: #33607
Testing:
The metric was scraped from a test vCenter environment, and golden test files were updated to reflect the addition of the metric.
Documentation:
Documentation was updated according to the metadata.yaml