Skip to content

Instantly share code, notes, and snippets.

@raymak
Last active September 21, 2017 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raymak/d18ed8fab091a7bf92c8a2ce17eb7191 to your computer and use it in GitHub Desktop.
Save raymak/d18ed8fab091a7bf92c8a2ce17eb7191 to your computer and use it in GitHub Desktop.
Nothing Burger Addon Count
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
# In[58]:
import ujson as json
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import plotly.plotly as py
from plotly.graph_objs import *
from moztelemetry import get_pings_properties, get_one_ping_per_client
from moztelemetry.dataset import Dataset
get_ipython().magic(u'matplotlib inline')
# In[59]:
sc.defaultParallelism
# In[60]:
_EXTENSION_IDS = [
'optout-nothing-study-addon@shield.mozilla.com'
]
_START_DATE = '20170912'
_END_DATE = '20170920'
_SAMPLE = 1
# In[61]:
Dataset.from_source("telemetry").schema
# In[62]:
pings = Dataset.from_source("telemetry") .where(docType='main') .where(submissionDate=lambda x: x <= _END_DATE and x >= _START_DATE) .where(appUpdateChannel="nightly") .records(sc, sample=_SAMPLE)
# In[63]:
subset = get_pings_properties(pings, {'clientId': "clientId",
'addons': "environment/addons/activeAddons"})
# In[64]:
subset = subset.filter(lambda p: p.get('addons', None) is not None and len(p.get('addons', {}).keys()) > 0)
# In[ ]:
subset = get_one_ping_per_client(subset)
# How many pings have one of the legacy addons in them?
# In[ ]:
with_addons = subset.filter(lambda p: len(set(p['addons'].keys()) & set(_EXTENSION_IDS))>0)
with_addons_count = with_addons.count()
with_addons_count
# In[ ]:
# In[ ]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment