提交 05c236fc 编写于 作者: S Sofian Hnaide

Merge pull request #3054 from Microsoft/isidorn/debug-telemetry

debug: telemetry key contributed by debug adapters
......@@ -198,6 +198,7 @@ export interface IRawAdapter extends IRawEnvAdapter {
enableBreakpointsFor?: { languageIds: string[] };
configurationAttributes?: any;
initialConfigurations?: any[];
aiKey?: string;
win?: IRawEnvAdapter;
winx86?: IRawEnvAdapter;
windows?: IRawEnvAdapter;
......
......@@ -16,6 +16,7 @@ import severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import editor = require('vs/editor/common/editorCommon');
import aria = require('vs/base/browser/ui/aria/aria');
import { AIAdapter } from 'vs/base/node/aiAdapter';
import editorbrowser = require('vs/editor/browser/editorBrowser');
import { IKeybindingService, IKeybindingContextKey } from 'vs/platform/keybinding/common/keybindingService';
import {IMarkerService} from 'vs/platform/markers/common/markers';
......@@ -65,6 +66,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
private viewModel: viewmodel.ViewModel;
private configurationManager: ConfigurationManager;
private debugStringEditorInputs: DebugStringEditorInput[];
private telemetryAdapter: AIAdapter;
private lastTaskEvent: TaskEvent;
private toDispose: lifecycle.IDisposable[];
private inDebugMode: IKeybindingContextKey<boolean>;
......@@ -282,7 +284,15 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.toDispose.push(this.session.addListener2(debug.SessionEvents.OUTPUT, (event: DebugProtocol.OutputEvent) => {
if (event.body && event.body.category === 'telemetry') {
this.telemetryService.publicLog(event.body.output, event.body.data);
const key = this.configurationManager.getAdapter().aiKey;
// only log telemetry events from debug adapter if the adapter provided the telemetry key
if (key) {
if (!this.telemetryAdapter) {
this.telemetryAdapter = new AIAdapter(key, this.session.getType());
}
this.telemetryAdapter.log(event.body.output, event.body.data);
}
} else if (event.body && typeof event.body.output === 'string' && event.body.output.length > 0) {
this.onOutput(event);
}
......@@ -673,6 +683,10 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
});
this.model.updateBreakpoints(data);
if (this.telemetryAdapter) {
this.telemetryAdapter.dispose();
this.telemetryAdapter = null;
}
this.inDebugMode.reset();
}
......
......@@ -20,6 +20,7 @@ export class Adapter {
private configurationAttributes: any;
public initialConfigurations: any[];
public enableBreakpointsFor: { languageIds: string[] };
public aiKey: string;
constructor(rawAdapter: debug.IRawAdapter, systemVariables: SystemVariables, extensionFolderPath: string) {
if (rawAdapter.windows) {
......@@ -67,6 +68,7 @@ export class Adapter {
this.initialConfigurations = rawAdapter.initialConfigurations;
this._label = rawAdapter.label;
this.enableBreakpointsFor = rawAdapter.enableBreakpointsFor;
this.aiKey = rawAdapter.aiKey;
}
public get label() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册