Use the telemetry collector to append an additional telemetry property for launch request.

This commit is contained in:
Chance An 2018-03-21 17:54:59 -07:00
Родитель 6a1b6e92dd
Коммит 736af28f46
3 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -24,7 +24,7 @@
],
"license": "SEE LICENSE IN LICENSE.txt",
"dependencies": {
"vscode-chrome-debug-core": "^3.23.10",
"vscode-chrome-debug-core": "^3.23.11",
"vscode-debugadapter": "^1.28.0-pre.2",
"vscode-nls": "^3.2.1"
},

Просмотреть файл

@ -6,7 +6,7 @@ import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides, ChromeDebugSession, telemetry } from 'vscode-chrome-debug-core';
import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides, ChromeDebugSession, telemetry, ITelemetryPropertyCollector } from 'vscode-chrome-debug-core';
import { spawn, ChildProcess, fork, execSync } from 'child_process';
import { Crdp } from 'vscode-chrome-debug-core';
import { DebugProtocol } from 'vscode-debugprotocol';
@ -48,13 +48,16 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
return capabilities;
}
public launch(args: ILaunchRequestArgs): Promise<void> {
public launch(args: ILaunchRequestArgs, telemetryPropertyCollector: ITelemetryPropertyCollector, seq?: number): Promise<void> {
if (args.breakOnLoad && !args.breakOnLoadStrategy) {
args.breakOnLoadStrategy = 'instrument';
}
return super.launch(args).then(async () => {
return super.launch(args, telemetryPropertyCollector).then(async () => {
let runtimeExecutable: string;
if (args.shouldLaunchChromeUnelevated !== undefined) {
telemetryPropertyCollector.addTelemetryProperty('shouldLaunchChromeUnelevated', args.shouldLaunchChromeUnelevated.toString());
}
if (args.runtimeExecutable) {
const re = findExecutable(args.runtimeExecutable);
if (!re) {

Просмотреть файл

@ -3,7 +3,7 @@
*--------------------------------------------------------*/
import { DebugProtocol } from 'vscode-debugprotocol';
import { chromeConnection, ISourceMapPathOverrides } from 'vscode-chrome-debug-core';
import { chromeConnection, ISourceMapPathOverrides, telemetry } from 'vscode-chrome-debug-core';
import * as mockery from 'mockery';
import { EventEmitter } from 'events';
@ -121,7 +121,8 @@ suite('ChromeDebugAdapter', () => {
.setup(x => x.evaluate(It.isAny()))
.returns(() => Promise.resolve<any>({ result: { type: 'string', value: '123' }}));
return chromeDebugAdapter.launch({ file: 'c:\\path with space\\index.html', runtimeArgs: ['abc', 'def'] })
return chromeDebugAdapter.launch({ file: 'c:\\path with space\\index.html', runtimeArgs: ['abc', 'def'] },
new telemetry.TelemetryPropertyCollector())
.then(() => assert(spawnCalled));
});
});