-
-
Save chutten/7a5bfc86f29a4292b9af45c48a542f41 to your computer and use it in GitHub Desktop.
subprocess_crash_submit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# ### Subprocess Crash Submission Rates | |
# In[1]: | |
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, get_pings_properties, get_one_ping_per_client, get_clients_history, get_records | |
get_ipython().magic(u'pylab inline') | |
# In[2]: | |
sc.defaultParallelism | |
# In[43]: | |
pings = get_pings(sc, app="Firefox", submission_date="20161101", fraction=0.4) | |
# In[44]: | |
subset = get_pings_properties(pings, ["clientId", | |
"application/channel", | |
"payload/keyedHistograms/PROCESS_CRASH_SUBMIT_SUCCESS/content-crash", | |
"payload/keyedHistograms/PROCESS_CRASH_SUBMIT_SUCCESS/plugin-crash", | |
"payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP/content", | |
"payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP/plugin", | |
]) | |
# In[45]: | |
subset = subset.filter(lambda p: p["application/channel"] is not None and | |
(p["payload/keyedHistograms/PROCESS_CRASH_SUBMIT_SUCCESS/content-crash"] is not None or | |
p["payload/keyedHistograms/PROCESS_CRASH_SUBMIT_SUCCESS/plugin-crash"] is not None or | |
p["payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP/content"] is not None or | |
p["payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP/plugin"] is not None)) | |
# In[46]: | |
def pair_or_none(p, prefix, hgram, crash): | |
return (prefix + crash, 1) if p[hgram + "/" + crash] is not None else None | |
def gimme_count(p, hgram, crashes): | |
prefix = p["application/channel"] + "-" | |
return [pair_or_none(p, prefix, hgram, crash) for crash in crashes] | |
crash_counts = subset .flatMap(lambda p: gimme_count(p, "payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP", ["content", "plugin"])) .filter(lambda pair: pair is not None) .countByKey() | |
crash_counts | |
# In[47]: | |
crash_reports = subset .flatMap(lambda p: gimme_count(p, "payload/keyedHistograms/PROCESS_CRASH_SUBMIT_SUCCESS", ["content-crash", "plugin-crash"])) .filter(lambda pair: pair is not None) .countByKey() | |
crash_reports | |
# In[48]: | |
{k: (1.0 * v / crash_counts.get(k[:-6], v)) for (k, v) in crash_reports.iteritems()} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment