Closed Bug 937373 Opened 11 years ago Closed 10 years ago

Verify that snippets-stats can accept a ping from the android client

Categories

(Snippets :: Service, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hoosteeno, Unassigned)

References

Details

(Whiteboard: [kb=1179079] )

We'll want to send android metrics requests to a slightly different snippets-stats endpoint so that we can track snippets/snippets-android requests separately, and also because android snippets are in a different ID namespace. 

This bug is simply to help us remember to ask WebOps to confirm for us that we can indeed send a request with a different URL.

We should also use this bug to specify the URL.

Some brief reference about snippets-stats: https://bugzilla.mozilla.org/show_bug.cgi?id=889799
Whiteboard: [kb=1179079]
aphadke: There is concern about battery/network usage if we send pings to the server as soon as the user views a snippet on Android. Would it be possibly to alter the metrics side of things such that we could send a POST with data on impressions in batches? 

Something like (assuming we're POSTing JSON, this can easily change):

[
  {snippet_id: 3825, timestamp: '2013-11-17T18:27Z'},
  {snippet_id: 6326, timestamp: '2013-11-18T18:27Z'},
  {snippet_id: 7932, timestamp: '2013-11-17T18:27Z'}
]
Flags: needinfo?(aphadke)
:mkelly - using post would involve changes on our end, also will this be part of the log line or something different? 
Can we append the snippet_ids to a single GET request w/ timestamp?

for eg:
/?s1=3825&t1=2013-11-17T18:27Z&s2=6326&t2=2013-11-18T18:27Z

?
Flags: needinfo?(aphadke) → needinfo?(mkelly)
Yeah, that's possible. If we switch to using a large GET string with IDs and timestamps matched up like that, how long will it take to make/update the dashboard for the Android snippets stats?
Flags: needinfo?(mkelly)
Depending on clients for timestamps does raise some data quality concerns. Can we live with them?
:mkelly - it shouldn't take us more than 3-5 days to get the dashboard up and running with daily updates.
:hoosteeno - that's okay, for snippet impressions, we only look for minute granularity and given the reports are grouped by day, quality issues wrt timestamps won't be an issue.
FYI, I filed bug 941685 for implementing this on the client side.
So bug 941685 is resolved. We're sending stats pings to https://snippets-stats.mozilla.org/mobile, and they're formatted as specified in comment 2; s1 is the ID of the first snippet included, t1 is an ISO 8601 Extended Formated datetime of when the snippet was viewed (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString is what is used to generate the datetime).

It should already be on Nightly, and we'll update this bug soon with instructions on how to test the stats ping. Is there anything else besides that needed from us to set this endpoint up?
Flags: needinfo?(bsullins)
Flags: needinfo?(aphadke)
mkelly - what date + time did this go live on nightly so I can check the logs..
Flags: needinfo?(aphadke)
(In reply to Anurag Phadke[:aphadke@mozilla.com] from comment #8)
> mkelly - what date + time did this go live on nightly so I can check the
> logs..

This particular change has been in Nightly since 12/4, but snippets are disabled by default on Nightly, so there shouldn't be much in the logs.

However, I flipped the prefs on my Nightly build to test snippets with the snippets-dev endpoint, so there may already be some pings in the log from me (or from anyone else who's been testing by setting these prefs).
hey,
can u provide a sample of snippet that I can grep in the logs? Also, the logs for nightly will be available @ snippets-stats.mozilla.org right?
(In reply to Anurag Phadke[:aphadke@mozilla.com] from comment #10)
> hey,
> can u provide a sample of snippet that I can grep in the logs? Also, the
> logs for nightly will be available @ snippets-stats.mozilla.org right?

I would've thought grepping for the /mobile in the URL would be enough, but the only two JSON snippets have IDs 1 and 2, so s1=1 or s1=2 should be enough.
Flags: needinfo?(bsullins)
I don't see any logs for 2013-12-10 (yday), will try later for today.
select * from v2_raw_logs where domain='snippets-stats.mozilla.org' and request_url like '%/mobile%' and ds='2013-12-10' limit 50;
0 results
margaret: Anurag checked again today and still can't see any traffic going to the /mobile URL on snippets-stats. Can you confirm that the stats are being sent out by the browser?
Flags: needinfo?(margaret.leibovic)
(In reply to Michael Kelly [:mkelly] from comment #13)
> margaret: Anurag checked again today and still can't see any traffic going
> to the /mobile URL on snippets-stats. Can you confirm that the stats are
> being sent out by the browser?

I'm not sure anybody has been testing Nightly with snippets enabled, so maybe there just haven't been any stats to send? But I'll do some more testing locally to verify that we do make these pings, and hopefully doing that testing will make some stats show up in the logs.
Flags: needinfo?(margaret.leibovic)
I flipped some prefs to enable snippets on my local build, changed the update interval to speed up when we might send stats, and added some logging to log what URL we use to make the request, and I saw this get logged:

https://snippets-stats.mozilla.org/mobile?s0=2&t0=2014-01-06T21%3A09%3A26.159Z&s1=2&t1=2014-01-06T21%3A09%3A31.138Z&s2=2&t2=2014-01-06T21%3A09%3A35.748Z

Anurag, can you check again to see if this showed up in the logs?
Flags: needinfo?(aphadke)
yup. I /mobile is appearing in the logs.

 select * from v2_raw_logs where domain='snippets-stats.mozilla.org' and request_url like '%/mobile%' and ds >= '2014-01-06' limit 50;

207.97.190.2	snippets-stats.mozilla.org	null	06/Jan/2014:13:09:37 -0800	GET	/mobile?s0=2&t0=2014-01-06T21%3A09%3A26.159Z&s1=2&t1=2014-01-06T21%3A09%3A31.138Z&s2=2&t2=2014-01-06T21%3A09%3A35.748Z	200	277	-	Mozilla/5.0 (Android; Mobile; rv:29.0) Gecko/29.0 Firefox/29.0	-	null	NULL	2014-01-06	snippets-stats.mozilla.org
63.245.219.53	snippets-stats.mozilla.org	null	06/Jan/2014:13:11:48 -0800	GET	/mobile?s0=2&t0=2014-01-06T21%3A09%3A26.159Z&s1=2&t1=2014-01-06T21%3A09%3A31.138Z&s2=2&t2=2014-01-06T21%3A09%3A35.748Z	200	276	-	Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:25.0) Gecko/20100101 Firefox/25.0	__utma=150903082.47493961.1374530033.1389037630.1389040048.284; __utmz=150903082.1389032585.282.209.utmcsr=snippet|utmccn=Brazil_Privacy|utmcmd=snippet; optimizelySegments=%7B%22246002457%22%3A%22campaign%22%2C%22246073290%22%3A%22ff%22%2C%22245984388%22%3A%22false%22%2C%22246073289%22%3A%22keyboardshortcuts_en%22%2C%22197878113%22%3A%22none%22%2C%22197755715%22%3A%22direct%22%2C%22197870141%22%3A%22ff%22%2C%22197869430%22%3A%22false%22%2C%22237061344%22%3A%22none%22%2C%22237321400%22%3A%22ff%22%2C%22237335298%22%3A%22referral%22%2C%22237485170%22%3A%22false%22%2C%22207211776%22%3A%22campaign%22%2C%22207213264%22%3A%22false%22%2C%22207203514%22%3A%22eoy_colorbox%22%2C%22207203515%22%3A%22ff%22%2C%22245617832%22%3A%22firefoxos_hungary%22%2C%22245875585%22%3A%22campaign%22%2C%22245677587%22%3A%22ff%22%2C%22246048108%22%3A%22false%22%7D; optimizelyEndUserId=oeu1375992985010r0.9858306115961342; optimizelyBuckets=%7B%22519640403%22%3A%22526040396%22%7D; WT_FPC=id=23f1cde8af2b1cf3ca61383355674646:lv=1383355674646:ss=1383355674646; __utmx=150903082.QhvDOg2zQqa9threH1A1kQ$71153379-29:.Vg5laLSTSeCNVivO8llj8Q$71153379-33:; __utmxx=150903082.QhvDOg2zQqa9threH1A1kQ$71153379-29:1384287059:15552000.Vg5laLSTSeCNVivO8llj8Q$71153379-33:1388692595:15552000; __utmc=150903082; blue_daisychain_id=e7cb2a00-68fc-11e3-9441-000000000000	null	NULL	2014-01-06	snippets-stats.mozilla.org
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(aphadke)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.