-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
adds view counts to many objects on site, so we can see what items are popular when #6692
Conversation
app/economy/models.py
Outdated
key = f"{self.content_type}_{self.pk}" | ||
return key | ||
|
||
def increment_view_count(self): |
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.
@gitcoinco/engineers im consdidering shifting from storing as a total count in redis, to a ObjectView
django database object, which would allow us to
- store time series data
- also keep track of who views what (useful for segmenting purposes)
- differentiate index page views (like on /grants) from specific viewings of individual objects (like /grants/35/sustainability fund)
any objection if i do this? seems like the only counter-point would be DB bloat.
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.
There will no doubt be a performance impact in reading and tallying this data - if you want to store that data for later data analysis I think it should be done in parallel with storing the total count in redis. Only the redis count should ever be read from during a web request.
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.
good idea.
as a rule, i think we shouldnt write to the DB from most HTTP requests. factoring into a task is almost always a good idea
Codecov Report
@@ Coverage Diff @@
## master #6692 +/- ##
==========================================
+ Coverage 26.75% 27.15% +0.39%
==========================================
Files 293 292 -1
Lines 27538 27237 -301
Branches 4069 4000 -69
==========================================
+ Hits 7369 7397 +28
+ Misses 19902 19567 -335
- Partials 267 273 +6
Continue to review full report at Codecov.
|
:param content_type: | ||
:return: | ||
""" | ||
redis = RedisService().redis |
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.
A good opportunity here to optimize performance is to swap out the redis_service.py
code we use for just using a proper connection pool
82ab79f adds time series and user specific data to this PR. marking as rdy for review |
rdy for review |
Description
adds view counts to many objects on site, so we can see what items are popular when
this is important bc it allows us to provide analytics data to users about whats popular, and visualize the funnel
Refers/Fixes
https://gitcoincore.slack.com/archives/CBWA6A75M/p1590015181146800
Testing
tested locally, bounties, hackathons, kudos, grants all load