提交 ac88c617 编写于 作者: J Joao Moreno

fix telemetry use in debug

上级 10ef24fb
......@@ -555,75 +555,75 @@ export class DebugService implements debug.IDebugService {
private doCreateSession(configuration: debug.IConfig): TPromise<any> {
this.setStateAndEmit(debug.State.Initializing);
this.telemetryService.getTelemetryInfo().then(info => {
return this.telemetryService.getTelemetryInfo().then(info => {
const telemetryInfo: { [key: string]: string } = Object.create(null);
telemetryInfo['common.vscodemachineid'] = info.machineId;
telemetryInfo['common.vscodesessionid'] = info.sessionId;
return telemetryInfo;
}).then(data => {
let {aiKey, type} = this.configurationManager.adapter;
const { aiKey, type } = this.configurationManager.adapter;
this.telemetryAdapter = createAIAdapter(aiKey, type, data);
});
this.session = this.instantiationService.createInstance(session.RawDebugSession, configuration.debugServer, this.configurationManager.adapter, this.telemetryAdapter);
this.registerSessionListeners();
return this.session.initialize({
adapterID: configuration.type,
pathFormat: 'path',
linesStartAt1: true,
columnsStartAt1: true
}).then((result: DebugProtocol.InitializeResponse) => {
if (!this.session) {
return TPromise.wrapError(new Error(nls.localize('debugAdapterCrash', "Debug adapter process has terminated unexpectedly")));
}
this.session = this.instantiationService.createInstance(session.RawDebugSession, configuration.debugServer, this.configurationManager.adapter, this.telemetryAdapter);
this.registerSessionListeners();
return this.session.initialize({
adapterID: configuration.type,
pathFormat: 'path',
linesStartAt1: true,
columnsStartAt1: true
}).then((result: DebugProtocol.InitializeResponse) => {
if (!this.session) {
return TPromise.wrapError(new Error(nls.localize('debugAdapterCrash', "Debug adapter process has terminated unexpectedly")));
}
this.model.setExceptionBreakpoints(this.session.configuration.capabilities.exceptionBreakpointFilters);
return configuration.request === 'attach' ? this.session.attach(configuration) : this.session.launch(configuration);
}).then((result: DebugProtocol.Response) => {
if (configuration.internalConsoleOptions === 'openOnSessionStart' || (!this.viewModel.changedWorkbenchViewState && configuration.internalConsoleOptions !== 'neverOpen')) {
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
this.model.setExceptionBreakpoints(this.session.configuration.capabilities.exceptionBreakpointFilters);
return configuration.request === 'attach' ? this.session.attach(configuration) : this.session.launch(configuration);
}).then((result: DebugProtocol.Response) => {
if (configuration.internalConsoleOptions === 'openOnSessionStart' || (!this.viewModel.changedWorkbenchViewState && configuration.internalConsoleOptions !== 'neverOpen')) {
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
if (!this.viewModel.changedWorkbenchViewState && !this.partService.isSideBarHidden()) {
// We only want to change the workbench view state on the first debug session #5738 and if the side bar is not hidden
this.viewModel.changedWorkbenchViewState = true;
this.viewletService.openViewlet(debug.VIEWLET_ID);
}
if (!this.viewModel.changedWorkbenchViewState && !this.partService.isSideBarHidden()) {
// We only want to change the workbench view state on the first debug session #5738 and if the side bar is not hidden
this.viewModel.changedWorkbenchViewState = true;
this.viewletService.openViewlet(debug.VIEWLET_ID);
}
// Do not change status bar to orange if we are just running without debug.
if (!configuration.noDebug) {
this.partService.addClass('debugging');
}
this.extensionService.activateByEvent(`onDebug:${configuration.type}`).done(null, errors.onUnexpectedError);
this.contextService.updateOptions('editor', {
glyphMargin: true
});
this.inDebugMode.set(true);
this.lazyTransitionToRunningState();
// Do not change status bar to orange if we are just running without debug.
if (!configuration.noDebug) {
this.partService.addClass('debugging');
}
this.extensionService.activateByEvent(`onDebug:${configuration.type}`).done(null, errors.onUnexpectedError);
this.contextService.updateOptions('editor', {
glyphMargin: true
});
this.inDebugMode.set(true);
this.lazyTransitionToRunningState();
this.telemetryService.publicLog('debugSessionStart', {
type: configuration.type,
breakpointCount: this.model.getBreakpoints().length,
exceptionBreakpoints: this.model.getExceptionBreakpoints(),
watchExpressionsCount: this.model.getWatchExpressions().length,
extensionName: `${ this.configurationManager.adapter.extensionDescription.publisher }.${ this.configurationManager.adapter.extensionDescription.name }`,
isBuiltin: this.configurationManager.adapter.extensionDescription.isBuiltin
});
}).then(undefined, (error: any) => {
this.telemetryService.publicLog('debugMisconfiguration', { type: configuration ? configuration.type : undefined });
this.setStateAndEmit(debug.State.Inactive);
if (this.session) {
this.session.disconnect();
}
// Show the repl if some error got logged there #5870
if (this.model.getReplElements().length > 0) {
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
this.telemetryService.publicLog('debugSessionStart', {
type: configuration.type,
breakpointCount: this.model.getBreakpoints().length,
exceptionBreakpoints: this.model.getExceptionBreakpoints(),
watchExpressionsCount: this.model.getWatchExpressions().length,
extensionName: `${ this.configurationManager.adapter.extensionDescription.publisher }.${ this.configurationManager.adapter.extensionDescription.name }`,
isBuiltin: this.configurationManager.adapter.extensionDescription.isBuiltin
const configureAction = this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL);
const actions = (error.actions && error.actions.length) ? error.actions.concat([configureAction]) : [CloseAction, configureAction];
return TPromise.wrapError(errors.create(error.message, { actions }));
});
}).then(undefined, (error: any) => {
this.telemetryService.publicLog('debugMisconfiguration', { type: configuration ? configuration.type : undefined });
this.setStateAndEmit(debug.State.Inactive);
if (this.session) {
this.session.disconnect();
}
// Show the repl if some error got logged there #5870
if (this.model.getReplElements().length > 0) {
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
const configureAction = this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL);
const actions = (error.actions && error.actions.length) ? error.actions.concat([configureAction]) : [CloseAction, configureAction];
return TPromise.wrapError(errors.create(error.message, { actions }));
});
}
......
......@@ -146,7 +146,9 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
const message = error ? debug.formatPII(error.format, false, error.variables) : errorResponse.message;
if (error && error.sendTelemetry) {
this.telemetryService.publicLog('debugProtocolErrorResponse', { error: message });
this.telemtryAdapter.log('debugProtocolErrorResponse', { error: message });
if (this.telemtryAdapter) {
this.telemtryAdapter.log('debugProtocolErrorResponse', { error: message });
}
}
if (error && error.showUser === false) {
return TPromise.as(null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册