.NET Core SDK 遥测.NET Core SDK telemetry

.NET Core SDK 包含遥测功能,可在 .NET Core CLI 故障时收集使用情况数据和异常信息。The .NET Core SDK includes a telemetry feature that collects usage data and exception information when the .NET Core CLI crashes. .NET Core CLI 附带 .NET Core SDK,是一组用于生成、测试和发布 .NET Core 应用的谓词。The .NET Core CLI comes with the .NET Core SDK and is the set of verbs that enable you to build, test, and publish your .NET Core apps. 请务必让 .NET 团队了解到工具使用情况,以便我们对其做出改进。It's important that the .NET team understands how the tools are used so they can be improved. 有关故障的信息可帮助团队解决问题并修复 bug。Information on failures helps the team resolve problems and fix bugs.

数据为匿名收集,并根据 Creative Commons Attribution 许可证以汇总形式发布。The collected data is anonymous and published in aggregate under the Creative Commons Attribution License.

范围Scope

dotnet 具有两个功能:运行应用程序和执行 CLI 命令。dotnet has two functions: to run apps, and to execute CLI commands. 按以下格式使用 dotnet 来启动应用程序时,不会收集遥测数据 :Telemetry isn't collected when using dotnet to start an application in the following format:

  • dotnet [path-to-app].dll

使用任何 .NET Core CLI 命令时,都会收集遥测数据,如 :Telemetry is collected when using any of the .NET Core CLI commands, such as:

  • dotnet build
  • dotnet pack
  • dotnet run

如何选择退出How to opt out

.NET Core SDK 遥测功能默认处于启用状态。The .NET Core SDK telemetry feature is enabled by default. 要选择退出遥测功能,请将 DOTNET_CLI_TELEMETRY_OPTOUT 环境变量设置为 1trueTo opt out of the telemetry feature, set the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 or true.

如果安装成功,.NET Core SDK 安装程序也会发送一个遥测条目。A single telemetry entry is also sent by the .NET Core SDK installer when a successful installation happens. 要选择退出,请在安装 .NET Core SDK 之前设置 DOTNET_CLI_TELEMETRY_OPTOUT 环境变量。To opt out, set the DOTNET_CLI_TELEMETRY_OPTOUT environment variable before you install the .NET Core SDK.

公开Disclosure

首次运行其中一个 .NET Core CLI 命令(例如,dotnet build)时,.NET Core SDK 显示以下类似文本。The .NET Core SDK displays text similar to the following when you first run one of the .NET Core CLI commands (for example, dotnet build). 文本可能会因运行的 SDK 版本而略有不同。Text may vary slightly depending on the version of the SDK you're running. 此“首次运行”体验是 Microsoft 通知用户有关数据收集信息的方式。This "first run" experience is how Microsoft notifies you about data collection.

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

数据点Data points

遥测功能不收集用户名或电子邮件地址等个人数据。The telemetry feature doesn't collect personal data, such as usernames or email addresses. 也不会扫描代码,更不会提取项目级敏感数据,如名称、存储库或作者。It doesn't scan your code and doesn't extract project-level data, such as name, repository, or author. 数据通过 Azure Monitor 技术安全地发送到 Microsoft 服务器,提供对保留数据的受限访问权限,并在严格的安全控制下从安全的 Azure 存储系统发布。The data is sent securely to Microsoft servers using Azure Monitor technology, held under restricted access, and published under strict security controls from secure Azure Storage systems.

保护你的隐私对我们很重要。Protecting your privacy is important to us. 如果怀疑遥测在收集敏感数据,或认为我们处理数据的方式不安全或不恰当,请在 dotnet/cli 存储库中记录问题或发送电子邮件至 dotnet@microsoft.com 进行调查。If you suspect the telemetry is collecting sensitive data or the data is being insecurely or inappropriately handled, file an issue in the dotnet/cli repository or send an email to dotnet@microsoft.com for investigation.

遥测功能收集以下数据:The telemetry feature collects the following data:

SDK 版本SDK versions 数据Data
全部All 调用时间戳。Timestamp of invocation.
全部All 调用的命令(例如,“build”),从 2.1 开始进行哈希处理。Command invoked (for example, "build"), hashed starting in 2.1.
全部All 用于确定地理位置的三个八进制数 IP 地址。Three octet IP address used to determine the geographical location.
全部All 操作系统和版本。Operating system and version.
全部All 运行 SDK 的运行时 ID (RID)。Runtime ID (RID) the SDK is running on.
全部All .NET Core SDK 版本。.NET Core SDK version.
全部All 遥测配置文件:一个可选值,仅在用户显式选择加入时可用,并在 Microsoft 内部使用。Telemetry profile: an optional value only used with explicit user opt-in and used internally at Microsoft.
>=2.0>=2.0 命令参数和选项:收集若干参数和选项(非任意字符串)。Command arguments and options: several arguments and options are collected (not arbitrary strings). 请参阅收集的选项See collected options. 从 2.1.300 后进行哈希处理。Hashed after 2.1.300.
>=2.0>=2.0 SDK 是否在容器中运行。Whether the SDK is running in a container.
>=2.0>=2.0 目标框架(来自 TargetFramework 事件),从 2.1 开始进行哈希处理。Target frameworks (from the TargetFramework event), hashed starting in 2.1.
>=2.0>=2.0 经过哈希处理的媒体访问控制 (MAC) 地址:计算机的加密 (SHA256) 匿名唯一 ID。Hashed Media Access Control (MAC) address: a cryptographically (SHA256) anonymous and unique ID for a machine.
>=2.0>=2.0 经过哈希处理的当前工作目录。Hashed current working directory.
>=2.0>=2.0 安装成功报告,包含进行了哈希处理的安装程序 exe 文件名。Install success report, with hashed installer exe filename.
>=2.1.300>=2.1.300 内核版本。Kernel version.
>=2.1.300>=2.1.300 Libc 发行/版本。Libc release/version.
>=3.0.100>=3.0.100 是否已重定向输出(true 或 false)。Whether the output was redirected (true or false).
>=3.0.100>=3.0.100 CLI/SDK 故障时的异常类型及其堆栈跟踪(发送的堆栈跟踪中仅包含 CLI/SDK 代码)。On a CLI/SDK crash, the exception type and its stack trace (only CLI/SDK code is included in the stack trace sent). 有关详细信息,请参阅收集的 .NET Core CLI/SDK 故障异常遥测For more information, see .NET Core CLI/SDK crash exception telemetry collected.

