aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/telemetry/telemetry.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/internal/telemetry/telemetry.go')
-rw-r--r--src/cmd/internal/telemetry/telemetry.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cmd/internal/telemetry/telemetry.go b/src/cmd/internal/telemetry/telemetry.go
index 0e223442ff..d31f0eeff3 100644
--- a/src/cmd/internal/telemetry/telemetry.go
+++ b/src/cmd/internal/telemetry/telemetry.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !cmd_go_bootstrap
+//go:build !cmd_go_bootstrap && !compiler_bootstrap
// Package telemetry is a shim package around the golang.org/x/telemetry
// and golang.org/x/telemetry/counter packages that has code build tagged
@@ -38,14 +38,24 @@ func StartWithUpload() {
})
}
+// Inc increments the counter with the given name.
func Inc(name string) {
counter.Inc(name)
}
+// NewCounter returns a counter with the given name.
func NewCounter(name string) *counter.Counter {
return counter.New(name)
}
+// NewStack returns a new stack counter with the given name and depth.
+func NewStackCounter(name string, depth int) *counter.StackCounter {
+ return counter.NewStack(name, depth)
+}
+
+// CountFlags creates a counter for every flag that is set
+// and increments the counter. The name of the counter is
+// the concatenation of prefix and the flag name.
func CountFlags(prefix string, flagSet flag.FlagSet) {
counter.CountFlags(prefix, flagSet)
}