-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 cache.ttl to add_host_metadata #9359
Conversation
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.
LGTM. But it needs a CHANGELOG entry.
} | ||
|
||
data := host.MapHostInfo(p.info) |
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.
IIUC the problem was here b/c it never fetched updated info
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.
Correct
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.
Code LGTM. See comment Andrew.
I added |
I've added two changelog entries (one under Bugfix, one under Added) - let me know if it's good to merge please. |
Fix: Refresh host info when cache expires. Add config parameter `cache.ttl` to control cache expiration (default 5m). (cherry picked from commit 30dfa05)
Fix: Refresh host info when cache expires. Add config parameter `cache.ttl` to control cache expiration (default 5m). (cherry picked from commit 30dfa05)
Despite what is says in the documentation (
NOTE: The host information is refreshed every 5 minutes.
) theadd_host_metadata
processor does not actually ever refresh most of its information (it does the IPs and MACs ifnetinfo.enabled: true
, but not the base host info).This PR changes it to call
sysinfo.Host()
every time its cache expires.It also adds a
cache.ttl
parameter to configure how often that happens. The default stays at5m
, and negative values disable caching altogether (most likely at some cost to performance).I did not add the new config parameter to all the
*beat.reference.yml
files - I noticed they didn't contain everything (e.g.add_kubernetes_metadata
) and I think this parameter is not something most users need to configure. Happy to put it in though if it makes sense.