Skip to content

Commit 970bed9

Browse files
authored
Turn-off experiment logs when telemetry is disabled (#17908)
* Turnoff experiment logs when telemtry is diabled * Fix tests
1 parent 2ee548c commit 970bed9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/ISSUE_TEMPLATE/1_new_bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ body:
4040
attributes:
4141
label: Language server
4242
description: 'The value of the `python.languageServer` setting'
43-
options: ['Default', 'Pylance', 'Jedi', 'Disabled']
43+
options: ['Default', 'Pylance', 'Jedi', 'None or Disabled']
4444
validations:
4545
required: true
4646
- type: textarea

src/client/common/experiments/service.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,19 @@ export class ExperimentService implements IExperimentService {
142142
}
143143

144144
private logExperiments() {
145+
const telemetrySettings = this.workspaceService.getConfiguration('telemetry');
146+
if (telemetrySettings && telemetrySettings.get<boolean>('enableTelemetry') === false) {
147+
this.output.appendLine('Telemetry is disabled');
148+
this.output.appendLine('Experiments are disabled');
149+
return;
150+
}
151+
152+
if (telemetrySettings && telemetrySettings.get<string>('telemetryLevel') === 'off') {
153+
this.output.appendLine('Telemetry level is off');
154+
this.output.appendLine('Experiments are disabled');
155+
return;
156+
}
157+
145158
if (this._optOutFrom.includes('All')) {
146159
// We prioritize opt out first
147160
this.output.appendLine(Experiments.optedOutOf().format('All'));

0 commit comments

Comments
 (0)