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

add read stats in addition to borrows #10349

Merged
merged 5 commits into from
Feb 3, 2025
Merged

Conversation

mekarpeles
Copy link
Member

Historically, we've only counted borrowing stats and not access to open materials.

One line improvement to track how often open access materials are read from Open Library.

Historically, we've only counted borrowing stats and not access to open materials.
@@ -158,6 +158,7 @@ def POST(self, key): # noqa: PLR0915
response = lending.get_availability_of_ocaid(edition.ocaid)
availability = response[edition.ocaid] if response else {}
if availability and availability['status'] == 'open':
stats.increment('ol.reads.bookreader')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stats.increment('ol.reads.bookreader')
if not is_bot():
stats.increment('ol.reads.bookreader')

@mekarpeles mekarpeles assigned scottbarnes and unassigned cdrini Jan 21, 2025
@mekarpeles
Copy link
Member Author

mekarpeles commented Jan 21, 2025

Let's just make sure it doesn't break on testing and does record some stat on graphite [for read option and not other options like borrow]

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We looked on ABC call; seems low risk. @scottbarnes notes we couldn't quite test this on testing since statsd calls are seemingly disabled there.

@cdrini cdrini merged commit 71bc306 into master Feb 3, 2025
7 checks passed
@cdrini cdrini deleted the feature/analytics-read-counts branch February 3, 2025 20:23
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.

3 participants