收集的选项Collected options

某些命令发送其他数据。Certain commands send additional data. 小部分命令发送第一个参数:A subset of commands sends the first argument:

命令Command 发送的第一个参数数据First argument data sent
dotnet help <arg> 正在查询命令帮助。The command help is being queried for.
dotnet new <arg> 模板名称(进行哈希处理)。The template name (hashed).
dotnet add <arg> 单词 packagereferenceThe word package or reference.
dotnet remove <arg> 单词 packagereferenceThe word package or reference.
dotnet list <arg> 单词 packagereferenceThe word package or reference.
dotnet sln <arg> 单词 addlistremoveThe word add, list, or remove.
dotnet nuget <arg> 单词 deletelocalspushThe word delete, locals, or push.

一小部分命令发送所选项目(如果使用)及其值:A subset of commands sends selected options if they're used, along with their values:

选项Option 命令Commands
--verbosity 所有命令All commands
--language dotnet new
--configuration dotnet build, dotnet clean, dotnet publish, dotnet run, dotnet testdotnet build, dotnet clean, dotnet publish, dotnet run, dotnet test
--framework dotnet build, dotnet clean, dotnet publish, dotnet run, dotnet test, dotnet vstestdotnet build, dotnet clean, dotnet publish, dotnet run, dotnet test, dotnet vstest
--runtime dotnet builddotnet publishdotnet build, dotnet publish
--platform dotnet vstest
--logger dotnet vstest
--sdk-package-version dotnet migrate

--verbosity--sdk-package-version 外,从 .NET Core 2.1.100 SDK 开始,所有其他值都会进行哈希处理。Except for --verbosity and --sdk-package-version, all the other values are hashed starting with .NET Core 2.1.100 SDK.

收集的 .NET Core CLI/SDK 故障异常遥测.NET Core CLI/SDK crash exception telemetry collected

如果 .NET Core CLI/SDK 故障,则会收集 CLI/SDK 代码的异常和跟踪堆栈名称。If the .NET Core CLI/SDK crashes, it collects the name of the exception and stack trace of the CLI/SDK code. 收集此信息是为了评估问题并改善 .NET Core SDK 和 CLI 的质量。This information is collected to assess problems and improve the quality of the .NET Core SDK and CLI. 本文提供了所收集数据的信息。This article provides information about the data we collect. 本文还提供了有关生成自己的 .NET Core SDK 版本的用户如何避免无意泄露个人或敏感信息的提示。It also provides tips on how users building their own version of the .NET Core SDK can avoid inadvertent disclosure of personal or sensitive information.

收集的数据类型Types of collected data

.NET Core CLI 只收集有关 CLI/SDK 异常的信息,不收集应用程序中的异常信息。.NET Core CLI collects information for CLI/SDK exceptions only, not exceptions in your application. 收集的数据包含异常和堆栈跟踪的名称。The collected data contains the name of the exception and the stack trace. 此堆栈跟踪为 CLI/SDK 代码。This stack trace is of CLI/SDK code.

下面的示例显示所收集的数据类型:The following example shows the kind of data that is collected:

System.IO.IOException
at System.ConsolePal.WindowsConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(Char[] buffer)
at System.IO.TextWriter.WriteLine()
at System.IO.TextWriter.SyncTextWriter.WriteLine()
at Microsoft.DotNet.Cli.Utils.Reporter.WriteLine()
at Microsoft.DotNet.Tools.Run.RunCommand.EnsureProjectIsBuilt()
at Microsoft.DotNet.Tools.Run.RunCommand.Execute()
at Microsoft.DotNet.Tools.Run.RunCommand.Run(String[] args)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)

避免意外泄露信息Avoid inadvertent disclosure information

.NET Core 参与者以及运行自己生成的 .NET Core SDK 版本的任何其他人都应考虑其 SDK 源代码的路径。.NET Core contributors and anyone else running a version of the .NET Core SDK that they built themselves should consider the path to their SDK source code. 如果在使用属于自定义调试生成或者使用自定义生成符号文件配置的 .NET Core SDK 时出现故障,则生成计算机的 SDK 源文件路径将作为堆栈跟踪的一部分收集,并且不会进行哈希处理。If a crash occurs while using a .NET Core SDK that is a custom debug build or configured with custom build symbol files, the SDK source file path from the build machine is collected as part of the stack trace and isn't hashed.

因此,.NET Core SDK 的自定义生成不应位于路径名公开个人或敏感信息的目录中。Because of this, custom builds of the .NET Core SDK shouldn't be located in directories whose path names expose personal or sensitive information.

请参阅See also