mirror of
https://github.com/Microsoft/vscode
synced 2024-09-20 19:18:03 +00:00
fix telemetry use in debug
This commit is contained in:
parent
10ef24fb76
commit
ac88c617f6
|
@ -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();
|
||||
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")));
|
||||
}
|
||||
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
|
||||
// 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);
|
||||
}
|
||||
|
||||
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 }));
|
||||
});
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue