Last Comment Bug 833880 - Daily stats appear wrong (in AceProject app)
: Daily stats appear wrong (in AceProject app)
Status: RESOLVED FIXED
:
Product: Marketplace
Classification: Server Software
Component: Statistics (show other bugs)
: 1.0
: All All
: P2 normal (vote)
: 2013-01-31
Assigned To: Wraithan (Chris McDonald) [:wraithan]
:
Mentors:
https://marketplace.firefox.com/app/a...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-23 10:29 PST by Andrew Williamson [:eviljeff]
Modified: 2013-01-31 10:38 PST (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
aceproject stats csv (5.21 KB, application/vnd.ms-excel)
2013-01-23 10:29 PST, Andrew Williamson [:eviljeff]
no flags Details

Description Andrew Williamson [:eviljeff] 2013-01-23 10:29:22 PST
Created attachment 705430 [details]
aceproject stats csv

On the back of an email conversation about AceProject.

The daily downloads listed in the statistics page don't match the entries in the users_install table.  E.g. there is one record for an install in the DB table on 2013-01-19 but 32 shown on the statistics page.

See attached for csv (permission given to disclose these in this bug).  Query output that Andy ran:
mysql> select created from users_install where addon_id = 371245
order by created;
+---------------------+
| created |
+---------------------+
| 2012-05-15 10:31:33 |
| 2012-06-26 10:32:01 |
| 2012-07-17 21:53:17 |
| 2012-07-23 16:48:41 |
| 2012-08-13 16:23:22 |
| 2012-10-01 15:05:02 |
| 2012-10-27 23:55:54 |
| 2012-12-25 07:11:24 |
| 2013-01-09 12:56:37 |
| 2013-01-19 13:27:50 |
| 2013-01-22 09:27:10 |
| 2013-01-22 17:59:08 |
+---------------------+
12 rows in set (0.02 sec)
Comment 1 Andrew Williamson [:eviljeff] 2013-01-23 10:35:21 PST
Idle speculation on my part is that the users_install table is only logged in users and on days without a logged in user install the total installs aren't being recorded.  

Or possibly all downloads between those dates are being 'rolled up' into that day, i.e. there were 32 downloads between 2013-01-10 and 2013-01-19 and they're all being shown on a single day.
Comment 2 Christopher Van Wiemeersch [:cvan] 2013-01-25 02:50:35 PST
We are logging each install once per user. And since we allow anonymous installs, this means that for the second installation by any anonymous user, request.amo_user=None, and we record the install only once: https://github.com/mozilla/zamboni/blob/master/mkt/receipts/views.py#L84

We should probably key off user if the user is installed. Otherwise, insert a new record for anonymous users.
Comment 3 Wil Clouser [:clouserw] 2013-01-28 13:22:19 PST
Aim for this week on this one since our stats stuff is changing and it would be good to have it accurate first.
Comment 4 Wraithan (Chris McDonald) [:wraithan] 2013-01-30 15:38:13 PST
If I understand the code correctly, the CSV file is being generated out of ES:

https://github.com/mozilla/zamboni/blob/master/mkt/stats/views.py#L113

I have to go looking for where we are indexing this data to see if maybe that is the cause for the clumpiness.
Comment 5 Wraithan (Chris McDonald) [:wraithan] 2013-01-30 16:52:48 PST
Looking at the indexing task it appears everything is fine with that and I can't seem to find the flaw that is making it so only some days have data and the rest are 0.

I am pretty sure, unless someone has some other data, that the anonymous user download/install tracking is a separate issue. I am going to file it as a separate ticket.
Comment 6 Wraithan (Chris McDonald) [:wraithan] 2013-01-30 17:00:26 PST
made bug 836586 of the anonymous user issue.
Comment 7 Wraithan (Chris McDonald) [:wraithan] 2013-01-30 18:23:30 PST
https://github.com/mozilla/zamboni/commit/a0620d530dcdde9a2c73d87d984ecedd6be6607f

This is going to require a dumping of the stats index and reindexing of all of days so far. Not sure where I should put that information. But the bug causing this is fixed.
Comment 8 Wil Clouser [:clouserw] 2013-01-30 21:23:20 PST
You're talking about reindexing just marketplace stats?
Comment 9 Wraithan (Chris McDonald) [:wraithan] 2013-01-30 21:25:42 PST
Yes, it was the mkt.stats.search that was wrong, only marketplace uses that.
Comment 10 Andrew Williamson [:eviljeff] 2013-01-31 03:50:19 PST
Did you mean to mark this fixed rather than unconfirmed?
Comment 11 Wil Clouser [:clouserw] 2013-01-31 08:16:42 PST
(In reply to Wraithan from comment #9)
> Yes, it was the mkt.stats.search that was wrong, only marketplace uses that.

How do we clear them?  Just give us the commands we need to run when we push
Comment 12 Wraithan (Chris McDonald) [:wraithan] 2013-01-31 10:30:09 PST
curl -XDELETE http://localhost:9200/amo_stats/users_install/

Where you replace localhost:9200 with where ES runs in prod and amo_stats with the value of settings.ES_INDEXES['users_install'] which defaults to amo_stats.

./manage.py index_mkt_stats

This will repopulate data from all time. It has chunking setup so it will do its best to not do queries/etc that are too large.
Comment 13 Wraithan (Chris McDonald) [:wraithan] 2013-01-31 10:38:35 PST
Going out today. Verify on friday.

Note You need to log in before you can comment on or make changes to this bug.