-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telemetry Command #76029
Telemetry Command #76029
Changes from all commits
5424aa3
1d1d0f1
947ff83
831a547
f25400c
d5598a9
9d2e9d6
136e1bb
c1159dc
976e227
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,8 @@ const vscodeResources = [ | |
'out-build/bootstrap-amd.js', | ||
'out-build/bootstrap-window.js', | ||
'out-build/paths.js', | ||
'out-build/telemetry-core.json', | ||
'out-build/telemetry-extensions.json', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lramos15 I noticed this code isn't in master anymore but it wasn't removed during the PR to remove the command. What happened to it? |
||
'out-build/vs/**/*.{svg,png,cur,html}', | ||
'!out-build/vs/code/browser/**/*.html', | ||
'out-build/vs/base/common/performance.js', | ||
|
@@ -327,7 +329,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op | |
.pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar')); | ||
|
||
let all = es.merge( | ||
packageJsonStream, | ||
packageJsonStream, | ||
productJsonStream, | ||
license, | ||
api, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ export interface ParsedArgs { | |
_urls?: string[]; | ||
help?: boolean; | ||
version?: boolean; | ||
telemetry?: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lramos15 shouldn't break anything but missed this arg when removing the command |
||
status?: boolean; | ||
wait?: boolean; | ||
waitMarkerFilePath?: string; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ import * as os from 'os'; | |
import { localize } from 'vs/nls'; | ||
import { ParsedArgs } from 'vs/platform/environment/common/environment'; | ||
import { join } from 'vs/base/common/path'; | ||
import { writeFileSync } from 'vs/base/node/pfs'; | ||
import { statSync, readFileSync } from 'fs'; | ||
import { writeFileSync, readdirSync } from 'vs/base/node/pfs'; | ||
|
||
/** | ||
* This code is also used by standalone cli's. Avoid adding any other dependencies. | ||
|
@@ -41,6 +42,7 @@ export const options: Option[] = [ | |
{ id: 'user-data-dir', type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") }, | ||
{ id: 'version', type: 'boolean', cat: 'o', alias: 'v', description: localize('version', "Print version.") }, | ||
{ id: 'help', type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") }, | ||
{ id: 'telemetry', type: 'boolean', cat: 'o', description: localize('telemetry', "Shows all telemetry events which VS code collects.") }, | ||
{ id: 'folder-uri', type: 'string', cat: 'o', args: 'uri', description: localize('folderUri', "Opens a window with given folder uri(s)") }, | ||
{ id: 'file-uri', type: 'string', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") }, | ||
|
||
|
@@ -217,6 +219,38 @@ export function buildVersionMessage(version: string | undefined, commit: string | |
return `${version || localize('unknownVersion', "Unknown version")}\n${commit || localize('unknownCommit', "Unknown commit")}\n${process.arch}`; | ||
} | ||
|
||
export function buildTelemetryMessage(appRoot: string, extensionsPath: string): string { | ||
try { | ||
lramos15 marked this conversation as resolved.
Show resolved
Hide resolved
joaomoreno marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Gets all the directories inside the extension directory | ||
const dirs = readdirSync(extensionsPath).filter(files => statSync(join(extensionsPath, files)).isDirectory()); | ||
const telemetryJsonFolders: string[] = []; | ||
dirs.forEach((dir) => { | ||
const files = readdirSync(join(extensionsPath, dir)).filter(file => file === 'telemetry.json'); | ||
// We know it contains a telemetry.json file so we add it to the list of folders which have one | ||
if (files.length === 1) { | ||
telemetryJsonFolders.push(dir); | ||
} | ||
}); | ||
const mergedTelemetry = Object.create(null); | ||
// Simple function to merge the telemetry into one json object | ||
const mergeTelemetry = (contents: string, dirName: string) => { | ||
const telemetryData = JSON.parse(contents); | ||
mergedTelemetry[dirName] = telemetryData; | ||
}; | ||
telemetryJsonFolders.forEach((folder) => { | ||
const contents = readFileSync(join(extensionsPath, folder, 'telemetry.json')).toString(); | ||
mergeTelemetry(contents, folder); | ||
}); | ||
let contents = readFileSync(join(appRoot, 'out/', 'telemetry-core.json')).toString(); | ||
mergeTelemetry(contents, 'vscode-core'); | ||
contents = readFileSync(join(appRoot, 'out/', 'telemetry-extensions.json')).toString(); | ||
mergeTelemetry(contents, 'vscode-extensions'); | ||
return JSON.stringify(mergedTelemetry, null, 4); | ||
} catch (err) { | ||
return 'Unable to read VS Code telemetry events!'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just remove the whole |
||
} | ||
} | ||
|
||
/** | ||
* Converts an argument into an array | ||
* @param arg a argument value. Can be undefined, an entry or an array | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So Darwin doesn't need a specific build script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the
echo
. 👍