Skip to content

Integrate the ExP framework - #260

Merged
Sheng Chen (jdneo) merged 5 commits into
masterfrom
cs/test
May 15, 2020
Merged

Integrate the ExP framework#260
Sheng Chen (jdneo) merged 5 commits into
masterfrom
cs/test

Conversation

@jdneo

Copy link
Copy Markdown
Member

No description provided.

@jdneo Sheng Chen (jdneo) added this to the 0.10.1 milestone May 11, 2020
Comment thread package.json Outdated
"minimatch": "^3.0.4",
"vscode-extension-telemetry-wrapper": "^0.7.1"
"vscode-extension-telemetry-wrapper": "^0.7.1",
"vscode-tas-client": "0.0.702"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should actually use version 0.0.659 of vscode-tas-client for now. 0.0.702 has a bug that I'll resolve later this week.

Comment thread src/ExpManager.ts Outdated
return false;
}

try {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vscode-tas-client package will query the treatment assignment service in the background (every 30 minutes), so flight information should never be much staler than the last opened instance of VS Code. If you want to be absolutely sure your extension has up-to-date flight information, you can do this. However, it probably isn't necessary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does that mean that we can just call isCachedFlightEnabled() here, and call isFlightEnabledAsync() for 1 time in the init method?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't ever need to call isFlightEnabledAsync unless you want the absolute latest flight information. But I can't think of any scenarios where you would.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thank you Dayton Ellwanger (@daytonellwanger).

Another question, is below code needed in the init functions?

const asyncDummyCheck = (arg: any) => {
        expService?.isFlightEnabledAsync('dummy').then((v) => { return; }).catch((r) => { return; });
    };
    expService?.isCachedFlightEnabled('dummy').then(asyncDummyCheck).catch(asyncDummyCheck);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should no longer be needed with the version of the vscode-tas-client package I mentioned above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thank you for your help Dayton Ellwanger (@daytonellwanger). :)

I'll update the code according to the comments.

Comment thread src/ExperimentationService.ts Outdated

export function init(context: vscode.ExtensionContext) {
const extensionName = "vscjava.vscode-java-dependency";
const extensionVersion = "0.10.1";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to read this from your package.json so you don't have to remember to update this when you change the extension version.

Comment thread src/controllers/projectController.ts Outdated
}];
if (contextManager.getContextValue(Context.MAVEN_ENABLED)) {
projectKinds.push({
const isMavenDefault: boolean = await expManager.isFlightEnabled("defaultMaven");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you OK paying the async cost here? Given that this could result in an http request, this could be 1-5 seconds.

Comment thread src/ExperimentationService.ts Outdated
}

export async function init(context: vscode.ExtensionContext): Promise<void> {
const packageJson: {} = await fse.readJSON(context.asAbsolutePath("package.json"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to just do require('package.json')?

expService = getExperimentationService(extensionName, extensionVersion,
TargetPopulation.Public, new ExperimentationTelemetry(), context.globalState);

// Due to a bug in the tas-client module, a call to isFlightEnabledAsync is required to begin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to drop these dummy checks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to remove these lines. But I found that when I'm calling getExpService().isCachedFlightEnabled("defaultMaven");, the cached features are empty.

image

Within the dummy code, the cached features are correct.

// The vscode-tas-client I'm using is 0.0.659

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting. Maybe we still have another bug to track down. OK, keep these checks for now and I'll look into the issue ASAP, and with the next update to the package, you can remove them.

@jdneo

Copy link
Copy Markdown
Member Author

Hey Dayton Ellwanger (@daytonellwanger)

I have updated the PR. Please take a look when you have time. Thanks a lot.

Comment thread src/controllers/projectController.ts Outdated
}];
if (contextManager.getContextValue(Context.MAVEN_ENABLED)) {
projectKinds.push({
const isMavenDefault: boolean = await getExpService().isCachedFlightEnabled("defaultMaven");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null check after getExpService?

@jdneo Sheng Chen (jdneo) modified the milestones: 0.10.1, 0.10.2 May 15, 2020

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jdneo
Sheng Chen (jdneo) merged commit 875c9c5 into master May 15, 2020
@jdneo
Sheng Chen (jdneo) deleted the cs/test branch May 15, 2020 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants