-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix the gather survey #13086
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
Fix the gather survey #13086
Conversation
added 'gather stats' telemetry mention the gather comments to update the python ext
Codecov Report
@@ Coverage Diff @@
## master #13086 +/- ##
==========================================
- Coverage 59.84% 59.76% -0.08%
==========================================
Files 671 671
Lines 36653 36686 +33
Branches 5153 5158 +5
==========================================
- Hits 21936 21927 -9
- Misses 13625 13663 +38
- Partials 1092 1096 +4
Continue to review full report at Codecov.
|
package.nls.json
Outdated
@@ -474,8 +474,8 @@ | |||
"DataScience.findJupyterCommandProgressCheckInterpreter": "Checking {0}.", | |||
"DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.", | |||
"DataScience.gatherError": "Gather internal error", | |||
"DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n", | |||
"DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|  |This notebook was generated by the Gather Extension. The intent is that it contains only the code and cells required to produce the same results as the cell originally selected for gathering. Please note that the Python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.|\n\n**Are you satisfied with the code that was gathered?**\n\n[Yes](https://command:python.datascience.gatherquality?yes) [No](https://command:python.datascience.gatherquality?no)", | |||
"DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It will not work without the lastest version of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n", |
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.
Try to keep the sentences positive. So instead of "It will not work..." say "It requires the latest version of the python extension."
I think it would be legitimate to actually state the version number as well, as in "It requires at least version 2020.7.94776 of the Python extension."
Finally, isn't it possible to set a version on the dependency set? I.e. when you install gather can't it be made to fail or force an update to the Python extension if it's not at least a certain version? That would be the best.
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.
its not possible to install a specific version
|
||
sendTelemetryEvent(Telemetry.GatherStats, undefined, { | ||
linesAvailable: linesAvailable ? linesAvailable - cell.data.source.length : -1, | ||
linesInGatheredCell: cell.data.source.length, |
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.
This is the number of lines in the cell to be gathered? Do we need this? I think knowing:
- The total number of source lines being submitted to be analyzed for gather
- The total number of cells being submitted to be analyzed for gather
- The total number of lines generated for the gathered result
- The total number of cells generated for the gathered result
is what I think we're looking for.
sendTelemetryEvent(Telemetry.GatherStats, undefined, { | ||
linesAvailable: linesAvailable ? linesAvailable - cell.data.source.length : -1, | ||
linesInGatheredCell: cell.data.source.length, | ||
gatheredLines: slicedProgram.splitLines().length - cell.data.source.length |
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.
Why are we subtracting the cell data source length? If I recall correctly the cell data source is the source for the entire cell being gathered. After gathering this cell may not contain all the same lines it originally had. So subtracting the number of lines that were in the source from the number of lines gathered total will not always be accurate.
let gatherCount: number | undefined = this.context.globalState.get('gatherCount'); | ||
|
||
if (gatherCount) { | ||
gatherCount += vscCell.data.source.length; |
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.
Is vscCell.data.source.length equal to the total number of lines in the program being submitted to be gathered, and not just for the cell? I don't remember.
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.
just of the cell
src/client/telemetry/index.ts
Outdated
@@ -2041,6 +2041,11 @@ export interface IEventNamePropertyMapping { | |||
*/ | |||
result: 'err' | 'script' | 'notebook' | 'unavailable'; | |||
}; | |||
[Telemetry.GatherStats]: { | |||
linesAvailable: number; // Code lines before executing gather, does not include the gathered cell. |
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.
I don't think this is what we want. See above.
@@ -255,4 +276,17 @@ export class GatherListener implements IInteractiveWindowListener { | |||
editBuilder.insert(new Position(editor.document.lineCount, 0), '\n'); | |||
}); | |||
} | |||
|
|||
private getNumberOfCells(program: string): number { |
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.
There's a function that can do this already. generateCellsFromString
. You'd call that and just return the array lenth.
let gatherLinesCount: number | undefined = this.context.globalState.get('gatherLinesCount'); | ||
let gatherCellsCount: number | undefined = this.context.globalState.get('gatherCellsCount'); | ||
|
||
if (gatherLinesCount) { |
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.
Don't these two values start out as zero/undefined? Seems to me it will always make the global state zero for both.
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.
That depends, does the gatherLogger constructor keep getting executed or does it happen once?
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.
It happens once, but if the value is zero, you update the value to zero again.
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.
Nevermind, I see the issue.
@@ -52,8 +53,7 @@ export class LinkProvider implements IInteractiveWindowListener { | |||
this.openFile(href); | |||
} else if (href.startsWith('https://command:')) { | |||
const temp: string = href.split(':')[2]; | |||
const params: string[] = | |||
temp.includes('/?') && temp.includes(',') ? temp.split('/?')[1].split(',') : []; | |||
const params: string[] = temp.includes('/?') ? temp.split('/?')[1].split(',') : []; |
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.
Does this change break the reason the ',' was looked for before? Did you look to see what originally put this && condition here and make sure that still worked?
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.
I didn't look for the specific case, but I tested having both a single and multiple parameters and that works as expected.
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.
Yeah I just checked it, out of the 3 commands that use this, only the gather survey one uses parameters
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.
⏲️
Kudos, SonarCloud Quality Gate passed!
|
* fix the gather survey added 'gather stats' telemetry mention the gather comments to update the python ext * oops * fix tests and address comments * update gather stats when resetting the kernel * set globalstate vars to 0 when we open vs code * fix gather stats telemetry
* Fix the gather survey (#13086) * fix the gather survey added 'gather stats' telemetry mention the gather comments to update the python ext * oops * fix tests and address comments * update gather stats when resetting the kernel * set globalstate vars to 0 when we open vs code * fix gather stats telemetry * fix tests * fix tests for real
* Update model.isTrusted on trust change (#12820) (#12823) * Reduce visual complexity of trust prompt (#12839) (#12847) * Port python 2.7 fix to release (#12877) * port color fix on collapse all (#12895) (#12897) * fix a color on collapse all (#12895) * update changelog * Merge fixes into July release (#12889) Co-authored-by: Timothy Ruscica <[email protected]> * Merge more fixes into july release (#12918) Co-authored-by: Joyce Er <[email protected]> * Port trust fixes (#12929) * Fix regressions in trusted notebooks (#12902) * Handle trustAllNotebooks selection * Fix bug where after trusting, UI didn't update * Recover from ENOENT due to missing parent directory when trusting notebook (#12913) * Disable keydown on native cells in untrusted notebooks (#12914) * Hide editor icons when editor is not a notebook (#12934) (#12935) * Check for hideFromUser before activating current terminal (#12942) (#12956) * Check for hideFromUser before activating current terminal * Add tests * Tweak logic * Port final trust fixes for release (#12965) * Only allow Enter / NumpadEnter w/o ctrl/shift/alt (#12939) * Send telemetry for notebook trust prompt selections (#12964) * Fixes for persisting trust (#12950) * Display survey for native notebooks on/after 1st August (#12961) (#12975) Co-authored-by: Joyce Er <[email protected]> Co-authored-by: Joyce Er <[email protected]> * Contains cherry picks, version updates, change log updates (#12983) * Update version and change log * Improve detection when LS is fully loaded for IntelliCode (#12853) * Fix path * Actually fix settings * Add news * Add test * Format * Suppress 'jediEnabled' removal * Drop survey first launch threshold * Wait for client ready * Handle async dispose * Fix the date Co-authored-by: Mikhail Arkhipov <[email protected]> * hide the gather button while a cell is executing (#12984) * Update date (#13002) * remove release notes from the start page (#13032) * Cherry pick, version change and change log update (#13079) * Ensure languageServer value is valid, send event during activate (#13064) * Update change log and version * Activate banner prompt for Pylance (#12817) * Fix path * Actually fix settings * Add news * Add test * Format * Suppress 'jediEnabled' removal * Drop survey first launch threshold * Remove LS experiments * Frequency + tests * Fix test * Update message to match spec * Open workspace for extension rather than changing setting * Fix localization string * Show banners asynchronously * Add experiments * Formatting * Typo * Put back verifyAll * Remove obsolete experiments, add Pylance * Suppress experiment if Pylance is installed * PR feedback Co-authored-by: Jake Bailey <[email protected]> * Update change log as per comments Co-authored-by: Jake Bailey <[email protected]> Co-authored-by: Mikhail Arkhipov <[email protected]> * Port fix the gather survey (#13086) (#13105) * Fix the gather survey (#13086) * fix the gather survey added 'gather stats' telemetry mention the gather comments to update the python ext * oops * fix tests and address comments * update gather stats when resetting the kernel * set globalstate vars to 0 when we open vs code * fix gather stats telemetry * fix tests * fix tests for real Co-authored-by: Joyce Er <[email protected]> Co-authored-by: Ian Huff <[email protected]> Co-authored-by: David Kutugata <[email protected]> Co-authored-by: Don Jayamanne <[email protected]> Co-authored-by: Timothy Ruscica <[email protected]> Co-authored-by: Mikhail Arkhipov <[email protected]> Co-authored-by: Jake Bailey <[email protected]>
package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).