-
Notifications
You must be signed in to change notification settings - Fork 814
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
[vsphere] Check metric type first to determine how to report #2115
Conversation
This has yet to be tested, but I'd love some feedback. |
After taking another look, I think this is correct. @truthbk could I get a r? |
self.gauge( | ||
|
||
# Most common metric types are absolute, delta, and rate | ||
if self.metrics_metadata[i_key][result.id.counterId]['s_type'] == 'rate': |
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 this might throw a KeyError
exception, from what I saw in the check the metadata object would only have name
, unit
and instance_tag
keys. And then the counter.key
key. Is that where you expected s_type
? I took a look at https://github.com/vmware/pyvmomi/blob/e26718fef6d9dbc8a4da1761b75d9da58bbc0daa/docs/vim/PerformanceManager/CounterInfo.rst and counter.key
I believe would be an integer....
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.
Hmmm, this is an older PR, I may have made a mistake here. Somehow I came to the conclusion that s_type
was present because of this https://github.com/DataDog/dd-agent/blob/zeller/vsphere-basic/checks/libs/vmware/basic_metrics.py
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.
You're absolutely right, name
, unit
and instance_tag
are the only keys there. I'll fix this pr :)
533eee2
to
de84b5d
Compare
de84b5d
to
d513e43
Compare
@truthbk okay can you give this another look? |
This looks good now! 👍 |
[vsphere] Check metric type first to determine how to report
Currently, all metrics from vsphere are reported as gauges. We should attempt to read the metric type from the VMware metrics module and call self.gauge or self.rate, etc. accordingly.
First came up in conversation with @LeoCavaille here: #1824