Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import logging | |
| 6 from collections import namedtuple | |
| 7 | |
| 8 from crash.stacktrace import Stacktrace | |
| 9 | |
| 10 # TODO(katesonia): the CrashAnalysis(ndb.Model) is how we store these | |
| 11 # objects in the application. However, note that these aren't actually | |
| 12 # "analyses"; they're the *input* to our analysis, whereas Culprit | |
|
Sharu Jiang
2016/10/12 17:46:29
The CrashAnalysis contains *input* and *output* of
wrengr
2016/10/12 21:14:51
Acknowledged.
| |
| 13 # is the output from analysis. So the ndb.Model and assorted other things | |
| 14 # should be renamed appropriately. However, in general we don't yet have | |
| 15 # a standard for distinguishing the namedtuples used internally by azalea | |
| 16 # vs the ndb.Models for storing those namedtuples in the appengine | |
| 17 # application; so we'll want to come up with a naming scheme for that. | |
| 18 class CrashReport(namedtuple('CrashReport', | |
| 19 ['crashed_version', 'signature', 'platform', 'stacktrace', | |
| 20 'regression_range'])): | |
| 21 """A reported crash we want to analyze. | |
| 22 | |
| 23 Args: | |
| 24 crashed_version (str): The version of Chrome in which the crash occurred. | |
| 25 signature (str): The signature of the crash on the Chrome crash server. | |
| 26 platform (str): The platform name; e.g., 'win', 'mac', 'linux', 'android', | |
| 27 'ios', etc. | |
| 28 stacktrace (Stacktrace): The stacktrace of the crash. N.B., this is | |
| 29 an object generated by parsing the string containing the stack trace; | |
| 30 we do not store the string itself. | |
| 31 regression_range : a pair of the last-good and first-bad versions. | |
| 32 """ | |
| 33 __slots__ = () | |
| 34 | |
| 35 def __new__(cls, crashed_version, signature, platform, stacktrace, regression_ range): | |
| 36 if not isinstance(stacktrace, Stacktrace): | |
| 37 raise TypeError('In the fourth argument to CrashReport constructor, ' | |
| 38 'expected Stacktrace object, but got %s object instead.' % | |
| 39 stacktrace.__class__.__name__) | |
| 40 | |
| 41 return super(cls, CrashReport).__new__(cls, | |
| 42 crashed_version, signature, platform, stacktrace, regression_range) | |
| OLD | NEW |