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

Add methods for the persistent cache Agent interface #6819

Merged
merged 1 commit into from
Jun 4, 2020
Merged

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Jun 4, 2020

Motivation

About to use it and realized the interface could be simplified since you'd want to utilize the unique check ID in all cases

def update_bookmark(self, event):
# See https://docs.microsoft.com/en-us/windows/win32/wes/bookmarking-events
# https://docs.microsoft.com/en-us/windows/win32/api/winevt/nf-winevt-evtupdatebookmark
# http://timgolden.me.uk/pywin32-docs/win32evtlog__EvtUpdateBookmark_meth.html
win32evtlog.EvtUpdateBookmark(self._bookmark_handle, event)
# https://docs.microsoft.com/en-us/windows/win32/api/winevt/nf-winevt-evtrender
# http://timgolden.me.uk/pywin32-docs/win32evtlog__EvtRender_meth.html
bookmark_xml = win32evtlog.EvtRender(self._bookmark_handle, win32evtlog.EvtRenderBookmark)
self.write_persistent_cache('bookmark', bookmark_xml)

@codecov
Copy link

codecov bot commented Jun 4, 2020

Codecov Report

Merging #6819 into master will increase coverage by 3.52%.
The diff coverage is n/a.

Impacted Files Coverage Δ
disk/tests/common.py 64.28% <0.00%> (-35.72%) ⬇️
disk/tests/conftest.py 85.71% <0.00%> (-11.43%) ⬇️
disk/datadog_checks/disk/disk.py 82.80% <0.00%> (-3.61%) ⬇️
disk/tests/test_filter.py 96.45% <0.00%> (-3.55%) ⬇️
dns_check/datadog_checks/dns_check/dns_check.py 86.45% <0.00%> (-2.09%) ⬇️
...cks_base/datadog_checks/base/utils/agent/common.py
postgres/tests/test_relations.py
...tadog_checks_base/datadog_checks/base/stubs/log.py
mcache/tests/metrics.py
envoy/datadog_checks/envoy/envoy.py
... and 635 more

Copy link
Contributor

@therve therve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks fine, though I only use it with the check ID for SNMP, wondering if we could make the key optional.

@ofek
Copy link
Contributor Author

ofek commented Jun 4, 2020

I think the key is a good way to not dump everything in a json blob

@ofek ofek merged commit 3f4d637 into master Jun 4, 2020
@ofek ofek deleted the ofek/cache branch June 4, 2020 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants