Chromium Code Reviews| Index: build/android/tombstones.py |
| diff --git a/build/android/tombstones.py b/build/android/tombstones.py |
| index cba1e5a9f511da27af7e1b8c43e1df046118e81a..12da70c3d5e44aee32fbc53fb73d376acc017cad 100755 |
| --- a/build/android/tombstones.py |
| +++ b/build/android/tombstones.py |
| @@ -26,6 +26,10 @@ from devil.android import device_utils |
| from devil.utils import run_tests_helper |
| from pylib import constants |
| +sys.path.insert(0, os.path.abspath(os.path.join( |
| + constants.DIR_SOURCE_ROOT, 'tools', 'swarming_client'))) |
| +from libs.logdog import bootstrap # pylint: disable=import-error |
| + |
| _TZ_UTC = {'TZ': 'UTC'} |
| @@ -230,7 +234,8 @@ def ClearAllTombstones(device): |
| _EraseTombstone(device, tombstone_file) |
| def ResolveTombstones(device, resolve_all_tombstones, include_stack_symbols, |
| - wipe_tombstones, jobs=4): |
| + wipe_tombstones, jobs=4, save_to_logdog=False, |
| + stream_name=None): |
| """Resolve tombstones in the device. |
| Args: |
| @@ -239,12 +244,33 @@ def ResolveTombstones(device, resolve_all_tombstones, include_stack_symbols, |
| include_stack_symbols: Whether to include symbols for stack data. |
| wipe_tombstones: Whether to wipe tombstones. |
| jobs: Number of jobs to use when processing multiple crash stacks. |
| + save_to_logdog: Whether will save tombstones to logdog. |
| + stream_name: The name of the logdog stream that records tombstones. |
| """ |
| - return _ResolveTombstones(jobs, |
| - _GetTombstonesForDevice(device, |
| - resolve_all_tombstones, |
| - include_stack_symbols, |
| - wipe_tombstones)) |
| + tombstones = _ResolveTombstones(jobs, |
| + _GetTombstonesForDevice( |
| + device, |
| + resolve_all_tombstones, |
| + include_stack_symbols, |
| + wipe_tombstones)) |
| + if not save_to_logdog or not stream_name: |
| + return tombstones |
| + else: |
|
jbudorick
2016/12/14 01:34:04
This should be handled by a separate function that
BigBossZhiling
2016/12/14 17:08:21
Done.
|
| + try: |
| + tombstones_url = '' |
| + stream_client = bootstrap.ButlerBootstrap.probe().stream_client() |
| + logdog_stream = stream_client.open_text(stream_name) |
| + for tombstones_line in tombstones: |
| + logdog_stream.write(tombstones_line + '\n') |
| + tombstones_url = logdog_stream.get_viewer_url(stream_name) |
| + logdog_stream.close() |
| + except bootstrap.NotBootstrappedError: |
| + logging.exception('Error not bootstrapped. Failed to start logdog') |
| + except (KeyError, ValueError) as e: |
| + logging.exception('Error when creating stream_client/stream: %s.', e) |
| + except Exception as e: # pylint: disable=broad-except |
| + logging.exception('Unknown Error: %s.', e) |
| + return tombstones_url |
| def main(): |
| custom_handler = logging.StreamHandler(sys.stdout) |