-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 new implementation #5251
Conversation
dc51c68
to
2e1e520
Compare
Codecov Report
|
c2460dc
to
bc27a62
Compare
Codecov Report
|
c187963
to
ff82e48
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.
So great! Amazing docs too 👍
if not self.ssl_verify: | ||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) | ||
context.verify_mode = ssl.CERT_NONE | ||
elif self.ssl_capath: | ||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) | ||
context.verify_mode = ssl.CERT_REQUIRED | ||
context.load_verify_locations(capath=self.ssl_capath) | ||
|
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.
Try to copy what you can from
integrations-core/vertica/datadog_checks/vertica/vertica.py
Lines 569 to 590 in 018422d
if self._tls_verify: # no cov | |
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext | |
# https://docs.python.org/3/library/ssl.html#ssl.PROTOCOL_TLS | |
tls_context = ssl.SSLContext(protocol=PROTOCOL_TLS_CLIENT) | |
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext.verify_mode | |
tls_context.verify_mode = ssl.CERT_REQUIRED | |
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext.check_hostname | |
tls_context.check_hostname = self._validate_hostname | |
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_verify_locations | |
if self._cafile or self._capath: | |
tls_context.load_verify_locations(self._cafile, self._capath, None) | |
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_default_certs | |
else: | |
tls_context.load_default_certs(ssl.Purpose.SERVER_AUTH) | |
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_cert_chain | |
if self._cert: | |
tls_context.load_cert_chain(self._cert, keyfile=self._private_key) |
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 that's something we do over and over. Can we extract that as a reusable util? (Probably in another PR)
Clean up config options Add dependency Re-implement excluded_host_tags work Fix tests Fetch remaining metrics Clean-up Fix dependencies fix style [review] max_query_metrics exception [review] Document self._conn.content type [review] Address minor comments
388d977
to
bcd4714
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.
(Part 1)
Still need to review few more things :)
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.
(Part 2/2)
Let me know if some comments are not clear :)
Question: Should ressource_filters expect metrics to be prefixed with EDIT: Added documentation and leaving it as is |
Question2: Should we allow |
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.
Awesome looks good to me.
A PR desc of what changed and motivation for this refactoring can help.
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.
💯
mor_type = type(mor) | ||
if mor_type not in self._content: | ||
self._content[mor_type] = {} | ||
self._content[mor_type][mor] = mor_data |
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.
Can we use something else than a MOR object as cache key for self._content[mor_type][mor]
?
Maybe use a "MOR Id".
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 looked into pyvmomi code https://github.com/vmware/pyvmomi/blob/master/pyVmomi/VmomiSupport.py#L596-L610.
What this means is that is it safe to use the mor directly as the cache key, the string representation of it should be unique so there should be no hash collision, and even in case of the same string for two different mors, the __eq__
method should prevent collisions.
So another possibility would be to use str(mor)
as the cache key, but note that we would lose a bit in case two mors have the same string representation. Note also that the str
method can be quite complex in regard of the very simple __hash__
and __eq__
methods.
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.
Awesome 👍
Re-implementing the vSphere integration for multiple reasons:
Missing parts that will come in separate PRs:
vsphere.cpu.usage
can be tagged withinstance:%d
where the integer is the CPU core identifier). For now we do not collect those as it is expensive but we should add the option to collect them. Will be in a separate PR.Major things to look for:
Note: Because we moved the legacy
vsphere.py
file tovsphere_legacy.py
and because the new implementation also has to be namedvsphere.py
, git tries to show a diff between the two implementation which is a bit confusing. You can look the latest version of thevsphere.py
file just hereNote2: The integration is running against our lab in our
dddev
environment.Note3: I haven't checked yet if metadata.csv is up to date but in theory it should.
Note4: Don't mind the number of lines, most of it is either big fixture files or just moving the legacy code somewhere else.