Just trigger for fatal logs and error logs with tag AndroidRuntime
Summary: This diff updates the check which triggers crash notifications. We got a user feedback that crash reporter used to report non fatal crash too and it used to annoy users with bombardment of crash notifications. Reviewed By: passy Differential Revision: D13878272 fbshipit-source-id: 75446f08f806e8f28a6f68953c0a001fd18a7dc0
This commit is contained in:
committed by
Facebook Github Bot
parent
500007ccca
commit
f12226ac00
@@ -31,7 +31,7 @@ export {
|
|||||||
DeviceLogEntry,
|
DeviceLogEntry,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
} from './devices/BaseDevice.js';
|
} from './devices/BaseDevice.js';
|
||||||
export {shouldParseAndroidLog} from './fb-stubs/crashReporterUtility.js';
|
export {shouldParseAndroidLog} from './utils/crashReporterUtility.js';
|
||||||
export {createTablePlugin} from './createTablePlugin.js';
|
export {createTablePlugin} from './createTablePlugin.js';
|
||||||
export {default as DetailSidebar} from './chrome/DetailSidebar.js';
|
export {default as DetailSidebar} from './chrome/DetailSidebar.js';
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ function getAndroidLog(
|
|||||||
return {date, type, tag, message, app: 'testapp', pid: 0, tid: 0};
|
return {date, type, tag, message, app: 'testapp', pid: 0, tid: 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
test('test shouldParseAndroidLog function for type error and tag has flipper mention', () => {
|
test('test shouldParseAndroidLog function for type error and tag is AndroidRuntime', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
let log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'error',
|
'error',
|
||||||
'flipper.activitymanager',
|
'AndroidRuntime',
|
||||||
'Possible error',
|
'Possible runtime crash',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
expect(shouldParseTheLog).toEqual(true);
|
||||||
@@ -32,8 +32,8 @@ test('test shouldParseAndroidLog function for type non-error', () => {
|
|||||||
let log: DeviceLogEntry = getAndroidLog(
|
let log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'debug',
|
'debug',
|
||||||
'flipper.activitymanager',
|
'fb4a.activitymanager',
|
||||||
'Possible debug info in flipper',
|
'Possible debug info in activitymanager',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(false);
|
expect(shouldParseTheLog).toEqual(false);
|
||||||
@@ -43,75 +43,31 @@ test('test shouldParseAndroidLog function for the older android log', () => {
|
|||||||
let log: DeviceLogEntry = getAndroidLog(
|
let log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() - 10000), //This log arrives 10 secs before the refernce time
|
new Date(referenceDate.getTime() - 10000), //This log arrives 10 secs before the refernce time
|
||||||
'error',
|
'error',
|
||||||
'flipper.activitymanager',
|
'fb4a.activitymanager',
|
||||||
'Possible error info in activitymanager',
|
'Possible error info in activitymanager',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(false);
|
expect(shouldParseTheLog).toEqual(false);
|
||||||
});
|
});
|
||||||
|
test('test shouldParseAndroidLog function for the fatal log', () => {
|
||||||
|
const referenceDate = new Date();
|
||||||
|
let log: DeviceLogEntry = getAndroidLog(
|
||||||
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
|
'fatal',
|
||||||
|
'arbitrary tag',
|
||||||
|
'Possible error info in activitymanager',
|
||||||
|
);
|
||||||
|
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
|
expect(shouldParseTheLog).toEqual(true);
|
||||||
|
});
|
||||||
test('test shouldParseAndroidLog function for the error log which does not staisfy our tags check', () => {
|
test('test shouldParseAndroidLog function for the error log which does not staisfy our tags check', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
let log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'error',
|
'error',
|
||||||
'arbitrary tag',
|
'arbitrary tag',
|
||||||
'Possible error info in activitymanager',
|
'Possible error info in fb4a',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(false);
|
expect(shouldParseTheLog).toEqual(false);
|
||||||
});
|
});
|
||||||
test('test shouldParseAndroidLog function for the error log which does not staisfy our tags check but has mention of flipper', () => {
|
|
||||||
const referenceDate = new Date();
|
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
|
||||||
'error',
|
|
||||||
'arbitrary tag',
|
|
||||||
'Possible error info in flipper',
|
|
||||||
);
|
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
|
||||||
});
|
|
||||||
test('test shouldParseAndroidLog function for the error log which has flipper mentioned in the tag', () => {
|
|
||||||
const referenceDate = new Date();
|
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
|
||||||
'error',
|
|
||||||
'arbitrary flipper tag',
|
|
||||||
'Possible error info in facebook',
|
|
||||||
);
|
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
|
||||||
});
|
|
||||||
test('test shouldParseAndroidLog function for the error log which has tag libfbjni', () => {
|
|
||||||
const referenceDate = new Date();
|
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
|
||||||
'error',
|
|
||||||
'libfbjni',
|
|
||||||
'Possible error info in libfbjni',
|
|
||||||
);
|
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
|
||||||
});
|
|
||||||
test('test shouldParseAndroidLog function for the error log which has tag art', () => {
|
|
||||||
const referenceDate = new Date();
|
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
|
||||||
'error',
|
|
||||||
'art',
|
|
||||||
'Possible error info in wakizashi',
|
|
||||||
);
|
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
|
||||||
});
|
|
||||||
test('test shouldParseAndroidLog function for the error log which has tag AndroidRuntime', () => {
|
|
||||||
const referenceDate = new Date();
|
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
|
||||||
'error',
|
|
||||||
'AndroidRuntime',
|
|
||||||
'Possible error info in app',
|
|
||||||
);
|
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
|
||||||
});
|
|
||||||
@@ -11,17 +11,9 @@ export function shouldParseAndroidLog(
|
|||||||
entry: DeviceLogEntry,
|
entry: DeviceLogEntry,
|
||||||
date: Date,
|
date: Date,
|
||||||
): boolean {
|
): boolean {
|
||||||
const tagsCheck =
|
|
||||||
entry.tag === 'art' || // This tag is for jni errors from sample app
|
|
||||||
entry.tag === 'AndroidRuntime' || // This tag is for runtime java errors
|
|
||||||
entry.tag === 'libfbjni' || // Related to fbjni errors from flipper
|
|
||||||
entry.tag.includes('flipper');
|
|
||||||
|
|
||||||
const messagesCheck = entry.message.includes('flipper');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
entry.date.getTime() - date.getTime() > 0 && // The log should have arrived after the device has been registered
|
entry.date.getTime() - date.getTime() > 0 && // The log should have arrived after the device has been registered
|
||||||
entry.type === 'error' &&
|
((entry.type === 'error' && entry.tag === 'AndroidRuntime') ||
|
||||||
(tagsCheck || messagesCheck)
|
entry.type === 'fatal')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user