Closed Bug 1134491 Opened 11 years ago Closed 11 years ago

Feature request: Add snippet feed, or event stream for automatic graph annotations

Categories

(Snippets :: Service, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bobm, Assigned: giorgos)

References

Details

The Cloud Services Operations team would like to annotate snippet events onto the relevant service graphs as snippets are created, change weight, or otherwise influence traffic to the various services. An RSS feed, or JSON blob index would be ideal for this purpose. Example: * A New Snippet promotion starts for the Fx Hello service. * Cloud Services polls Snippets for active promotions. * The new Hello promotion is annotated on the Fx Hello dashboards.
Sounds like a great idea! On https://snippets.mozilla.com we display a list of the active desktop snippets, with information about the channels they hit and the template used. Similarly we have https://snippets.mozilla.com/json-snippets for snippets targeting Fennec on Android. I think about creating an endpoint on https://snippets.mozilla.com/activesnippets.json that will return the same information using json. I can make it include both desktop and android snippets or have separate endpoints if that's preferred. I think a single endpoint sounds like better idea, as we will be expanding to Fennec on iOS and FirefoxOS (soon). BTW snippet weight is calculated on the client so it doesn't affect the service. Template, channel and the actual snippet content do. How does that sound :bobm?
Flags: needinfo?(bobm)
Hardware: x86 → All
A single endpoint would be great. Are you planning on including the start and stop times for the snippets, or should we just assume everything in the file is active, and non-active when it disappears? I'm sure that a lot to do with how snippets work. That's an interesting point about the snippet weight. I thought it meant that snippet X would have a weight of Y, and be presented to the client Y% of the time. Is there something I can read about how it works?
Flags: needinfo?(bobm)
(In reply to Bob Micheletto [:bobm] from comment #2) > A single endpoint would be great. Are you planning on including the start > and stop times for the snippets, or should we just assume everything in the > file is active, and non-active when it disappears? I'm sure that a lot to > do with how snippets work. Snippets service defines two states for snippets: Enabled and Disabled. Also each snippet has an start and end time, both optional. A Disabled snippet is never returned by the service to the clients. A Enabled snippet: - If there is no start or end time, will be returned to matching clients. - If there is start time and start time <= now() will be returned to matching clients. - If there is end time and end time >= now(), will be returned to matching clients. - If there is both start and end time and start time <= now() <= end time, will be returned to matching clients. The load of the service is mostly determined by Enabled snippets that match the start and end time limits. I suggest that the JSON includes only Enabled snippets with their the start, end times and based on that you can filter whatever makes sense to you. Disabled snippets will not be included. Sounds good? > That's an interesting point about the snippet weight. I thought it meant > that snippet X would have a weight of Y, and be presented to the client Y% > of the time. Is there something I can read about how it works? Indeed that's what snippet weight is about. A client hits the Snippets service and the service returns a list of Snippets that match the client based on version, channel, locale and other criteria. The client will cache this list of Snippets for a day [2] and will display one of the cached Snippets every time the user visits about:home. Each snippet has a weight. Default snippet weight is 100. Larger weight numbers mean more impressions and smaller numbers mean less impressions. Full list of supported weights [0]. The client is responsible to choose a snippet from the returned snippets. This is done through a weighted random function [1]. The service will return snippets matching a list of criteria, independent of weight. Therefore service's performance is not affected by snippet weight. Does that clear things up? [0] https://github.com/mozilla/snippets-service/blob/master/snippets/base/models.py#L36-L42 [1] https://github.com/mozilla/snippets-service/blob/master/snippets/base/templates/base/includes/snippet_js.html#L150-L160 [2] Beta caches snippets for 4 hours. This will hit Release in firefox 37.
(In reply to Giorgos Logiotatidis [:giorgos] from comment #3) > (In reply to Bob Micheletto [:bobm] from comment #2) > I suggest that the JSON includes only Enabled snippets with their the start, > end times and based on that you can filter whatever makes sense to you. > Disabled snippets will not be included. > > Sounds good? Sounds great. What timezone are the start and end times? > The service will return snippets matching a list of criteria, independent of > weight. Therefore service's performance is not affected by snippet weight. > > Does that clear things up? Yes, thanks!
(In reply to Bob Micheletto [:bobm] from comment #4) > (In reply to Giorgos Logiotatidis [:giorgos] from comment #3) > > (In reply to Bob Micheletto [:bobm] from comment #2) > > > I suggest that the JSON includes only Enabled snippets with their the start, > > end times and based on that you can filter whatever makes sense to you. > > Disabled snippets will not be included. > > > > Sounds good? > > Sounds great. What timezone are the start and end times? > UTC
Assignee: nobody → giorgos
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Reopening until this gets merged to prod.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
This is now on stage. :bobm does the output give you what you need? curl -q https://snippets.allizom.org/active-snippets.json | python -m json.tool
Flags: needinfo?(bobm)
(In reply to Giorgos Logiotatidis [:giorgos] from comment #8) > This is now on stage. > > :bobm does the output give you what you need? > > curl -q https://snippets.allizom.org/active-snippets.json | python -m > json.tool I take it the publish_end and publish_start parameters would ordinarily be milliseconds, or seconds since the epoch? The on_* parameters are intuitive enough, but how do I convert the template number into more detailed information about what is actually targeted by the snippet? How would I determine the specific service or software endorsed by the individual snippets from this output? Take this for example: { "id": 51, "on_aurora": true, "on_beta": true, "on_nightly": true, "on_release": true, "publish_end": null, "publish_start": null, "template": 1, "type": "Desktop Snippet" }, I can tell this particular snippet is active for aurora, beta, nightly, and release on desktop. But I have no idea what is being promoted.
Flags: needinfo?(bobm)
(In reply to Bob Micheletto [:bobm] from comment #9) > I take it the publish_end and publish_start parameters would ordinarily be > milliseconds, or seconds since the epoch? No publish_end publish_start are in YYYY-MM-DDTHH:MM:SS format. From the URL mentioned in comment #8 here's an example: { "id": 52, "on_aurora": true, "on_beta": true, "on_nightly": true, "on_release": true, "publish_end": null, "publish_start": "2014-09-24T11:25:41", "template": 1, "type": "Desktop Snippet" }, "type" can take two values now: "Desktop Snippet" for Firefox Desktop and "JSON Snippet" for Fennec for Android.
(In reply to Bob Micheletto [:bobm] from comment #9) > I can tell this particular snippet is active for aurora, beta, nightly, and > release on desktop. But I have no idea what is being promoted. We don't classify the snippets in any other way than the ones already exported. I can export snippet name and template name which can provide more hints on what snippet with id 51 is but obviously still that doesn't guarantee that a snippet targeting Hello, will contain the word 'Hello' in snippet name. How many dashboard are there? Maybe we can try a tagging system for snippets where the snippet creator will be responsible to tag a Hello snippet with 'hello' tag.
Flags: needinfo?(bobm)
(In reply to Giorgos Logiotatidis [:giorgos] from comment #11) > We don't classify the snippets in any other way than the ones already > exported. I can export snippet name and template name which can provide more > hints on what snippet with id 51 is but obviously still that doesn't > guarantee that a snippet targeting Hello, will contain the word 'Hello' in > snippet name. > > How many dashboard are there? Maybe we can try a tagging system for snippets > where the snippet creator will be responsible to tag a Hello snippet with > 'hello' tag. There are a decent number of dashboards. A good deal of the services that we run are for internal purposes, and therefore aren't likely to be featured in a snippet promotion. However, we're adding new services on a fairly regular basis. I started an official list of tags for our services here: https://mana.mozilla.org/wiki/display/SVCOPS/Contacting+Cloud+Operations Not sure if that will be formal enough.
Flags: needinfo?(bobm)
> No publish_end publish_start are in YYYY-MM-DDTHH:MM:SS format. From the URL > mentioned in comment #8 here's an example: > > { > "id": 52, > "on_aurora": true, > "on_beta": true, > "on_nightly": true, > "on_release": true, > "publish_end": null, > "publish_start": "2014-09-24T11:25:41", > "template": 1, > "type": "Desktop Snippet" > }, Would it be possible to add the Name and Locales to this list?
Commits pushed to master at https://github.com/mozilla/snippets-service https://github.com/mozilla/snippets-service/commit/8a0af31e70c97f9ae6fec9cc543446459e820a94 [bug 1134491] Export name, locales, countries, weight in active_snippets.json. https://github.com/mozilla/snippets-service/commit/8593d6fa8769890f713b3a25e707ff58e1baa0ea Merge pull request #107 from glogiotatidis/1134491 [bug 1134491] Export name, locales, countries, weight in active_snippets json.
I added snippet name, template name (instead of id), locales, countries and snippet weight.
Blocks: 1167653
Anything else we can help you with :bobm?
Flags: needinfo?(bobm)
(In reply to Giorgos Logiotatidis [:giorgos] from comment #16) > Anything else we can help you with :bobm? Nope, looks good to me, thanks!
Flags: needinfo?(bobm)
Marking this resolved / fixed per comment 17.
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.