]> Cypherpunks repositories - gostls13.git/commit
cmd: add telemetry for commands in cmd
authorMichael Matloob <matloob@golang.org>
Mon, 13 May 2024 18:59:02 +0000 (14:59 -0400)
committerMichael Matloob <matloob@golang.org>
Tue, 14 May 2024 19:41:17 +0000 (19:41 +0000)
commiteef288da1e7d2815cfa07e486b101ba21f0e0db1
tree3710ab34f42a5b4e1a1ed7d19a086fd0ed744054
parentefc347348e965f8db4f036ac0c9c7bf214b7a929
cmd: add telemetry for commands in cmd

This change modifies the commands in cmd to open counter files,
increment invocations counters and to increment counters for the names
of the flags that were passed in.

cmd/pprof and cmd/vet are both wrappers around tools defined in other
modules which do their own flag processing so we can't directly
increment flag counters right after flags are parsed. For those two
commands we wait to increment counters until after the programs have
returned.

cmd/dist is built with the bootstrap go so it can't depend on telemetry
yet. We can add telemetry support to it once 1.23 is the minimum
bootstrap version.

For #58894

Change-Id: Ic7f6009992465e55c56ad4dc6451bcb1ca51374a
Reviewed-on: https://go-review.googlesource.com/c/go/+/585235
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
18 files changed:
src/cmd/addr2line/main.go
src/cmd/asm/main.go
src/cmd/buildid/buildid.go
src/cmd/cgo/main.go
src/cmd/covdata/covdata.go
src/cmd/cover/cover.go
src/cmd/distpack/pack.go
src/cmd/doc/main.go
src/cmd/fix/main.go
src/cmd/gofmt/gofmt.go
src/cmd/nm/nm.go
src/cmd/objdump/main.go
src/cmd/pack/pack.go
src/cmd/pprof/pprof.go
src/cmd/preprofile/main.go
src/cmd/test2json/main.go
src/cmd/trace/main.go
src/cmd/vet/main.go