cmd/internal: separate counter package from telemetry package

Move the code that opens and increments counters out of the
cmd/internal/telemetry package into cmd/internal/telemetry/counter. The
telemetry package has dependencies on the upload code, which we do not
want to pull into the rest of the go toolchain.

For #68109

Change-Id: I463c106819b169177a783de4a7d93377e81f4e3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/593976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Michael Matloob 2024-06-21 14:35:14 -04:00
parent 52ce25b44e
commit d79c350916
38 changed files with 236 additions and 210 deletions

View file

@ -20,20 +20,20 @@ import (
"cmd/internal/bio"
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/telemetry"
"cmd/internal/telemetry/counter"
)
func main() {
log.SetFlags(0)
log.SetPrefix("asm: ")
telemetry.OpenCounters()
counter.Open()
buildcfg.Check()
GOARCH := buildcfg.GOARCH
flags.Parse()
telemetry.Inc("asm/invocations")
telemetry.CountFlags("asm/flag:", *flag.CommandLine)
counter.Inc("asm/invocations")
counter.CountFlags("asm/flag:", *flag.CommandLine)
architecture := arch.Set(GOARCH, *flags.Shared || *flags.Dynlink)
if architecture == nil {