Skip to content
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

Merged
merged 1 commit into from
Jan 8, 2016

Conversation

JohnLZeller
Copy link
Contributor

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

@JohnLZeller
Copy link
Contributor Author

This has yet to be tested, but I'd love some feedback.

@JohnLZeller
Copy link
Contributor Author

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':
Copy link
Member

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....

Copy link
Contributor Author

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

Copy link
Contributor Author

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 :)

@JohnLZeller JohnLZeller force-pushed the zeller/vsphere-metrics branch from 533eee2 to de84b5d Compare January 7, 2016 22:23
@JohnLZeller JohnLZeller force-pushed the zeller/vsphere-metrics branch from de84b5d to d513e43 Compare January 7, 2016 22:23
@JohnLZeller
Copy link
Contributor Author

@truthbk okay can you give this another look?

@truthbk
Copy link
Member

truthbk commented Jan 7, 2016

This looks good now! 👍

JohnLZeller added a commit that referenced this pull request Jan 8, 2016
[vsphere] Check metric type first to determine how to report
@JohnLZeller JohnLZeller merged commit 1fe4d7c into master Jan 8, 2016
@JohnLZeller JohnLZeller deleted the zeller/vsphere-metrics branch January 8, 2016 03:55
@olivielpeau olivielpeau modified the milestones: 5.7.0, 5.8.0 Feb 5, 2016
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.

4 participants