in libmozdata/redash.py [0:0]
def get_number_of_crash(start_date, end_date, channel, versions, product):
"""Get the results for query 399, 400: https://sql.telemetry.mozilla.org/queries/399
https://sql.telemetry.mozilla.org/queries/400
Args:
start_date (datetime.datetime): start date
end_date (datetime.datetime): end date
channel (str): the channel
versions (List[str]): the versions
product (str): the product
Returns:
dict: containing result in json for each query
"""
qid = "400" if product == "FennecAndroid" else "399"
crashes = Redash.get(qid)
rows = crashes[qid]["query_result"]["data"]["rows"]
res = {}
stats = {"m+c": 0.0, "main": 0.0, "content": 0.0, "plugin": 0.0, "all": 0.0}
start_date = utils.get_date_ymd(start_date)
end_date = utils.get_date_ymd(end_date)
# init the data
duration = (end_date - start_date).days
for i in range(duration + 1):
res[start_date + timedelta(i)] = stats.copy()
rows = Redash.__get_rows(channel, versions, rows)
for row in rows:
d = utils.get_date_ymd(row["date"])
if d >= start_date and d <= end_date:
stats = res[d]
stats["m+c"] += row["main"] + row["content"]
stats["main"] += row["main"]
stats["content"] += row["content"]
stats["plugin"] += row["plugin"] + row["gmplugin"]
stats["all"] += row["total"]
return res