Skip to content

Commit 19a086f

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent aa95ab8 commit 19a086f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cmd/go/internal/telemetrystats/telemetrystats.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"cmd/go/internal/cfg"
1212
"cmd/go/internal/modload"
1313
"cmd/internal/telemetry/counter"
14+
"strings"
1415
)
1516

1617
func Increment() {
@@ -48,4 +49,16 @@ func incrementConfig() {
4849
case "wasm":
4950
counter.Inc("go/platform/target/gowasm:" + cfg.GOWASM)
5051
}
52+
53+
// Use cfg.Experiment.String instead of cfg.Experiment.Enabled
54+
// because we only want to count the experiments that differ
55+
// from the baseline.
56+
if cfg.Experiment != nil {
57+
for exp := range strings.SplitSeq(cfg.Experiment.String(), ",") {
58+
if exp == "" {
59+
continue
60+
}
61+
counter.Inc("go/goexperiment:" + exp)
62+
}
63+
}
5164
}

0 commit comments

Comments
 (0)