Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Collect proxy telemetries from addon #705

Closed
ncloudioj opened this issue May 16, 2016 · 3 comments
Closed

Collect proxy telemetries from addon #705

ncloudioj opened this issue May 16, 2016 · 3 comments

Comments

@ncloudioj
Copy link
Member

We wanted to collect some pings for the proxy related metrics. It needs following steps:

  • sort out the target metrics @jaredkerim
  • client side ping collecting and notification @sarracini
  • server side telemetry processing and persistence @ncloudioj
@ncloudioj ncloudioj added this to the Amethyst milestone May 16, 2016
@sarracini
Copy link
Contributor

Based on #680 we want to collect:

{
    source: "TOP_FRECENT_SITES_RESPONSE",  // which SQL query produced this list of URLs
    count: 17, // the total number of URLs returned by the SQL query
    cacheHit: 13, // the number found in our local simple storage cache
    cacheMiss: 4, // the number we failed to find and will request from embedly-proxy
    success: true, // was the call to embedly-proxy successful
    urlsRequested: 4, // how many URLs did we send to the proxy
    urlsReceived: 2, // how many URLs did we get back
    requestLatency: 13.4, // how long did it take for the call to complete
}

from the client's side

@ncloudioj
Copy link
Member Author

Ah, great. A couple of suggestions:

  • each ping from addon has a required field action, here we can use action: "activity_stream_proxy"
  • let's stick with the snake case, e.g. "cacheHit" -> "cache_hit", just be consistent with other pings.
  • use integer "millisecond" for the "requestLatency" rather than float point, e.g "13.4" -> "13400"

@jaredlockhart
Copy link
Contributor

jaredlockhart commented May 25, 2016

To correlate multiple pings, we will use an eventID which will be shared across multiple pings which correspond to the same 'event', or in this case, a single invocation of a method.

We can use the addon SDK's uuid method found here:

https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/util_uuid

getEvent(eventData) {
    // eventData can contain additional data to send to the payload
    return Object.assign({}, eventData, {eventID: uuid()});
}

Tracking a performance ping will have 3 parameters:

event : Event
eventName : str  ex "previewCacheHit"
value : int

We would like to track the following messages in the following places

https://github.com/mozilla/activity-stream/blob/master/lib/ActivityStreams.js#L154-L159

const event = tracker.getEvent({source: responseType});

track(event, 'previewCacheRequest', responseType, links.length)

track(event, 'previewCacheHits', responseType, result.length)

track(event, 'previewCacheMisses', responseType, links.length - result.length)

_asyncFetchAndCache: Task.async(function*(newLinks, updateAccessTime = true) {

track(event, 'embedlyProxyRequestSentCount', newLinks.length)

track(event, 'embedlyProxyRequestTime', <duration of request in milliseconds>)

track(event, 'embedlyProxyRequestSuccess', 1) if request is successful ie 200

track(event, 'embedlyProxyRequestFailure', 1) if request is failure ie !200

track(event, 'embedlyProxyRequestReceivedCount', responseJson.urls.length)

Redacted:

track(event, 'embedlyProxyRequestError', 1) if response.error is not null

A single performance ping should contain:

(timestamp: unix timestamp, userID: str, eventName: str, eventID: str, value: int)

jaredlockhart added a commit to JaredLockhart-Mozilla/activity-stream that referenced this issue May 26, 2016
jaredlockhart added a commit to JaredLockhart-Mozilla/activity-stream that referenced this issue May 26, 2016
jaredlockhart added a commit that referenced this issue May 26, 2016
Add a description of performance ping #705
jaredlockhart added a commit that referenced this issue May 30, 2016
feat(metrics): #705 Collect proxy telemetries from addon
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants