Skip to content

Commit

Permalink
debug: custom telemetry service should be per session
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Sep 22, 2017
1 parent 4970b66 commit 45bc150
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class DebugService implements debug.IDebugService {
private viewModel: ViewModel;
private allProcesses: Map<string, debug.IProcess>;
private configurationManager: ConfigurationManager;
private customTelemetryService: ITelemetryService;
private toDispose: lifecycle.IDisposable[];
private toDisposeOnSessionEnd: Map<string, lifecycle.IDisposable[]>;
private inDebugMode: IContextKey<boolean>;
Expand Down Expand Up @@ -328,8 +327,8 @@ export class DebugService implements debug.IDebugService {
if (event.body.category === 'telemetry') {
// only log telemetry events from debug adapter if the adapter provided the telemetry key
// and the user opted in telemetry
if (this.customTelemetryService && this.telemetryService.isOptedIn) {
this.customTelemetryService.publicLog(event.body.output, event.body.data);
if (session.customTelemetryService && this.telemetryService.isOptedIn) {
session.customTelemetryService.publicLog(event.body.output, event.body.data);
}

return;
Expand Down Expand Up @@ -821,9 +820,9 @@ export class DebugService implements debug.IDebugService {
const adapter = this.configurationManager.getAdapter(configuration.type);
const { aiKey, type } = adapter;
const publisher = adapter.extensionDescription.publisher;
this.customTelemetryService = null;
let client: TelemetryClient;

let customTelemetryService: TelemetryService;
if (aiKey) {
client = new TelemetryClient(
uri.parse(require.toUrl('bootstrap')).fsPath,
Expand All @@ -842,10 +841,10 @@ export class DebugService implements debug.IDebugService {
const channel = client.getChannel('telemetryAppender');
const appender = new TelemetryAppenderClient(channel);

this.customTelemetryService = new TelemetryService({ appender }, this.configurationService);
customTelemetryService = new TelemetryService({ appender }, this.configurationService);
}

const session = this.instantiationService.createInstance(RawDebugSession, sessionId, configuration.debugServer, adapter, this.customTelemetryService, root);
const session = this.instantiationService.createInstance(RawDebugSession, sessionId, configuration.debugServer, adapter, customTelemetryService, root);
const process = this.model.addProcess(configuration, session);
this.allProcesses.set(process.getId(), process);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class RawDebugSession extends V8Protocol implements debug.ISession {
id: string,
private debugServerPort: number,
private adapter: Adapter,
private customTelemetryService: ITelemetryService,
public customTelemetryService: ITelemetryService,
public root: IWorkspaceFolder,
@IMessageService private messageService: IMessageService,
@ITelemetryService private telemetryService: ITelemetryService,
Expand Down

0 comments on commit 45bc150

Please sign in to comment.