提交 52648449 编写于 作者: R Ramya Achutha Rao

Update GDPR annotations for error telemetry

上级 2aa30865
...@@ -12,22 +12,35 @@ import { IDisposable, toDisposable, dispose } from 'vs/base/common/lifecycle'; ...@@ -12,22 +12,35 @@ import { IDisposable, toDisposable, dispose } from 'vs/base/common/lifecycle';
import * as Errors from 'vs/base/common/errors'; import * as Errors from 'vs/base/common/errors';
import { safeStringify } from 'vs/base/common/objects'; import { safeStringify } from 'vs/base/common/objects';
/* __GDPR__FRAGMENT__
"ErrorEvent" : {
"stack": { "classification": "CustomerContent", "purpose": "PerformanceAndHealth" },
"message" : { "classification": "CustomerContent", "purpose": "PerformanceAndHealth" },
"filename" : { "classification": "CustomerContent", "purpose": "PerformanceAndHealth" },
"callstack": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"msg" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"file" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"line": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "isMeasurement": true },
"column": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "isMeasurement": true },
"name": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"count": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "isMeasurement": true }
}
*/
interface ErrorEvent { interface ErrorEvent {
stack: string; callstack: string;
message?: string; msg?: string;
filename?: string; file?: string;
line?: number; line?: number;
column?: number; column?: number;
error?: { name: string; message: string; }; name?: string;
count?: number; count?: number;
} }
namespace ErrorEvent { namespace ErrorEvent {
export function compare(a: ErrorEvent, b: ErrorEvent) { export function compare(a: ErrorEvent, b: ErrorEvent) {
if (a.stack < b.stack) { if (a.callstack < b.callstack) {
return -1; return -1;
} else if (a.stack > b.stack) { } else if (a.callstack > b.callstack) {
return 1; return 1;
} }
return 0; return 0;
...@@ -89,32 +102,35 @@ export default class ErrorTelemetry { ...@@ -89,32 +102,35 @@ export default class ErrorTelemetry {
} }
// work around behavior in workerServer.ts that breaks up Error.stack // work around behavior in workerServer.ts that breaks up Error.stack
let stack = Array.isArray(err.stack) ? err.stack.join('\n') : err.stack; let callstack = Array.isArray(err.stack) ? err.stack.join('\n') : err.stack;
let message = err.message ? err.message : safeStringify(err); let msg = err.message ? err.message : safeStringify(err);
// errors without a stack are not useful telemetry // errors without a stack are not useful telemetry
if (!stack) { if (!callstack) {
return; return;
} }
this._enqueue({ message, stack }); this._enqueue({ msg, callstack });
} }
private _onUncaughtError(message: string, filename: string, line: number, column?: number, err?: any): void { private _onUncaughtError(msg: string, file: string, line: number, column?: number, err?: any): void {
let data: ErrorEvent = { let data: ErrorEvent = {
stack: message, callstack: msg,
message, msg,
filename, file,
line, line,
column column
}; };
if (err) { if (err) {
let { name, message, stack } = err; let { name, message, stack } = err;
data.error = { name, message }; data.name = name;
if (message) {
data.msg = message;
}
if (stack) { if (stack) {
data.stack = Array.isArray(err.stack) data.callstack = Array.isArray(err.stack)
? err.stack = err.stack.join('\n') ? err.stack = err.stack.join('\n')
: err.stack; : err.stack;
} }
...@@ -145,17 +161,9 @@ export default class ErrorTelemetry { ...@@ -145,17 +161,9 @@ export default class ErrorTelemetry {
for (let error of this._buffer) { for (let error of this._buffer) {
/* __GDPR__ /* __GDPR__
"UnhandledError" : { "UnhandledError" : {
"filename" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, "${include}": [ "${ErrorEvent}" ]
"message" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"name": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"stack": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"id": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" },
"line": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "isMeasurement": true },
"column": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "isMeasurement": true },
"count": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "isMeasurement": true }
} }
*/ */
// __GDPR__TODO__ what's the complete set of properties?
this._telemetryService.publicLog('UnhandledError', error); this._telemetryService.publicLog('UnhandledError', error);
} }
this._buffer.length = 0; this._buffer.length = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册