MCPcopy Create free account
hub / github.com/Snapchat/Valdi / reportBootTelemetry

Method reportBootTelemetry

valdi/vscode_debugger/src/binder.ts:220–254  ·  view source on GitHub ↗
(rawParams: AnyLaunchConfiguration)

Source from the content-addressed store, hash-verified

218 }
219
220 private reportBootTelemetry(rawParams: AnyLaunchConfiguration) {
221 const defaults = (applyDefaults({
222 type: rawParams.type,
223 request: rawParams.request,
224 name: '<string>',
225 __workspaceFolder: '<workspace>',
226 } as AnyResolvingConfiguration) as unknown) as { [key: string]: unknown };
227
228 // Sanitization function that strips non-default strings from the launch
229 // config, to avoid unnecessarily collecting information about the workspace.
230 const sanitizer = (value: unknown, key?: string): unknown => {
231 if (typeof value === 'string') {
232 return key && defaults[key] === value ? value : `<string>`;
233 }
234
235 if (value instanceof Array) {
236 return value.map(v => sanitizer(v));
237 }
238
239 if (value && typeof value === 'object') {
240 return mapValues(value as { [key: string]: unknown }, v => sanitizer(v));
241 }
242
243 return value;
244 };
245
246 this._rootServices.get<ITelemetryReporter>(ITelemetryReporter).report('launch', {
247 type: rawParams.type,
248 request: rawParams.request,
249 os: `${os.platform()} ${os.arch()}`,
250 nodeVersion: process.version,
251 adapterVersion: packageVersion,
252 parameters: mapValues((rawParams as unknown) as { [key: string]: unknown }, sanitizer),
253 });
254 }
255
256 async _restart() {
257 await Promise.all([...this.getLaunchers()].map(l => l.restart()));

Callers 1

_bootMethod · 0.95

Calls 4

applyDefaultsFunction · 0.90
mapValuesFunction · 0.90
reportMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected