I and Simone Gatti propose to implement a set of metrics gathered from users' activity, including the number of created or modified artifacts (also separated for different kinds of artifacts), the number of assigned tickets, solved tickets and "revoked" tickets (namely tickets which were assigned to a user but whose owner was later changed), the number of commits and the total number of added or modified lines of code by the user.
According to the proposal, the metrics should be shown as a "total value", as an average per-month value, and they should be also calculated considering the last 30 days only, in order to allow to check whether the user is still active on the forge or not, and if he is increasing his efforts on the forge or not.
Values should also be calculated for a single category only, namely considering all the data regarding projects tagged as belonging to that category. A graph showing the number of joined projects by the user for each category should also be created, to highlight the kind of applications the user is focused on.
Looking good! Here are a few initial thoughts:
.svn
directories got committed - those need to be removed.postEvent(...)
(or similar).This is by no means a comprehensive review, but rather some of my first impressions. Sorry it took a while. In the future, committing smaller chunks of code will make the review process go faster.
Thanks again for this contribution. I'm looking forward to seeing it come together. Please feel free to continue discussion either on the ticket itself, or on the mailing list.
Thank you for your feedback!
I removed .svn directories (I'm sorry, I didn't notice they were there) and I cached entry points in app_globals.py, as you suggested.
In order to avoid writing the loop every time an event is called, I moved it creating a new class to do so, in eventslistener.py.
I also added unit tests to cover functionalities of the model.
For what concerns pluggability, our idea is to allow registering a new listener by simply creating a new entry point with allura.stats as its group. The entry point should be built in a way similar to the one defined for UserStats: a class, in our case ForgeUserStatsApp, should be implemented, including an attribute listener representing the listener class which implements the logic needed to update the statistics. The listener should be a subclass of EventsListener, defined in eventslistener.py.
At the moment, there is no loop through all the allura.stats entry points within app_globals.py to load all the entry points, but we only load the listener we created. However, it is very simple to put back the loop, so that this mechanism can actually be used. At the moment, we also have values in the configuration file to enable or disable user stats, so that it is also possible to disable it even if the module is actually installed within the forge. The loop would simply be:
Let us know what you think about this mechanism, and if a more detailed explanation is needed. Moreover, feel free to add other comments about our code.
Finally, please note that, even if all the code has been submitted under my name, I actually developed it together with my fellow student, Simone Gatti.
Tim recently rebased the branch so I could look at it easily too. I scanned through the net difference by running
git diff origin/master...
so I didn't see all the individual commits :)Stats
dolist(self.query.find())
and then go through everything. We'll have to keep our eye on performance for those. Not sure it'll be an issue for sure, but seems like that could get slow once this is running on a big site like SourceForge :)contrib_stats.py
seems a bit odd to me. "contrib" doesn't seem necessary. And if it's only used for User stats, maybe it could go into that tool. On the other hand, if it is generic and could be use for project stats some day, then keeping it in the Allura package makes sense too. TheAllura/allura/model/stats.py
file is very old and as far as I can tell it's not used (used to be for some "content production activity" stats which are no longer part of allura). Feel free to delete it and rename yours to stats.py.sample
files from the testgit repo? they aren't needed and the pre-rebase.sample file has a copyright headers so we want to avoid that.registration_date
gets set to the date that the UserStats object was created. When I saw registration date on the stats page, I though about when the user's account was registered. For most Allura instances, you can useuser._id.generation_time
but some instances (like SourceForge) need to hook up to older user systems, which happens via theAuthenticationProvider
plugin. Could you add adef user_registration_date(self, user):
method and implement it withuser._id.generation_time
for LocalAuthenticationProvider? Then we at SF can implement that method in our own provider too.Sorry for all this extra feedback. I know Tim's given you a lot already and it's getting really close. That's just the reality of big new features :)
Thanks
Related
Tickets:
#5909numpy & matplotlib are some pretty big dependencies to add (large, and require C module compilation). The graphs so far are pretty simple, so we might want to do them just in CSS instead. There's even good JS/CSS libraries for complex visualizations. Not something we necessarily need to change before merging this, but wanted to mention my preferred direction on it. Maybe we can change it and remove numpy/matploglib down the road.
Hi Dave!
All your changes here are looking good.
I've got a few semi-related changes that I'm working on. I'll push them tomorrow probably and let you review them if you want.
I've pushed a few commits to
db/5453
Do you want to review those?Yes, I was very happy to review your commits. Thank you, I think it is a very nice improvement!
It looks very good to me, and I don't have anything to add.
I think we are ready to push our commits on the master branch! Do you agree?
Yes, I just wanted to incorporate some recent changes Tim made that will allow us to not count all the commits that are processed during an SVN import.
Merged to master
Originally by: *anonymous
This is the error i am getting while running paster setup-app development.ini
INFO [allura.model.notification] Notifications disabled for project u/test-user, not sending metadata(<page import_id="None" labels="I[]" deleted="False" text="u'Welcome" to="" your="" wiki!\n\nthis="" is="" the="" default="" page,="" edit="" it="" as="" you="" see="" fit.="" add="" a="" new="" page="" simply="" reference="" within="" brackets,="" e.g.:="" <span="">[SamplePage].\n\nThe wiki uses Markdown syntax.\n\n\</page>
Project Admins:
14:45:24,577 ERROR [allura.model.project] userstats is not available
Traceback (most recent call last):
File "/home/pc247053/src/allura/Allura/allura/model/project.py", line 468, in install_anchored_tools
new_tools.append(self.install_app(tool, tool, label, i))
File "/home/pc247053/src/allura/Allura/allura/model/project.py", line 572, in install_app
app = App(self, cfg)
File "/home/pc247053/src/allura/ForgeUserStats/forgeuserstats/main.py", line 92, in init
role_admin = M.ProjectRole.by_name('Admin')._id
AttributeError: 'NoneType' object has no attribute '_id'
and while registering a new user in the forge the tg.log is also showing the same error
Please help me in fixing this