Repository navigation
Make telemetry default configurable through go.env - #2566
Merged
Merged
Conversation
Resolve the Microsoft telemetry setting through Go's standard configuration hierarchy so distributions can change the installation default without patching telemetry code. Keep Microsoft builds default-on while allowing Azure Linux to set the GOROOT go.env default to off and enable it in selected 1P images. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test harness inherits CI’s telemetry opt-out and the new test hard-codes a downstream-configurable default.
2 open findings
What changed in this PR
Makes Microsoft Go telemetry configurable through standard go.env precedence.
Changes:
- Adds the installation-wide telemetry default and
go envintegration. - Documents configuration precedence.
- Adds override/restoration tests.
Patch consistency: Patches are happy!
| File | Description |
|---|---|
patches/0007-Add-appinsights-telemetry.patch |
Adds configuration, command integration, documentation, and tests. |
eng/doc/Telemetry.md |
Documents telemetry configuration and precedence. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep script telemetry enabled for the fake endpoint even when CI opts out globally, and make the go env test independent of the installation default. Co-authored-by: Copilot <[email protected]>
Point users from the installed go.env default to the detailed telemetry documentation. Co-authored-by: Copilot <[email protected]>
Place the telemetry setting before MS_GO_NOSYSTEMCRYPTO in environment and help lists. Co-authored-by: Copilot <[email protected]>
George Adams (gdams)
enabled auto-merge
October 12, 2026 13:58
Davis Goodin (dagood)
requested changes
Oct 12, 2026
Use the Microsoft build of Go product name consistently, preserve the documentation's newline style, and explain the enabled and disabled values at the start of the opt-out section. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Davis Goodin (dagood)
requested changes
Oct 12, 2026
Use platform-neutral process override guidance, clarify the Microsoft-specific scope, and format the enabled and disabled behavior as separate sentences. Co-authored-by: Copilot <[email protected]>
Davis Goodin (dagood)
approved these changes
Oct 12, 2026
Member
Author
|
Copilot backport these changes to the 1.27 and 1.26 release branches. |
This was referenced Oct 13, 2026
George Adams (gdams)
added a commit
that referenced
this pull request
Oct 14, 2026
…o.env (#2571) Backport #2566. Co-authored-by: Copilot <[email protected]>
George Adams (gdams)
added a commit
that referenced
this pull request
Oct 14, 2026
…o.env (#2570) Backport #2566. The standalone telemetry guide does not exist on this release branch, so this backport contains only the Go patch update. Co-authored-by: Copilot <[email protected]>
Régis Desgroppes (rdesgroppes)
added a commit
to DataDog/datadog-agent
that referenced
this pull request
Nov 6, 2026
### What does this PR do? Patch the `msgo` SDK's `go.env` so that `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` defaults to `0`, as microsoft/go#2566 lets distributions do and microsoft/azurelinux#19611 does. Users can still opt in through their environment or `go env -w`, which both take precedence over `GOROOT/go.env`. ### Motivation #58511 made `msgo` a Bazel SDK whose `go.env` enables Microsoft's telemetry, which its `go build`, `go install` and `go run` send unless `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0` is set. #58530 builds FIPS binaries with `bazel run //:msgo -- build`, only opted out by the `ENV` that `DataDog/datadog-agent-buildimages` sets in its images, leaving other hosts, developer ones included, sending it. Opting out in the SDK itself covers every host and lets the build images drop that `ENV`. ### Describe how you validated your changes With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` unset, checked on Linux and Windows that `bazel run //:msgo -- env MS_GOTOOLCHAIN_TELEMETRY_ENABLED` prints `0`, whereas it prints `1` on Linux without the patch. With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=1` on Linux, checked that it prints `1`. Checked that `MODULE.bazel.lock` is unchanged and that `bazel run //bazel/buildifier:test` passes. ### Additional Notes Unlike `--run_env=MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0`, the patch keeps the user opt-in and covers every `go` command run from `@msgo`, not only `bazel run //:msgo`. The patch fails the SDK fetch should a later `msgo` release reword its `go.env`, rather than silently leaving telemetry on.
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Nov 6, 2026
### What does this PR do? Patch the `msgo` SDK's `go.env` so that `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` defaults to `0`, as microsoft/go#2566 lets distributions do and microsoft/azurelinux#19611 indeed does. Users can still opt in through their environment or `go env -w`, which both take precedence over `GOROOT/go.env`. ### Motivation #58511 made `msgo` a Bazel SDK whose `go.env` enables Microsoft's telemetry, which its `go build`, `go install` and `go run` send unless `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0` is set. #58530 builds FIPS binaries with `bazel run //:msgo -- build`, only opted out by the `ENV` that `DataDog/datadog-agent-buildimages` sets in its images, leaving other hosts, developer ones included, sending it. Opting out in the SDK itself covers every host and lets the build images drop that `ENV`. ### Describe how you validated your changes With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` unset, checked on Linux and Windows that `bazel run //:msgo -- env MS_GOTOOLCHAIN_TELEMETRY_ENABLED` prints `0`, whereas it prints `1` on Linux without the patch. With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=1` on Linux, checked that it prints `1`. ### Additional Notes Unlike `--run_env=MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0`, the patch keeps the user opt-in and covers every `go` command run from `@msgo`, not only `bazel run //:msgo`. The patch fails the SDK fetch should a later `msgo` release reword its `go.env`, rather than silently leaving telemetry on. Co-authored-by: regis.desgroppes <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
MS_GOTOOLCHAIN_TELEMETRY_ENABLED=1in the installation-wideGOROOT/go.envcmd/go/internal/cfgso process environment and userGOENVvalues override the installation defaultgo envand document it ingo help environmentRationale
Microsoft Go telemetry remains enabled by default. Azure Linux disables it because its general-purpose images run third-party workloads, and currently carries a downstream code-and-test patch to make telemetry opt-in:
https://github.com/microsoft/azurelinux/blob/4.0/specs/g/golang/0007-Disable-msft-go-telemetry-by-default.patch
Using Go's existing installation configuration lets Azure Linux express that policy by changing one line in
GOROOT/go.env:MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0Selected 1P image builds can restore the value to
1during image construction without rebuilding Go. Explicit process environment and per-userGOENVsettings retain higher precedence, so users and workloads can still override the image default.Resolving the value in
cmd/goand passing a boolean to the shared telemetry counter package avoids introducing a dependency fromcmd/internal/telemetrytocmd/go/internal/cfg.Validation
go test cmd/go -run '^TestScript$/^env_write$' -count=1go test cmd/internal/telemetry/counter -count=1go test -tags=cmd_go_bootstrap cmd/internal/telemetry/counter -count=1git go-patch extractsuccessfully reapplied the full patch stack in its temporary validation clone