Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Unified Diff: tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent.py

Issue 997193002: [Telemetry] Make chrome_tracing_agent state more resilient to tracing exception. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent.py
diff --git a/tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent.py b/tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent.py
index b3bb05d7eff57831d166e7ccf1bae438edbda67e..81cf267af52583eca9ab7a6a79ad957db36e878a 100644
--- a/tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent.py
+++ b/tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent.py
@@ -1,6 +1,8 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import sys
+import traceback
from telemetry.core.platform import tracing_agent
@@ -9,6 +11,10 @@ class ChromeTracingStartedError(Exception):
pass
+class ChromeTracingStoppedError(Exception):
+ pass
+
+
class ChromeTracingAgent(tracing_agent.TracingAgent):
# A singleton map from platform backends to maps of uniquely-identifying
# remote port (which may be the same as local port) to DevToolsClientBackend.
@@ -90,9 +96,21 @@ class ChromeTracingAgent(tracing_agent.TracingAgent):
def Stop(self, trace_data_builder):
devtools_clients_map = (
self._platform_backends_to_devtools_clients_maps[self._platform_backend])
- for _, devtools_client in devtools_clients_map.iteritems():
+ raised_execption_messages = []
+ for devtools_port, devtools_client in devtools_clients_map.iteritems():
# We do not check for stale DevTools client, so that we get an
# exception if there is a stale client. This is because we
# will potentially lose data if there is a stale client.
- devtools_client.StopChromeTracing(trace_data_builder)
+ try:
+ devtools_client.StopChromeTracing(trace_data_builder)
+ except Exception:
+ raised_execption_messages.append(
+ 'Error when trying to stop tracing on devtools at port %s:\n%s'
+ % (devtools_port,
+ ''.join(traceback.format_exception(*sys.exc_info()))))
+
self._is_active = False
+ if raised_execption_messages:
+ raise ChromeTracingStoppedError(
+ 'Exceptions raised when trying to stop devtool tracing\n:' +
+ '\n'.join(raised_execption_messages))
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/tracing_agent/chrome_tracing_agent_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698