Skip to content

Commit

Permalink
gopls/internal/telemetry/cmd/stacks: include client name in report
Browse files Browse the repository at this point in the history
Change-Id: Id1070d775d1a3bcfa5b2302b862b4e78f1411678
Reviewed-on: https://go-review.googlesource.com/c/tools/+/557735
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
  • Loading branch information
adonovan committed Jan 23, 2024
1 parent 6a58b98 commit 6fe9326
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions gopls/internal/telemetry/cmd/stacks/stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"log"
"net/http"
"net/url"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -72,15 +73,30 @@ func main() {
if prog.Program == "golang.org/x/tools/gopls" && len(prog.Stacks) > 0 {
total++

// Include applicable client names (e.g. vscode, eglot).
var clients []string
var clientSuffix string
for key := range prog.Counters {
client := strings.TrimPrefix(key, "gopls/client:")
if client != key {
clients = append(clients, client)
}
}
sort.Strings(clients)
if len(clients) > 0 {
clientSuffix = " " + strings.Join(clients, ",")
}

// Ignore @devel versions as they correspond to
// ephemeral (and often numerous) variations of
// the program as we work on a fix to a bug.
if prog.Version == "devel" {
continue
}
info := fmt.Sprintf("%s@%s %s %s/%s",
info := fmt.Sprintf("%s@%s %s %s/%s%s",
prog.Program, prog.Version,
prog.GoVersion, prog.GOOS, prog.GOARCH)
prog.GoVersion, prog.GOOS, prog.GOARCH,
clientSuffix)
for stack, count := range prog.Stacks {
counts := stacks[stack]
if counts == nil {
Expand Down

0 comments on commit 6fe9326

Please sign in to comment.