-
Notifications
You must be signed in to change notification settings - Fork 194
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
use a better heuristic for the apt update last run time #184
use a better heuristic for the apt update last run time #184
Conversation
@julian-klode could you review this? I think it covers the comments you made in #182... |
If |
On 2023-10-17 07:50:27, Jerome Charaoui wrote:
If `APT::Periodic` is used at some point, and then disabled, wouldn't this report a false metric if `apt` is updated in another manner?
If it's disabled, the code won't check that timestamp file, unless I got
this wrong.
|
88a2d30
to
598c352
Compare
Right, my bad! |
I think you want to use get_b or what it's called in the config object that returns a boolean so that it parses everything correctly. |
It's a boolean? That wasn't quite clear to me, reading the documentation... I thought it could be a time delta (e.g. |
@julian-klode you mean |
Yes indeed, find_b sorry. Wasn't on my laptop so didn't look it up :) |
As reported in prometheus-community#182, `pkgcache.bin` gets updated on more than just `apt update`. In particular, it gets modified when a package is installed, upgraded or removed. So let's fallback on a better heuristic, which is the `APT::Periodic` timestamp. This should give us a much more precise and deliberate status. We also fallback to the `lists` directory, which gets updated when new mirror lists gets moved into place. This does run the risk of staying silently unchanged if there's no change on mirrors but (a) that's rather infrequent and (b) we might actually want to warn on that anyway. Signed-off-by: Antoine Beaupré <[email protected]> Closes: prometheus-community#183
598c352
to
feb943f
Compare
thanks, fixed. |
As reported in #182,
pkgcache.bin
gets updated on more than justapt update
. In particular, it gets modified when a package is installed, upgraded or removed.So let's fallback on a better heuristic, which is the
APT::Periodic
timestamp. This should give us a much more precise and deliberate status.We also fallback to the
lists
directory, which gets updated when new mirror lists gets moved into place. This does run the risk of staying silently unchanged if there's no change on mirrors but (a) that's rather infrequent and (b) we might actually want to warn on that anyway.Closes: #183