Skip to content

Commit c05895a

Browse files
author
Kartik Raj
committed
Fix Python extension loading... issue for users who have disabled telemetry (microsoft#17447)
* Enable discovery experiments for all users including those who have opted out of telemetry * News entry * Oops * Ensure we still respect optInto/optOutFrom setting for discovery experiment
1 parent 3b89aba commit c05895a

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

news/2 Fixes/17447.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix `Python extension loading...` issue for users who have disabled telemetry.

src/client/common/experiments/service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { IApplicationEnvironment, IWorkspaceService } from '../application/types
1212
import { PVSC_EXTENSION_ID, STANDARD_OUTPUT_CHANNEL } from '../constants';
1313
import { GLOBAL_MEMENTO, IExperimentService, IMemento, IOutputChannel } from '../types';
1414
import { Experiments } from '../utils/localize';
15+
import { DiscoveryVariants } from './groups';
1516
import { ExperimentationTelemetry } from './telemetry';
1617

1718
const EXP_MEMENTO_KEY = 'VSCode.ABExp.FeatureData';
@@ -126,6 +127,11 @@ export class ExperimentService implements IExperimentService {
126127
return true;
127128
}
128129

130+
if (experiment === DiscoveryVariants.discoveryWithoutFileWatching) {
131+
// Enable discovery experiment for all users.
132+
return true;
133+
}
134+
129135
// If getTreatmentVariable returns undefined,
130136
// it means that the value for this experiment was not found on the server.
131137
const treatmentVariable = this.experimentationService.getTreatmentVariable(EXP_CONFIG_ID, experiment);

src/test/common/experiments/service.unit.test.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ApplicationEnvironment } from '../../../client/common/application/appli
1212
import { IApplicationEnvironment, IWorkspaceService } from '../../../client/common/application/types';
1313
import { WorkspaceService } from '../../../client/common/application/workspace';
1414
import { Channel } from '../../../client/common/constants';
15+
import { DiscoveryVariants } from '../../../client/common/experiments/groups';
1516
import { ExperimentService } from '../../../client/common/experiments/service';
1617
import { Experiments } from '../../../client/common/utils/localize';
1718
import * as Telemetry from '../../../client/telemetry';
@@ -157,14 +158,14 @@ suite('Experimentation service', () => {
157158

158159
suite('In-experiment-sync check', () => {
159160
const experiment = 'Test Experiment - experiment';
160-
let telemetryEvents: { eventName: string; properties: Record<string, unknown> }[] = [];
161+
let telemetryEvents: { eventName: string; properties: unknown }[] = [];
161162
let getTreatmentVariable: sinon.SinonStub;
162163
let sendTelemetryEventStub: sinon.SinonStub;
163164

164165
setup(() => {
165166
sendTelemetryEventStub = sinon
166167
.stub(Telemetry, 'sendTelemetryEvent')
167-
.callsFake((eventName: string, _, properties: Record<string, unknown>) => {
168+
.callsFake((eventName: string, _, properties: unknown) => {
168169
const telemetry = { eventName, properties };
169170
telemetryEvents.push(telemetry);
170171
});
@@ -182,6 +183,20 @@ suite('Experimentation service', () => {
182183
sinon.restore();
183184
});
184185

186+
test('Enable discovery experiment without file watching for all users', async () => {
187+
configureSettings(true, [], []);
188+
189+
const experimentService = new ExperimentService(
190+
instance(workspaceService),
191+
instance(appEnvironment),
192+
globalMemento,
193+
outputChannel,
194+
);
195+
const result = experimentService.inExperimentSync(DiscoveryVariants.discoveryWithoutFileWatching);
196+
197+
assert.isTrue(result);
198+
});
199+
185200
test('If the opt-in and opt-out arrays are empty, return the value from the experimentation framework for a given experiment', async () => {
186201
configureSettings(true, [], []);
187202

@@ -401,13 +416,13 @@ suite('Experimentation service', () => {
401416
});
402417

403418
suite('Opt-in/out telemetry', () => {
404-
let telemetryEvents: { eventName: string; properties: Record<string, unknown> }[] = [];
419+
let telemetryEvents: { eventName: string; properties: unknown }[] = [];
405420
let sendTelemetryEventStub: sinon.SinonStub;
406421

407422
setup(() => {
408423
sendTelemetryEventStub = sinon
409424
.stub(Telemetry, 'sendTelemetryEvent')
410-
.callsFake((eventName: string, _, properties: Record<string, unknown>) => {
425+
.callsFake((eventName: string, _, properties: unknown) => {
411426
const telemetry = { eventName, properties };
412427
telemetryEvents.push(telemetry);
413428
});

0 commit comments

Comments
 (0)