From: qmuntal Date: Tue, 15 Jul 2025 13:24:25 +0000 (+0200) Subject: cmd/go/internal/telemetrystats: count goexperiments X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=19a086f716869bc79df24e1f30d74334261396db;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Robert Findley Reviewed-by: Michael Matloob --- diff --git a/src/cmd/go/internal/telemetrystats/telemetrystats.go b/src/cmd/go/internal/telemetrystats/telemetrystats.go index 950453fa95..d5b642240f 100644 --- a/src/cmd/go/internal/telemetrystats/telemetrystats.go +++ b/src/cmd/go/internal/telemetrystats/telemetrystats.go @@ -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) + } + } }