|
| 1 | +--- |
| 2 | +RFC: RFC0036 |
| 3 | +Author: Sydney Smith |
| 4 | +Status: Draft-Accepted |
| 5 | +SupercededBy: N/A |
| 6 | +Version: 1.0 |
| 7 | +Area: Telemetry |
| 8 | +Comments Due: 3/29/19 |
| 9 | +Plan to implement: Yes |
| 10 | +--- |
| 11 | + |
| 12 | +# Additional Telemetry in PowerShell |
| 13 | + |
| 14 | +Add usage telemetry across PSEdition, Platform, Application, session type and command types. |
| 15 | +Improve the opt-out mechanisms for PowerShell telemetry.Provide community access to aggregated |
| 16 | +statistics. |
| 17 | + |
| 18 | +## Motivation |
| 19 | + |
| 20 | +To make the best possible investments in PowerShell we need answers backed by data to the following questions: |
| 21 | + |
| 22 | +- Is PowerShell Core usage growing (in terms of number of starts)? |
| 23 | +- Is the PowerShell Core user-base growing? |
| 24 | +- How is PowerShell being used? What is the usage distribution across command types and session type? |
| 25 | +- What are impediments to PowerShell Core usage growth? |
| 26 | +- What are issues that customers are hitting in PowerShell Core? |
| 27 | +- What versions of PowerShell tools and services should Microsoft continue to support? |
| 28 | +- What PowerShell integration scenarios are people using? How many people are using PowerShell |
| 29 | + Editor services? |
| 30 | +- Which experimental features are being used and tested? Which experimental features should we invest in? |
| 31 | +- How can we optimize the engine size and efficiency of PowerShell for cloud scenarios? |
| 32 | + |
| 33 | +To ensure we are getting an accurate picture of how everyone uses PowerShell, not just those most |
| 34 | +vocal/involved in the community, we need to make improvements in our telemetry. |
| 35 | +PowerShell usage telemetry will allow us to better prioritize testing, support, and investments. |
| 36 | +It should be straightforward and easy to opt-out of PowerShell telemetry (presently the process is |
| 37 | +not intuitive nor well documented). |
| 38 | +To better share our plans and successes with the community we want more complete telemetry on our |
| 39 | +[Public PowerBi report](https://msit.powerbi.com/view?r=eyJrIjoiYTYyN2U3ODgtMjBlMi00MGM1LWI0ZjctMmQ3MzE2ZDNkMzIyIiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9&pageName=ReportSection5). |
| 40 | +Simply put, we want to make PowerShell better and believe this can be achieved by better |
| 41 | +understanding how PowerShell is being used. |
| 42 | + |
| 43 | +### Non-Goals |
| 44 | + |
| 45 | +The goal of this is **not** to collect any personal data of PowerShell users or infringe on |
| 46 | +users' privacy. |
| 47 | +Respecting the privacy of our users has been the principal factor in determining which metrics we |
| 48 | +plan to collect. |
| 49 | +The goal of this is not to collect patterns of individual users but to look at aggregate usage trends. |
| 50 | + |
| 51 | +## Specification |
| 52 | + |
| 53 | +Add telemetry to track the following metrics: |
| 54 | + |
| 55 | +- Count of unique users (PowerShell) |
| 56 | +- Count of execution types (ex. cmdlets, native binaries/applications) (PowerShell) |
| 57 | +- Count of enabled PSEngine experimental features (only those created by the PowerShell Team) (PowerShell) |
| 58 | +- Count of session types (ex. hosted vs not hosted sessions) (PowerShell) |
| 59 | +- Hosting application of the of the PowerShell session (ex. VSCode, ISE, AZDevOps) (PowerShell) |
| 60 | +- Version of PowerShell, PowerShellGet, PackageManagement, Nuget and platform |
| 61 | + used to install from PSGallery (PowerShellGet) |
| 62 | + |
| 63 | +### Other features |
| 64 | + |
| 65 | +- Public PowerBi DashBoard to make the aggregated statistics available to the community. |
| 66 | + Find a mocked-up PowerBi DashBoard with randomly generated data at the end of the document. |
| 67 | + It includes the following reports: |
| 68 | + - Unique user trends |
| 69 | + - Types of user —based on types of executions taking place |
| 70 | + - VSCode usage trends |
| 71 | + - Application trends |
| 72 | + - Hosted Scenario Trends |
| 73 | + - PowerShellGet installation trends |
| 74 | +- A cmdlet for providing feedback (Send-PSFeedback): |
| 75 | + - This cmdlet would take in a string array and send it back to the PowerShell team |
| 76 | + - The cmdlet will also send Platform data (OS/version) and Shell data ($PSVersionTable) |
| 77 | + - The cmdlet will have an -OpenGitHubIssue switch that will open a browser to a new issue template |
| 78 | + in the PowerShell/PowerShell repository |
| 79 | + - The user will have the option to include the the last error using an -IncludeError switch |
| 80 | + - If the command is not successful (ex. there is no Web Connection) the cmdlet will return a |
| 81 | + warning and alternative instructions for support through GitHub |
| 82 | + - If no location switch is used the cmdlet will default send the feedback to the PowerShell |
| 83 | + User Voice |
| 84 | + - Based on usage of this cmdlet there would potential for additional parameters |
| 85 | +- Disabling, and re-enabling telemetry will be available through a new cmdlet (Set-PSTelemetry): |
| 86 | + - The cmdlet will stop all collection of telemetry for the remainder of that session and stop |
| 87 | + telemetry from being collected on subsequent starts |
| 88 | + - The user can request their telemetry is deleted by using a Remove-PSTelemetry cmdlet |
| 89 | + - In order to have their telemetry deleted the user will be required to provide their User GUID |
| 90 | + - If the cmdlet is unable to send the information the cmdlet will return a warning and alternative |
| 91 | + instructions for support through GitHub. It will be specified that GUIDs are unique identifiers |
| 92 | + and should not be shared publicly on GitHub. |
| 93 | +- There will be two options for the telemetry environment variable which can be set manually |
| 94 | + or using the Set-PSTelemetry cmdlet |
| 95 | + - $True indicates all telemetry will be collected |
| 96 | + - $False indicates no telemetry will be collected |
| 97 | +- The existing disabling [mechanisms for PowerShell telemetry](https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-61?view=powershell-6#telemetry-can-only-be-disabled-with-an-environment-variable) will remain including the ability to |
| 98 | + set the telemetry environment variable before ever needing to launch PowerShell. |
| 99 | + Setting the telemetry environment variable to $False will block telemetry from being sent on |
| 100 | + every session launch. |
| 101 | + |
| 102 | +### Future work |
| 103 | + |
| 104 | +A public API for module authors and PowerShell hosted application owners to use the same |
| 105 | +infrastructure to collect telemetry for their module or application. |
| 106 | +Making the API public is a phase two goal of this project. |
| 107 | +We will make the telemetry publicly available once it is internally validated. |
| 108 | +The intent of this API is to provide a simple consistent way for PowerShell authors to collect their own telemetry. |
| 109 | +If external PowerShell authors want to use the API they will need to provide their own storage for the data. |
| 110 | +Validating compliance/privacy will be up to the user of the API and not something PowerShell team/Microsoft will cover. |
| 111 | + |
| 112 | +## Design |
| 113 | + |
| 114 | +### PowerShell Changes |
| 115 | + |
| 116 | +- Count of unique users will be based on a User GUID generated at PowerShell start time and stored |
| 117 | + in the user's configuration directory |
| 118 | +- On first start up notification that telemetry is enabled will display in the console header |
| 119 | +- The Application ID will be used to disambiguate PowerShell Hosted applications. It will be a |
| 120 | + standardized method for applications to identify themselves in our telemetry. It will be up to |
| 121 | + Application owners to tag their usage for inclusion in our counts. |
| 122 | +- The count execution type will be collected throughout the PowerShell session |
| 123 | +- The type of PowerShell session (hosted vs non-hosted) will be collected at PowerShell |
| 124 | + engine start time |
| 125 | +- The count of enabled PSEngine experiemental features will be collected at PowerShell |
| 126 | + engine start time. The count will be based on the experimental feature list in the |
| 127 | + powershell.config.json file under $PSHOME, and will only count features created by the PowerShell Team |
| 128 | +- An example of what would be collected on PowerShell Start up: |
| 129 | + - User GUID: c58030d3-1a91-4086-9cb1-5bddd342056d |
| 130 | + - The ApplicationID: VSCode |
| 131 | + - The Platform being used: Windows 10 Pro |
| 132 | + - The Version of PowerShell: 6.2.0-preview.4 |
| 133 | + - The type of PS session: Hosted |
| 134 | + - Experimental Features enabled: "A-Experimental-Feature-name", "Another-Experimental-Feature-Name" |
| 135 | +- An example of what might be collected during a PowerShell Session: |
| 136 | + - Count of cmdlets and functions: 10 |
| 137 | + - Count of native binaries/applications: 5 |
| 138 | +- Currently telemetry is collected at the console startup but we would move collection as close to |
| 139 | + the PowerShell engine start time as possible in order to capture hosted PowerShell scenarios in |
| 140 | + the telemetry |
| 141 | +- Telemetry will be collected through Azure Application Insights and will be stored using Azure |
| 142 | + Storage Tables |
| 143 | + |
| 144 | +### PowerShellGet Changes |
| 145 | + |
| 146 | +Create a header when packages are installed from the PowerShell Gallery, |
| 147 | +to collect/send the following information: |
| 148 | + |
| 149 | +- Version of PowerShellGet, PackageManagement, and NugetProvider |
| 150 | +- Version and Edition of PowerShell |
| 151 | +- Identifier for Operating System |
| 152 | + |
| 153 | +- An example of what would be collected at Package Installation: |
| 154 | + - The Version of PowerShellGet: 2.0.3 |
| 155 | + - The Version of PackageManagement: 1.2.4 |
| 156 | + - The NugetProvider: 3.0.0.1 |
| 157 | + - The version of PowerShell: Core 6.2 |
| 158 | + - The platform being used: macOS 10.3 |
| 159 | + |
| 160 | +## Alternate Proposals and Considerations |
| 161 | + |
| 162 | +Privacy concerns including GDPR regulations are a major consideration of this RFC. |
| 163 | +We underwent a privacy review before drafting this RFC to ensure that we are respecting |
| 164 | +the privacy of all users. The User GUID will be stored in $PSHome so that the user |
| 165 | +can provide it and have their data deleted at anytime. |
| 166 | +Performance impact is also a major consideration of these changes, and the metrics chosen are |
| 167 | +designed to have as nominal an impact on end user experience as possible. |
| 168 | + |
| 169 | +We considered collecting the module/function/cmdlet usage from only modules that are downloaded by the PowerShell Gallery. |
| 170 | +The reason we did not chose to propose this is because of the large cost (in terms of performance, data collection, and data management) |
| 171 | +compared with the relatively smaller benefit of actionable questions we could answer with the information. |
| 172 | + |
| 173 | +We also considered automatically collecting a count of fully qualified error ids. The reason we decided against this was because |
| 174 | +of the potential performance impact and high cost. |
| 175 | + |
| 176 | +[Microsoft Privacy Policy](https://privacy.microsoft.com/en-US/privacystatement) |
| 177 | + |
| 178 | +## PowerShell Committee Decision |
| 179 | + |
| 180 | +### Voting Results |
| 181 | + |
| 182 | +Joey Aiello: Accept |
| 183 | + |
| 184 | +Steve Lee: Accept |
| 185 | + |
| 186 | +Dongbo Wang: Accept |
| 187 | + |
| 188 | +Jim Truher: Accept |
| 189 | + |
| 190 | +### Majority Decision |
| 191 | + |
| 192 | +Committee agrees that this RFC addresses the need for additional telemetry to help guide future decisions. |
| 193 | + |
| 194 | +### Minority Decision |
| 195 | + |
| 196 | +N/A |
0 commit comments