perfetto-ui: Add exception logging
Change-Id: I37dc3e2e1acf543a2d0533f392b26913f0a90252
diff --git a/ui/src/common/analytics.ts b/ui/src/common/analytics.ts
index 0cbe714..9ea1a39 100644
--- a/ui/src/common/analytics.ts
+++ b/ui/src/common/analytics.ts
@@ -31,4 +31,8 @@
logEvent(category: TraceCategories|null, event: string) {
gtag('event', event, {'event_category': category});
}
+
+ logError(description: string, fatal = true) {
+ gtag('event', 'exception', {description, fatal});
+ }
}
diff --git a/ui/src/frontend/error_dialog.ts b/ui/src/frontend/error_dialog.ts
index d5f6501..f37774e 100644
--- a/ui/src/frontend/error_dialog.ts
+++ b/ui/src/frontend/error_dialog.ts
@@ -14,6 +14,7 @@
import * as m from 'mithril';
+import {globals} from './globals';
import {showModal} from './modal';
// Never show more than one dialog per minute.
@@ -25,6 +26,7 @@
const ERR_QUEUE_MAX_LEN = 10;
export function maybeShowErrorDialog(errLog: string) {
+ globals.logging.logError(errLog);
const now = performance.now();
// Here we rely on the exception message from onCannotGrowMemory function
diff --git a/ui/src/frontend/router_jsdomtest.ts b/ui/src/frontend/router_jsdomtest.ts
index 02c2e59..7ff0e9e 100644
--- a/ui/src/frontend/router_jsdomtest.ts
+++ b/ui/src/frontend/router_jsdomtest.ts
@@ -26,7 +26,8 @@
const mockLogging = {
updatePath(_: string) {},
- logEvent(_x: null, _y: string) {}
+ logEvent(_x: null, _y: string) {},
+ logError(_x: string) {}
};
beforeEach(() => {