-
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
Ensure kubernetes caches don't expire if they are being read #10946
Ensure kubernetes caches don't expire if they are being read #10946
Conversation
1902871
to
c36d589
Compare
c36d589
to
1f26a33
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.
I know it's a WIP. Just left some comments if they help.
I have been testing this with master and 6.6.1 and it seems to work. As caches are now, #10658 can still happen if period of container metricset is greater than 120 seconds, fixing this would require to further refactor the global cache. I leave this for future improvements (#10965) as I don't think many people will have these periods. A quick "fix" would be to increase the default timeout. |
It only quickly peaked at the cache, but it looks similar to libbeat/common/cache.go (godoc) which expires elements based on their last access time, has a goroutine to periodically do cleanup, and allows injecting a clock for testing (but injecting the clock isn't exported so you'd need to expose this). |
@andrewkroh oh, this actually looks like what we'd need here, I will give a try to this implementation, thanks! |
8481def
to
304bec5
Compare
|
||
// Check it expired | ||
assert.Equal(t, 0.0, test.Get("foo")) | ||
} |
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.
Test removed because libbeat cache implementation is used now and it has its own tests for this.
…#10946) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix elastic#10658 (cherry picked from commit 106df3d)
…#10946) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix elastic#10658 (cherry picked from commit 106df3d)
…#10946) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix elastic#10658 (cherry picked from commit 106df3d)
…#10946) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix elastic#10658 (cherry picked from commit 106df3d)
…#11057) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix #10658 (cherry picked from commit 106df3d)
…#11058) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix #10658 (cherry picked from commit 106df3d)
…#11059) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix #10658 (cherry picked from commit 106df3d)
…#11060) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix #10658 (cherry picked from commit 106df3d)
…#10946) (elastic#11059) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix elastic#10658 (cherry picked from commit db4b4c2)
…#10946) (elastic#11060) Some metrics in metricbeat kubernetes module are cached during a time, if they are not updated they are removed. But it is usual to have pods or containers that are not updated during more time that the expiration cache. Current implementation was not renovating expiration times for cache entries so all were eventually removed if updates for them are not received. Replace it with the cache implementation available in libbeat, but keeping the existing interface. Also, use slashes instead of dashes to generate unique container uids. Dashes can be used by kubernetes names, what could lead to ambiguous keys for the caches. Fix elastic#10658 (cherry picked from commit db4b4c2)
Some metrics in metricbeat kubernetes module are cached during a time,
if they are not updated they are removed. But it is usual to have pods or
containers that are not updated during more time that the expiration cache.
Current implementation was not renovating expiration times for cache
entries so all were eventually removed if updates for them are not received.
Replace it with the cache implementation available in libbeat, but keeping
the existing interface.
Also, use slashes instead of dashes to generate unique container uids.
Dashes can be used by kubernetes names, what could lead to ambiguous
keys for the caches.
Fix #10658