-
Notifications
You must be signed in to change notification settings - Fork 940
Port experimentation service and reporting to extension #3675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
89d6bd4
Port over experimentation service & reporting.
DanielRosenwasser 9badbce
Remove unused import.
DanielRosenwasser 3707a4c
Remove pnpm lock
DanielRosenwasser 6af08c5
Format.
DanielRosenwasser 98b0f11
Don't await `initialFetch`.
DanielRosenwasser 3867c73
Remove unnecessary async/Promises.
DanielRosenwasser 0a153b7
Remove more unused code.
DanielRosenwasser 0a1f767
Update extension configuration.
DanielRosenwasser 7f3c91d
Remove mistaken copy/paste.
DanielRosenwasser a6eacc9
Format.
DanielRosenwasser fd61147
void
DanielRosenwasser 2c845d5
Use `context.extension.id`, assert on `version`.
DanielRosenwasser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import * as vscode from "vscode"; | ||
| import * as tas from "vscode-tas-client"; | ||
|
|
||
| interface ExperimentTypes { | ||
| // Experiment variables go here. | ||
| suggestNativePreview: boolean; | ||
| } | ||
|
|
||
| export class ExperimentationService { | ||
| private readonly _experimentationService: tas.IExperimentationService; | ||
| private readonly _telemetryReporter: tas.IExperimentationTelemetry; | ||
|
|
||
| constructor(telemetryReporter: tas.IExperimentationTelemetry, id: string, version: string, globalState: vscode.Memento) { | ||
| this._telemetryReporter = telemetryReporter; | ||
| this._experimentationService = createTasExperimentationService(this._telemetryReporter, id, version, globalState); | ||
| } | ||
|
|
||
| public async getTreatmentVariable<K extends keyof ExperimentTypes>(name: K, defaultValue: ExperimentTypes[K]): Promise<ExperimentTypes[K]> { | ||
| const experimentationService = this._experimentationService; | ||
| try { | ||
| const treatmentVariable = await experimentationService.getTreatmentVariableAsync("vscode", name, /*checkCache*/ true) as ExperimentTypes[K]; | ||
| return treatmentVariable ?? defaultValue; | ||
| } | ||
| catch { | ||
| return defaultValue; | ||
| } | ||
|
Comment on lines
+18
to
+26
|
||
| } | ||
| } | ||
|
|
||
| function createTasExperimentationService( | ||
| reporter: tas.IExperimentationTelemetry, | ||
| id: string, | ||
| version: string, | ||
| globalState: vscode.Memento, | ||
| ): tas.IExperimentationService { | ||
| let targetPopulation: tas.TargetPopulation; | ||
| switch (vscode.env.uriScheme) { | ||
| case "vscode": | ||
| targetPopulation = tas.TargetPopulation.Public; | ||
| break; | ||
| case "vscode-insiders": | ||
| targetPopulation = tas.TargetPopulation.Insiders; | ||
| break; | ||
| case "vscode-exploration": | ||
| targetPopulation = tas.TargetPopulation.Internal; | ||
| break; | ||
| case "code-oss": | ||
| targetPopulation = tas.TargetPopulation.Team; | ||
| break; | ||
| default: | ||
| targetPopulation = tas.TargetPopulation.Public; | ||
| break; | ||
| } | ||
|
|
||
| const experimentationService = tas.getExperimentationService(id, version, targetPopulation, reporter, globalState); | ||
| return experimentationService; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "es2023", | ||
| "module": "NodeNext", | ||
| "rootDir": "./src", | ||
| "outDir": "./dist", | ||
| "esModuleInterop": true, | ||
| "strict": true, | ||
| "skipLibCheck": true, | ||
| "resolveJsonModule": true, | ||
| "sourceMap": true, | ||
| "noEmit": true, | ||
| "types": ["node"] | ||
|
|
||
| "target": "es2023", | ||
| "module": "preserve", | ||
| "moduleResolution": "bundler", | ||
| "types": ["node"], | ||
|
|
||
| "strict": true, | ||
| "noImplicitOverride": true | ||
| }, | ||
| "include": ["./src/**/*"] | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locked on
0.1.84because of microsoft/tas-client#95