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

x/tools/gopls: enable telemetry prompting for all gopls-backed editors #67821

Open
hyangah opened this issue Jun 4, 2024 · 3 comments
Open
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Jun 4, 2024

Gopls's telemetry prompting is currently disabled by default.
Client should enable by either setting an internal setting or by calling the prompt command.
VS Code Go extension calls the command for the user selected based on
the hash of vscode client id, after at least a week has passed since a telemetry-enabled
gopls version runs. We now want to move this sampling and decision making to gopls, too,
and enable the prompting in all editors, not only in vscode.

That means we need to record more info in the prompt file in the gopls config directory.

Requirement:

  • Preserve the info recorded in the prompt file and avoid prompting users again.
  • Do not prompt if the user just started to use gopls. Wait for 1 week.

Some nice-to-haves:

  • VS Code Go extension had been running it for awhile. For consistency in sampling, let gopls use the same hash for vs code users.
  • If possible, migrate the telemetry start time recorded in the VS Code Go extension's memento.
@hyangah hyangah added this to the gopls/v0.17.0 milestone Jun 4, 2024
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jun 4, 2024
@hyangah hyangah self-assigned this Jun 4, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/589517 mentions this issue: gopls/internal/server: conditionally prompt for telemetry

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/589836 mentions this issue: internal/settings: prompt for telemetry by default

gopherbot pushed a commit to golang/tools that referenced this issue Jun 27, 2024
Previously, VS Code Go extension conditionally asked gopls to
consider to prompt, only if
  * it thinks telemetry data was logged for 7days+, and
  * the user is selected (based on hash of vscode cliet id)

This change implements the condition checking inside gopls,
so we can enable prompting for other editor users and simplify
vscode-go's code.

The prompt file format is changed.
   old format: <state> <prompt_count>
   new format: <state> <prompt_count> <creation_unix_time> <token>

where
 - creation_unix_time is the guessed telemetry start time (unix time)
 - token is a random integer in [1, 1000], which is used in sampling
  decision.

This CL adds environment variables to control the creation_unix_time
and token values in integration testing. They are also useful for
manual testing, and for VS Code Go prompt logic migration.
VS Code Go extension had been used a vscode machine id hash
and kept its observed telemetry start time in memento. The env vars
can be used to forward the info to gopls.

For golang/go#67821

Change-Id: I13d2bf6d43ea1e5ef8ebec7eb2f89fc9af8a8db7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/589517
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/595535 mentions this issue: extension/src/goTelemetry: set telemetry env vars

gopherbot pushed a commit to golang/vscode-go that referenced this issue Jun 27, 2024
GOTELEMETRY_GOPLS_CLIENT_START_TIME and
GOTELEMETRY_GOPLS_CLIENT_TOKEN are the env vars
read by gopls v0.17+. See CL 589517

Use them to forward the vscode-go's telemetry
decision as we transition to gopls based prompting
logic.

For golang/go#67821

Change-Id: Ib3e014217ae7718a8677c7d8f181005fbc0577f6
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/595535
Commit-Queue: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
@findleyr findleyr changed the title x/tools/gopls: enable telemetry prompting for all editors x/tools/gopls: enable telemetry prompting for all gopls-backed editors Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants