mirror of
https://github.com/golang/go.git
synced 2025-10-19 11:03:18 +00:00
cmd/go/internal/telemetrystats: count goexperiments
Knowing which goexperiments are enabled by the users is useful information to have in the local telemetry database. It also opens the door for uploading them in the future if desired. Change-Id: I12c8eaa3997dec0ed26703885f1c216676f5590d Reviewed-on: https://go-review.googlesource.com/c/go/+/688135 Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
aa95ab8215
commit
19a086f716
1 changed files with 13 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"cmd/go/internal/cfg"
|
||||
"cmd/go/internal/modload"
|
||||
"cmd/internal/telemetry/counter"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Increment() {
|
||||
|
@ -48,4 +49,16 @@ func incrementConfig() {
|
|||
case "wasm":
|
||||
counter.Inc("go/platform/target/gowasm:" + cfg.GOWASM)
|
||||
}
|
||||
|
||||
// Use cfg.Experiment.String instead of cfg.Experiment.Enabled
|
||||
// because we only want to count the experiments that differ
|
||||
// from the baseline.
|
||||
if cfg.Experiment != nil {
|
||||
for exp := range strings.SplitSeq(cfg.Experiment.String(), ",") {
|
||||
if exp == "" {
|
||||
continue
|
||||
}
|
||||
counter.Inc("go/goexperiment:" + exp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue