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

[#165] Add cachecheck logging #166

Merged
merged 2 commits into from
Nov 20, 2023
Merged

Conversation

matthewhilton
Copy link
Contributor

@matthewhilton matthewhilton commented Nov 17, 2023

Closes #165
Closes #168

Changes:

  • 2 new events:
    • cache_check: whenever the cachecheck check api is run.
    • cache_ping: whenever a new value is written to the cache
  • Each one records details e.g. what the cached value was, what the db value was, and for cache_ping, what the value it just wrote to the cache was. It also logs more data e.g. site identifier and session redis prefix so it might be obvious if these are broken or not correct to the site.
  • Settings to turn each of these on / off since they are debugging tools so don't always need to be turned on.
  • Also a tiny bugfix for cachecheck cron to only run once every 8 hrs, instead of every min in the 8th hr

I'm still a bit undecided whether site identifier or session redis prexis is useful. For e.g. if you had a cache issue such as another site (site B) using the same prefix, these logs would be written on Site Bs logs but would have Site A's prefix. But if you only knew about site A, you would have no idea how to find site B.

Since event logs are logged, it could be possible to work this out if you grepped across all the site logs for a particular prefix and see what sites are putting those cachecheck/ping logs out.

TODO after merging:

Pull request checks

  • I have checked the version numbers are correct as per the README

@matthewhilton matthewhilton force-pushed the cachecheck-logging-master branch 2 times, most recently from 574c46f to 9094163 Compare November 19, 2023 22:32
classes/lib.php Outdated Show resolved Hide resolved
classes/lib.php Outdated Show resolved Hide resolved
@matthewhilton matthewhilton force-pushed the cachecheck-logging-master branch from b88e0df to f868be4 Compare November 20, 2023 04:12
@matthewhilton
Copy link
Contributor Author

matthewhilton commented Nov 20, 2023

FYI I also added a new part to the log where after it sets the cache, it immediately reads it back and logs this as well. This should help detect cache replication delays

@matthewhilton matthewhilton force-pushed the cachecheck-logging-master branch from f868be4 to 69cb2dc Compare November 20, 2023 04:24
@matthewhilton matthewhilton force-pushed the cachecheck-logging-master branch from 69cb2dc to 67b69ff Compare November 20, 2023 05:35
@brendanheywood brendanheywood enabled auto-merge (rebase) November 20, 2023 05:38
@brendanheywood brendanheywood merged commit 62275d2 into master Nov 20, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants