Skip to content

Commit 33da5c0

Browse files
committed
gopls/internal/telemetry: record Go version used in each view
Change-Id: I59233ca205b59726a75791db04dfc1fe8dd4fff4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/515558 Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]>
1 parent 732ad6f commit 33da5c0

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

gopls/internal/lsp/general.go

+1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ func (s *Server) checkViewGoVersions() {
317317
if oldestVersion == -1 || viewVersion < oldestVersion {
318318
oldestVersion, fromBuild = viewVersion, false
319319
}
320+
telemetry.RecordViewGoVersion(viewVersion)
320321
}
321322

322323
if msg, mType := versionMessage(oldestVersion, fromBuild); msg != "" {

gopls/internal/telemetry/telemetry.go

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package telemetry
66

77
import (
8+
"fmt"
89
"os"
910

1011
"golang.org/x/telemetry/counter"
@@ -50,3 +51,12 @@ func RecordClientInfo(params *protocol.ParamInitialize) {
5051
}
5152
counter.Inc(client)
5253
}
54+
55+
// RecordViewGoVersion records the Go minor version number (1.x) used for a view.
56+
func RecordViewGoVersion(x int) {
57+
if x < 0 {
58+
return
59+
}
60+
name := fmt.Sprintf("gopls/goversion:1.%d", x)
61+
counter.Inc(name)
62+
}

0 commit comments

Comments
 (0)