forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
2135 lines (2087 loc) · 85.2 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* eslint-disable global-require */
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import TelemetryReporter from '@vscode/extension-telemetry';
import { DiagnosticCodes } from '../application/diagnostics/constants';
import { IWorkspaceService } from '../common/application/types';
import { AppinsightsKey, isTestExecution, isUnitTestExecution } from '../common/constants';
import type { TerminalShellType } from '../common/terminal/types';
import { StopWatch } from '../common/utils/stopWatch';
import { isPromise } from '../common/utils/async';
import { DebugConfigurationType } from '../debugger/extension/types';
import { ConsoleType, TriggerType } from '../debugger/types';
import { LinterId } from '../linters/types';
import { EnvironmentType, PythonEnvironment } from '../pythonEnvironments/info';
import {
TensorBoardPromptSelection,
TensorBoardEntrypointTrigger,
TensorBoardSessionStartResult,
TensorBoardEntrypoint,
} from '../tensorBoard/constants';
import { EventName } from './constants';
import type { LinterTrigger, TestTool } from './types';
/**
* Checks whether telemetry is supported.
* Its possible this function gets called within Debug Adapter, vscode isn't available in there.
* Within DA, there's a completely different way to send telemetry.
* @returns {boolean}
*/
function isTelemetrySupported(): boolean {
try {
const vsc = require('vscode');
const reporter = require('@vscode/extension-telemetry');
return vsc !== undefined && reporter !== undefined;
} catch {
return false;
}
}
/**
* Checks if the telemetry is disabled in user settings
* @returns {boolean}
*/
export function isTelemetryDisabled(workspaceService: IWorkspaceService): boolean {
const settings = workspaceService.getConfiguration('telemetry').inspect<boolean>('enableTelemetry')!;
return settings.globalValue === false;
}
const sharedProperties: Record<string, unknown> = {};
/**
* Set shared properties for all telemetry events.
*/
export function setSharedProperty<P extends ISharedPropertyMapping, E extends keyof P>(name: E, value?: P[E]): void {
const propertyName = name as string;
// Ignore such shared telemetry during unit tests.
if (isUnitTestExecution() && propertyName.startsWith('ds_')) {
return;
}
if (value === undefined) {
delete sharedProperties[propertyName];
} else {
sharedProperties[propertyName] = value;
}
}
/**
* Reset shared properties for testing purposes.
*/
export function _resetSharedProperties(): void {
for (const key of Object.keys(sharedProperties)) {
delete sharedProperties[key];
}
}
let telemetryReporter: TelemetryReporter | undefined;
function getTelemetryReporter() {
if (!isTestExecution() && telemetryReporter) {
return telemetryReporter;
}
const Reporter = require('@vscode/extension-telemetry').default as typeof TelemetryReporter;
telemetryReporter = new Reporter(AppinsightsKey, [
{
lookup: /(errorName|errorMessage|errorStack)/g,
},
]);
return telemetryReporter;
}
export function clearTelemetryReporter(): void {
telemetryReporter = undefined;
}
export function sendTelemetryEvent<P extends IEventNamePropertyMapping, E extends keyof P>(
eventName: E,
measuresOrDurationMs?: Record<string, number> | number,
properties?: P[E],
ex?: Error,
): void {
if (isTestExecution() || !isTelemetrySupported()) {
return;
}
const reporter = getTelemetryReporter();
const measures =
typeof measuresOrDurationMs === 'number'
? { duration: measuresOrDurationMs }
: measuresOrDurationMs || undefined;
const customProperties: Record<string, string> = {};
const eventNameSent = eventName as string;
if (properties) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const data = properties as any;
Object.getOwnPropertyNames(data).forEach((prop) => {
if (data[prop] === undefined || data[prop] === null) {
return;
}
try {
// If there are any errors in serializing one property, ignore that and move on.
// Else nothing will be sent.
switch (typeof data[prop]) {
case 'string':
customProperties[prop] = data[prop];
break;
case 'object':
customProperties[prop] = 'object';
break;
default:
customProperties[prop] = data[prop].toString();
break;
}
} catch (exception) {
console.error(`Failed to serialize ${prop} for ${String(eventName)}`, exception);
}
});
}
// Add shared properties to telemetry props (we may overwrite existing ones).
Object.assign(customProperties, sharedProperties);
if (ex) {
const errorProps = {
errorName: ex.name,
errorStack: ex.stack ?? '',
};
Object.assign(customProperties, errorProps);
reporter.sendTelemetryErrorEvent(eventNameSent, customProperties, measures);
} else {
reporter.sendTelemetryEvent(eventNameSent, customProperties, measures);
}
if (process.env && process.env.VSC_PYTHON_LOG_TELEMETRY) {
console.info(
`Telemetry Event : ${eventNameSent} Measures: ${JSON.stringify(measures)} Props: ${JSON.stringify(
customProperties,
)} `,
);
}
}
// Type-parameterized form of MethodDecorator in lib.es5.d.ts.
type TypedMethodDescriptor<T> = (
target: unknown,
propertyKey: string | symbol,
descriptor: TypedPropertyDescriptor<T>,
) => TypedPropertyDescriptor<T> | void;
// The following code uses "any" in many places, as TS does not have rich support
// for typing decorators. Specifically, while it is possible to write types which
// encode the signature of the wrapped function, TS fails to actually infer the
// type of "this" and the signature at call sites, instead choosing to infer
// based on other hints (like the closure parameters), which ends up making it
// no safer than "any" (and sometimes misleading enough to be more unsafe).
/**
* Decorates a method, sending a telemetry event with the given properties.
* @param eventName The event name to send.
* @param properties Properties to send with the event; must be valid for the event.
* @param captureDuration True if the method's execution duration should be captured.
* @param failureEventName If the decorated method returns a Promise and fails, send this event instead of eventName.
* @param lazyProperties A static function on the decorated class which returns extra properties to add to the event.
* This can be used to provide properties which are only known at runtime (after the decorator has executed).
* @param lazyMeasures A static function on the decorated class which returns extra measures to add to the event.
* This can be used to provide measures which are only known at runtime (after the decorator has executed).
*/
export function captureTelemetry<This, P extends IEventNamePropertyMapping, E extends keyof P>(
eventName: E,
properties?: P[E],
captureDuration = true,
failureEventName?: E,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
lazyProperties?: (obj: This, result?: any) => P[E],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
lazyMeasures?: (obj: This, result?: any) => Record<string, number>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): TypedMethodDescriptor<(this: This, ...args: any[]) => any> {
return function (
_target: unknown,
_propertyKey: string | symbol,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
descriptor: TypedPropertyDescriptor<(this: This, ...args: any[]) => any>,
) {
const originalMethod = descriptor.value!;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
descriptor.value = function (this: This, ...args: any[]) {
// Legacy case; fast path that sends event before method executes.
// Does not set "failed" if the result is a Promise and throws an exception.
if (!captureDuration && !lazyProperties && !lazyMeasures) {
sendTelemetryEvent(eventName, undefined, properties);
return originalMethod.apply(this, args);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getProps = (result?: any) => {
if (lazyProperties) {
return { ...properties, ...lazyProperties(this, result) };
}
return properties;
};
const stopWatch = captureDuration ? new StopWatch() : undefined;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getMeasures = (result?: any) => {
const measures = stopWatch ? { duration: stopWatch.elapsedTime } : undefined;
if (lazyMeasures) {
return { ...measures, ...lazyMeasures(this, result) };
}
return measures;
};
const result = originalMethod.apply(this, args);
// If method being wrapped returns a promise then wait for it.
if (result && isPromise(result)) {
result
.then((data) => {
sendTelemetryEvent(eventName, getMeasures(data), getProps(data));
return data;
})
.catch((ex) => {
const failedProps: P[E] = { ...getProps(), failed: true } as P[E] & FailedEventType;
sendTelemetryEvent(failureEventName || eventName, getMeasures(), failedProps, ex);
});
} else {
sendTelemetryEvent(eventName, getMeasures(result), getProps(result));
}
return result;
};
return descriptor;
};
}
// function sendTelemetryWhenDone<T extends IDSMappings, K extends keyof T>(eventName: K, properties?: T[K]);
export function sendTelemetryWhenDone<P extends IEventNamePropertyMapping, E extends keyof P>(
eventName: E,
promise: Promise<unknown> | Thenable<unknown>,
stopWatch?: StopWatch,
properties?: P[E],
): void {
stopWatch = stopWatch || new StopWatch();
if (typeof promise.then === 'function') {
(promise as Promise<unknown>).then(
(data) => {
sendTelemetryEvent(eventName, stopWatch!.elapsedTime, properties);
return data;
},
(ex) => {
sendTelemetryEvent(eventName, stopWatch!.elapsedTime, properties, ex);
return Promise.reject(ex);
},
);
} else {
throw new Error('Method is neither a Promise nor a Theneable');
}
}
/**
* Map all shared properties to their data types.
*/
export interface ISharedPropertyMapping {
/**
* For every DS telemetry we would like to know the type of Notebook Editor used when doing something.
*/
['ds_notebookeditor']: undefined | 'old' | 'custom' | 'native';
/**
* For every telemetry event from the extension we want to make sure we can associate it with install
* source. We took this approach to work around very limiting query performance issues.
*/
['installSource']: undefined | 'marketPlace' | 'pythonCodingPack';
}
type FailedEventType = { failed: true };
// Map all events to their properties
export interface IEventNamePropertyMapping {
/**
* Telemetry event sent when debug in terminal button was used to debug current file.
*/
/* __GDPR__
"debug_in_terminal_button" : { "owner": "paulacamargo25" }
*/
[EventName.DEBUG_IN_TERMINAL_BUTTON]: never | undefined;
/**
* Telemetry event captured when debug adapter executable is created
*/
/* __GDPR__
"debug_adapter.using_wheels_path" : {
"usingwheels" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUG_ADAPTER_USING_WHEELS_PATH]: {
/**
* Carries boolean
* - `true` if path used for the adapter is the debugger with wheels.
* - `false` if path used for the adapter is the source only version of the debugger.
*/
usingWheels: boolean;
};
/**
* Telemetry captured before starting debug session.
*/
/* __GDPR__
"debug_session.start" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"trigger" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" },
"console" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUG_SESSION_START]: {
/**
* Trigger for starting the debugger.
* - `launch`: Launch/start new code and debug it.
* - `attach`: Attach to an exiting python process (remote debugging).
* - `test`: Debugging python tests.
*
* @type {TriggerType}
*/
trigger: TriggerType;
/**
* Type of console used.
* -`internalConsole`: Use VS Code debug console (no shells/terminals).
* - `integratedTerminal`: Use VS Code terminal.
* - `externalTerminal`: Use an External terminal.
*
* @type {ConsoleType}
*/
console?: ConsoleType;
};
/**
* Telemetry captured when debug session runs into an error.
*/
/* __GDPR__
"debug_session.error" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"trigger" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" },
"console" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUG_SESSION_ERROR]: {
/**
* Trigger for starting the debugger.
* - `launch`: Launch/start new code and debug it.
* - `attach`: Attach to an exiting python process (remote debugging).
* - `test`: Debugging python tests.
*
* @type {TriggerType}
*/
trigger: TriggerType;
/**
* Type of console used.
* -`internalConsole`: Use VS Code debug console (no shells/terminals).
* - `integratedTerminal`: Use VS Code terminal.
* - `externalTerminal`: Use an External terminal.
*
* @type {ConsoleType}
*/
console?: ConsoleType;
};
/**
* Telemetry captured after stopping debug session.
*/
/* __GDPR__
"debug_session.stop" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"trigger" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" },
"console" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUG_SESSION_STOP]: {
/**
* Trigger for starting the debugger.
* - `launch`: Launch/start new code and debug it.
* - `attach`: Attach to an exiting python process (remote debugging).
* - `test`: Debugging python tests.
*
* @type {TriggerType}
*/
trigger: TriggerType;
/**
* Type of console used.
* -`internalConsole`: Use VS Code debug console (no shells/terminals).
* - `integratedTerminal`: Use VS Code terminal.
* - `externalTerminal`: Use an External terminal.
*
* @type {ConsoleType}
*/
console?: ConsoleType;
};
/**
* Telemetry captured when user code starts running after loading the debugger.
*/
/* __GDPR__
"debug_session.user_code_running" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"trigger" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" },
"console" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUG_SESSION_USER_CODE_RUNNING]: {
/**
* Trigger for starting the debugger.
* - `launch`: Launch/start new code and debug it.
* - `attach`: Attach to an exiting python process (remote debugging).
* - `test`: Debugging python tests.
*
* @type {TriggerType}
*/
trigger: TriggerType;
/**
* Type of console used.
* -`internalConsole`: Use VS Code debug console (no shells/terminals).
* - `integratedTerminal`: Use VS Code terminal.
* - `externalTerminal`: Use an External terminal.
*
* @type {ConsoleType}
*/
console?: ConsoleType;
};
/**
* Telemetry captured when starting the debugger.
*/
/* __GDPR__
"debugger" : {
"trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"console" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"hasenvvars": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"hasargs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"django": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"fastapi": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"flask": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"jinja": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"islocalhost": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"ismodule": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"issudo": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"stoponentry": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"showreturnvalue": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"pyramid": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"subprocess": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"watson": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"pyspark": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"gevent": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"scrapy": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUGGER]: {
/**
* Trigger for starting the debugger.
* - `launch`: Launch/start new code and debug it.
* - `attach`: Attach to an exiting python process (remote debugging).
* - `test`: Debugging python tests.
*
* @type {TriggerType}
*/
trigger: TriggerType;
/**
* Type of console used.
* -`internalConsole`: Use VS Code debug console (no shells/terminals).
* - `integratedTerminal`: Use VS Code terminal.
* - `externalTerminal`: Use an External terminal.
*
* @type {ConsoleType}
*/
console?: ConsoleType;
/**
* Whether user has defined environment variables.
* Could have been defined in launch.json or the env file (defined in `settings.json`).
* Default `env file` is `.env` in the workspace folder.
*
* @type {boolean}
*/
hasEnvVars: boolean;
/**
* Whether there are any CLI arguments that need to be passed into the program being debugged.
*
* @type {boolean}
*/
hasArgs: boolean;
/**
* Whether the user is debugging `django`.
*
* @type {boolean}
*/
django: boolean;
/**
* Whether the user is debugging `fastapi`.
*
* @type {boolean}
*/
fastapi: boolean;
/**
* Whether the user is debugging `flask`.
*
* @type {boolean}
*/
flask: boolean;
/**
* Whether the user is debugging `jinja` templates.
*
* @type {boolean}
*/
jinja: boolean;
/**
* Whether user is attaching to a local python program (attach scenario).
*
* @type {boolean}
*/
isLocalhost: boolean;
/**
* Whether debugging a module.
*
* @type {boolean}
*/
isModule: boolean;
/**
* Whether debugging with `sudo`.
*
* @type {boolean}
*/
isSudo: boolean;
/**
* Whether required to stop upon entry.
*
* @type {boolean}
*/
stopOnEntry: boolean;
/**
* Whether required to display return types in debugger.
*
* @type {boolean}
*/
showReturnValue: boolean;
/**
* Whether debugging `pyramid`.
*
* @type {boolean}
*/
pyramid: boolean;
/**
* Whether debugging a subprocess.
*
* @type {boolean}
*/
subProcess: boolean;
/**
* Whether debugging `watson`.
*
* @type {boolean}
*/
watson: boolean;
/**
* Whether degbugging `pyspark`.
*
* @type {boolean}
*/
pyspark: boolean;
/**
* Whether using `gevent` when debugging.
*
* @type {boolean}
*/
gevent: boolean;
/**
* Whether debugging `scrapy`.
*
* @type {boolean}
*/
scrapy: boolean;
};
/**
* Telemetry event sent when attaching to child process
*/
/* __GDPR__
"debugger.attach_to_child_process" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "paulacamargo25" }
}
*/
[EventName.DEBUGGER_ATTACH_TO_CHILD_PROCESS]: never | undefined;
/**
* Telemetry event sent when attaching to a local process.
*/
/* __GDPR__
"debugger.attach_to_local_process" : { "owner": "paulacamargo25" }
*/
[EventName.DEBUGGER_ATTACH_TO_LOCAL_PROCESS]: never | undefined;
/**
* Telemetry sent after building configuration for debugger
*/
/* __GDPR__
"debugger.configuration.prompts" : {
"configurationtype" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"autodetecteddjangomanagepypath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"autodetectedpyramidinipath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"autodetectedfastapimainpypath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"autodetectedflaskapppypath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" },
"manuallyenteredavalue" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "paulacamargo25" }
}
*/
[EventName.DEBUGGER_CONFIGURATION_PROMPTS]: {
/**
* The type of debug configuration to build configuration for
*
* @type {DebugConfigurationType}
*/
configurationType: DebugConfigurationType;
/**
* Carries `true` if we are able to auto-detect manage.py path for Django, `false` otherwise
*
* @type {boolean}
*/
autoDetectedDjangoManagePyPath?: boolean;
/**
* Carries `true` if we are able to auto-detect .ini file path for Pyramid, `false` otherwise
*
* @type {boolean}
*/
autoDetectedPyramidIniPath?: boolean;
/**
* Carries `true` if we are able to auto-detect main.py path for FastAPI, `false` otherwise
*
* @type {boolean}
*/
autoDetectedFastAPIMainPyPath?: boolean;
/**
* Carries `true` if we are able to auto-detect app.py path for Flask, `false` otherwise
*
* @type {boolean}
*/
autoDetectedFlaskAppPyPath?: boolean;
/**
* Carries `true` if user manually entered the required path for the app
* (path to `manage.py` for Django, path to `.ini` for Pyramid, path to `app.py` for Flask), `false` otherwise
*
* @type {boolean}
*/
manuallyEnteredAValue?: boolean;
};
/**
* Telemetry event sent when providing completion provider in launch.json. It is sent just *after* inserting the completion.
*/
/* __GDPR__
"debugger.configuration.prompts.in.launch.json" : { "owner": "paulacamargo25" }
*/
[EventName.DEBUGGER_CONFIGURATION_PROMPTS_IN_LAUNCH_JSON]: never | undefined;
/**
* Telemetry event sent with details of actions when invoking a diagnostic command
*/
/* __GDPR__
"diagnostics.action" : {
"commandname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"ignorecode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"url" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"action" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.DIAGNOSTICS_ACTION]: {
/**
* Diagnostics command executed.
* @type {string}
*/
commandName?: string;
/**
* Diagnostisc code ignored (message will not be seen again).
* @type {string}
*/
ignoreCode?: string;
/**
* Url of web page launched in browser.
* @type {string}
*/
url?: string;
/**
* Custom actions performed.
* @type {'switchToCommandPrompt'}
*/
action?: 'switchToCommandPrompt';
};
/**
* Telemetry event sent when we are checking if we can handle the diagnostic code
*/
/* __GDPR__
"diagnostics.message" : {
"code" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.DIAGNOSTICS_MESSAGE]: {
/**
* Code of diagnostics message detected and displayed.
* @type {string}
*/
code: DiagnosticCodes;
};
/**
* Telemetry event sent with details just after editor loads
*/
/* __GDPR__
"editor.load" : {
"codeloadingtime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"condaversion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"errorname" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "luabud" },
"errorstack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "luabud" },
"pythonversion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"installsource" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"interpretertype" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"terminal" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "luabud" },
"workspacefoldercount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"haspythonthree" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"startactivatetime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"totalactivatetime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"totalnonblockingactivatetime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"usinguserdefinedinterpreter" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" },
"usingglobalinterpreter" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" }
}
*/
[EventName.EDITOR_LOAD]: {
/**
* The conda version if selected
*/
condaVersion?: string | undefined;
/**
* The python interpreter version if selected
*/
pythonVersion?: string | undefined;
/**
* The type of interpreter (conda, virtualenv, pipenv etc.)
*/
interpreterType?: EnvironmentType | undefined;
/**
* The type of terminal shell created: powershell, cmd, zsh, bash etc.
*
* @type {TerminalShellType}
*/
terminal: TerminalShellType;
/**
* Number of workspace folders opened
*/
workspaceFolderCount: number;
/**
* If interpreters found for the main workspace contains a python3 interpreter
*/
hasPythonThree?: boolean;
/**
* If user has defined an interpreter in settings.json
*/
usingUserDefinedInterpreter?: boolean;
/**
* If global interpreter is being used
*/
usingGlobalInterpreter?: boolean;
};
/**
* Telemetry event sent when substituting Environment variables to calculate value of variables
*/
/* __GDPR__
"envfile_variable_substitution" : { "owner": "karthiknadig" }
*/
[EventName.ENVFILE_VARIABLE_SUBSTITUTION]: never | undefined;
/**
* Telemetry event sent when an environment file is detected in the workspace.
*/
/* __GDPR__
"envfile_workspace" : {
"hascustomenvpath" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" }
}
*/
[EventName.ENVFILE_WORKSPACE]: {
/**
* If there's a custom path specified in the python.envFile workspace settings.
*/
hasCustomEnvPath: boolean;
};
/**
* Telemetry Event sent when user sends code to be executed in the terminal.
*
*/
/* __GDPR__
"execution_code" : {
"scope" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" },
"trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
}
*/
[EventName.EXECUTION_CODE]: {
/**
* Whether the user executed a file in the terminal or just the selected text.
*
* @type {('file' | 'selection')}
*/
scope: 'file' | 'selection';
/**
* How was the code executed (through the command or by clicking the `Run File` icon).
*
* @type {('command' | 'icon')}
*/
trigger?: 'command' | 'icon';
};
/**
* Telemetry Event sent when user executes code against Django Shell.
* Values sent:
* scope
*
*/
/* __GDPR__
"execution_django" : {
"scope" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
}
*/
[EventName.EXECUTION_DJANGO]: {
/**
* If `file`, then the file was executed in the django shell.
* If `selection`, then the selected text was sent to the django shell.
*
* @type {('file' | 'selection')}
*/
scope: 'file' | 'selection';
};
/**
* Telemetry event sent with details when formatting a document
*/
/* __GDPR__
"format.format" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
"errorname" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
"errorstack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
"tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"hascustomargs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"formatselection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.FORMAT]: {
/**
* Tool being used to format
*/
tool: 'autopep8' | 'black' | 'yapf';
/**
* If arguments for formatter is provided in resource settings
*/
hasCustomArgs: boolean;
/**
* Carries `true` when formatting a selection of text, `false` otherwise
*/
formatSelection: boolean;
};
/**
* Telemetry event sent with the value of setting 'Format on type'
*/
/* __GDPR__
"format.format_on_type" : {
"enabled" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.FORMAT_ON_TYPE]: {
/**
* Carries `true` if format on type is enabled, `false` otherwise
*
* @type {boolean}
*/
enabled: boolean;
};
/**
* Telemetry event sent when sorting imports using formatter
*/
/* __GDPR__
"format.sort_imports" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
"originaleventname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.FORMAT_SORT_IMPORTS]: never | undefined;
/**
* Telemetry event sent with details when tracking imports
*/
/* __GDPR__
"hashed_package_name" : {
"hashedname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" }
}
*/
[EventName.HASHED_PACKAGE_NAME]: {
/**
* Hash of the package name
*
* @type {string}
*/
hashedName: string;
};
/**
* Telemetry event sent with details of selection in prompt
* `Prompt message` :- 'Linter ${productName} is not installed'
*/
/* __GDPR__
"linter_not_installed_prompt" : {
"tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"action": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.LINTER_NOT_INSTALLED_PROMPT]: {
/**
* Name of the linter
*
* @type {LinterId}
*/
tool?: LinterId;
/**
* `select` When 'Select linter' option is selected
* `disablePrompt` When 'Do not show again' option is selected
* `install` When 'Install' option is selected
*
* @type {('select' | 'disablePrompt' | 'install')}
*/
action: 'select' | 'disablePrompt' | 'install';
};
/**
* Telemetry event sent when installing modules
*/
/* __GDPR__
"python_install_package" : {
"installer" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"requiredinstaller" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"productname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"isinstalled" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"envtype" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.PYTHON_INSTALL_PACKAGE]: {
/**
* The name of the module. (pipenv, Conda etc.)
* One of the possible values includes `unavailable`, meaning user doesn't have pip, conda, or other tools available that can be used to install a python package.
*/
installer: string;
/**
* The name of the installer required (expected to be available) for installation of packages. (pipenv, Conda etc.)
*/
requiredInstaller?: string;
/**
* Name of the corresponding product (package) to be installed.
*/
productName?: string;
/**
* Whether the product (package) has been installed or not.
*/
isInstalled?: boolean;
/**
* Type of the Python environment into which the Python package is being installed.
*/
envType?: PythonEnvironment['envType'];
/**
* Version of the Python environment into which the Python package is being installed.
*/
version?: string;
};
/**
* Telemetry sent with details immediately after linting a document completes
*/
/* __GDPR__
"linting" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
"tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"hascustomargs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"executablespecified" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.LINTING]: {