Skip to content
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

Add basic guidelines for telemetry usage for tooling authors #43097

Merged
merged 6 commits into from
Sep 9, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions documentation/project-docs/external-component-telemetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Responsibly managing telemetry in external components

Many components are _delivered_ with or by the .NET SDK but want to collect and
baronfel marked this conversation as resolved.
Show resolved Hide resolved
manage telemetry. The SDK has telemetry collection mechanisms that may appear
attractive, but present down-sides for these authors.
baronfel marked this conversation as resolved.
Show resolved Hide resolved

This document clarifies some guidelines for authors of components that are consumed by the .NET SDK but want to own their own telemetry.
baronfel marked this conversation as resolved.
Show resolved Hide resolved

## Sending telemetry

### DO create and manage your own MSBuild Task for sending telemetry

This allows you to have full control over the telemetry you send, where it is
sent, and any PII masking requirements that are unique to your product.
Attempting to use the .NET SDK's `AllowEmptyTelemetry` mechanism is not
recommended for most internal partners and all external users. This is because
`AllowEmptyTelemetry`
* is allow-listed for known events only, so your telemetry will not be sent
* sends to the SDK's telemetry storage, which your team may not have access to
* is dependent on the SDK version the user uses, which may lag behind the latest available

### DO NOT use the MSBuild Engine telemetry APIs for logging telemetry

These APIs, while convenient, require the MSBuild Engine Host (`dotnet build`,
`msbuild.exe`, Visual Studio Project system) to have configured a telemetry
collector. This is not guaranteed to be the case for all users of your component,
and the collector configured may not send telemetry in the manner you expect, or
to destinations you expect.

## Managing telemetry

### DO adhere to the SDK telemetry opt-out

The SDK has an [opt out](https://learn.microsoft.com/dotnet/core/tools/telemetry#how-to-opt-out) mechanism for telemetry that all SDK-generated
telemetry should adhere to. When running in the context of the SDK that means your
telemetry should adhere to this signal as well. This opt-out mechanism is an
environment variable, but the default value of this variable changes for
Microsoft-authored and source-built SDKs. The SDK should provide a unified
mechanism for tooling authors to rely on instead of probing for this value.
Loading