Skip to content

Instantly share code, notes, and snippets.

@chutten
Created November 15, 2016 21:55
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 chutten/7a5bfc86f29a4292b9af45c48a542f41 to your computer and use it in GitHub Desktop.
Save chutten/7a5bfc86f29a4292b9af45c48a542f41 to your computer and use it in GitHub Desktop.
subprocess_crash_submit
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
# ### 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