Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save squarewave/96385908ef2d045be577398becfe6afb to your computer and use it in GitHub Desktop.
Save squarewave/96385908ef2d045be577398becfe6afb to your computer and use it in GitHub Desktop.
Plugin Safety install 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[ ]:
from moztelemetry import get_pings_properties, get_one_ping_per_client
from moztelemetry.dataset import Dataset
sc.defaultParallelism
# In[ ]:
start_date_str = '20170504'
pings = Dataset.from_source("telemetry") .where(docType='shield_study') .where(submissionDate=lambda b: (b == start_date_str or b > start_date_str)) .where(appUpdateChannel="release") .records(sc, sample=1.0)
pings_props = get_pings_properties(pings, ["clientId", "payload/study_state"])
filtered = pings_props.filter(lambda p: p['environment/addons/activeAddons/@plugin-safety'] is not None)
(filtered
.filter(lambda p: p['payload/study_state'] == 'install')
.groupBy(lambda p: p['clientId'])
.count()
) - (filtered
.filter(lambda p: p['payload/study_state'] == 'user-ended-study')
.groupBy(lambda p: p['clientId'])
.count()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment