-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Stats are missing from the homepage #10318
Comments
It may need a recache 🤔 or it may be related to #10206 (crons for stats seem to be running both on |
Stats like those should be showing on the openlibrary.org site not just local host |
I mean, I see those are under templates folder, and the inspect shows stats for local and then it doesn't for live so perhaps that could be a reason? Still looking at folders and files though. |
Hm that's interesting, I did not expect that to be the source of the issue. @RayBB @cdrini Could I be assigned this issue? The fix that I have off the top of my head would be something along the lines of
|
@schu96 assigned |
They now seem to be missing for me on localhost too |
@RayBB Are they still missing for you on localhost? I've had that happen to me after I left my dev environment on overnight. It seems like there are other parts across the codebase that are seeing ThreadDict attribute issues for |
Still missing. This might be a tricky one |
I just ran into this issue now after booting up docker and letting it sit for ~30 minutes. Restarting the memcached container brought it back though, which ties closely to Drini's comment about caching being the potential culprit |
This (stats, blog posts) is a general problem that is making our sentry monitoring extremely noisy: As is kenly noted, here openlibrary/openlibrary/plugins/openlibrary/home.py Lines 77 to 93 in 6f5aa75
We have defined many functions (that we try to cache) that expect What is happeningIn the first request (where no key exists in cache), the initial computation (I believe) is performed within the context of the thread we're on which contains It's tempting to say we can fix this by using our Solution(s)
|
This specific example is happening 45k times a week (one of our highest volume errors): openlibrary/openlibrary/plugins/openlibrary/home.py Lines 41 to 54 in 6f5aa75
|
@schu96 apologies if I'm stepping on your feet -- given how often this error is occurring (introducing noise into other performance issues we're trying to investigate), I'd like to quickly test this fix as a patch-deploy (to see if works as a pattern for reducing sentry errors) in our prod environment (and open a draft PR if that's alright) |
Moves `("dev" in web.ctx.features)` check to a `devmode` function param so `web.ctx` is no longer needed within our cached function. While the initial computer of the `get_homepage()` function works fine (because `web.ctx` is in scope) the `web.ctx` `ThreadedDict` may no longer be accessible once passed to a memcache thread for it's subsequent re-compute after timeout hit)
With #10353 deployed, stats appear on testing.openlibrary.org for staff |
After patch deploy, no exception raised for the last 8 minutes and stats + blog are back: |
* move web.ctx check outside of cached function #10318 Moves `("dev" in web.ctx.features)` check to a `devmode` function param so `web.ctx` is no longer needed within our cached function. While the initial computer of the `get_homepage()` function works fine (because `web.ctx` is in scope) the `web.ctx` `ThreadedDict` may no longer be accessible once passed to a memcache thread for it's subsequent re-compute after timeout hit) --------- Co-authored-by: Drini Cami <[email protected]>
No worries, I'm glad to see that the fix was relatively straightforward! |
Problem
Originally posted in Slack here
The stats about users/edits/etc are missing from the homepage.
Could be related to #10179
Reproducing the bug
Context
Breakdown
Requirements Checklist
Related files
Stakeholders
Instructions for Contributors
The text was updated successfully, but these errors were encountered: