mirror of
https://github.com/golang/go
synced 2024-11-22 14:24:45 -07:00
cmd: vendor golang.org/x/telemetry@a740542
Commands run: go get golang.org/x/telemetry@a740542 go mod tidy go mod vendor Change-Id: I8b1a71adc05f3c54f9492dfb9cfd1873727e5680 Reviewed-on: https://go-review.googlesource.com/c/go/+/594017 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
cb3b34349b
commit
0af2148fdc
@ -9,7 +9,7 @@ require (
|
||||
golang.org/x/mod v0.18.0
|
||||
golang.org/x/sync v0.7.0
|
||||
golang.org/x/sys v0.21.0
|
||||
golang.org/x/telemetry v0.0.0-20240621183135-b4de734908f6
|
||||
golang.org/x/telemetry v0.0.0-20240621194115-a740542b267c
|
||||
golang.org/x/term v0.20.0
|
||||
golang.org/x/tools v0.22.1-0.20240618181713-f2d2ebe43e72
|
||||
)
|
||||
|
@ -16,8 +16,8 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/telemetry v0.0.0-20240621183135-b4de734908f6 h1:2+8QyQRLYDeEKd+CM/BsuaBaLdhAsNdasS/SnZfPS9g=
|
||||
golang.org/x/telemetry v0.0.0-20240621183135-b4de734908f6/go.mod h1:n38mvGdgc4dA684EC4NwQwoPKSw4jyKw8/DgZHDA1Dk=
|
||||
golang.org/x/telemetry v0.0.0-20240621194115-a740542b267c h1:zNxtD9mZQCgRwCNanVRlJ/XlOyATHcbR+09LzoArRl4=
|
||||
golang.org/x/telemetry v0.0.0-20240621194115-a740542b267c/go.mod h1:n38mvGdgc4dA684EC4NwQwoPKSw4jyKw8/DgZHDA1Dk=
|
||||
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
|
4
src/cmd/vendor/golang.org/x/telemetry/counter/counter.go
generated
vendored
4
src/cmd/vendor/golang.org/x/telemetry/counter/counter.go
generated
vendored
@ -83,8 +83,6 @@ func NewStack(name string, depth int) *StackCounter {
|
||||
// If the telemetry mode is "off", Open is a no-op. Otherwise, it opens the
|
||||
// counter file on disk and starts to mmap telemetry counters to the file.
|
||||
// Open also persists any counters already created in the current process.
|
||||
//
|
||||
// Programs using telemetry should call either Open or OpenDir exactly once.
|
||||
func Open() {
|
||||
counter.Open()
|
||||
}
|
||||
@ -95,8 +93,6 @@ func Open() {
|
||||
// If the telemetry mode is "off", Open is a no-op. Otherwise, it opens the
|
||||
// counter file on disk and starts to mmap telemetry counters to the file.
|
||||
// Open also persists any counters already created in the current process.
|
||||
//
|
||||
// Programs using telemetry should call either Open or OpenDir exactly once.
|
||||
func OpenDir(telemetryDir string) {
|
||||
if telemetryDir != "" {
|
||||
telemetry.Default = telemetry.NewDir(telemetryDir)
|
||||
|
35
src/cmd/vendor/golang.org/x/telemetry/internal/counter/file.go
generated
vendored
35
src/cmd/vendor/golang.org/x/telemetry/internal/counter/file.go
generated
vendored
@ -340,6 +340,8 @@ func (f *file) newCounter1(name string) (v *atomic.Uint64, cleanup func()) {
|
||||
return v, cleanup
|
||||
}
|
||||
|
||||
var openOnce sync.Once
|
||||
|
||||
// Open associates counting with the defaultFile.
|
||||
// The returned function is for testing only, and should
|
||||
// be called after all Inc()s are finished, but before
|
||||
@ -349,22 +351,27 @@ func Open() func() {
|
||||
if telemetry.DisabledOnPlatform {
|
||||
return func() {}
|
||||
}
|
||||
if mode, _ := telemetry.Default.Mode(); mode == "off" {
|
||||
// Don't open the file when telemetry is off.
|
||||
defaultFile.err = ErrDisabled
|
||||
return func() {} // No need to clean up.
|
||||
}
|
||||
debugPrintf("Open")
|
||||
defaultFile.rotate()
|
||||
return func() {
|
||||
// Once this has been called, the defaultFile is no longer usable.
|
||||
mf := defaultFile.current.Load()
|
||||
if mf == nil {
|
||||
// telemetry might have been off
|
||||
close := func() {}
|
||||
openOnce.Do(func() {
|
||||
if mode, _ := telemetry.Default.Mode(); mode == "off" {
|
||||
// Don't open the file when telemetry is off.
|
||||
defaultFile.err = ErrDisabled
|
||||
// No need to clean up.
|
||||
return
|
||||
}
|
||||
mf.close()
|
||||
}
|
||||
debugPrintf("Open")
|
||||
defaultFile.rotate()
|
||||
close = func() {
|
||||
// Once this has been called, the defaultFile is no longer usable.
|
||||
mf := defaultFile.current.Load()
|
||||
if mf == nil {
|
||||
// telemetry might have been off
|
||||
return
|
||||
}
|
||||
mf.close()
|
||||
}
|
||||
})
|
||||
return close
|
||||
}
|
||||
|
||||
// A mappedFile is a counter file mmapped into memory.
|
||||
|
2
src/cmd/vendor/modules.txt
vendored
2
src/cmd/vendor/modules.txt
vendored
@ -45,7 +45,7 @@ golang.org/x/sync/semaphore
|
||||
golang.org/x/sys/plan9
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
# golang.org/x/telemetry v0.0.0-20240621183135-b4de734908f6
|
||||
# golang.org/x/telemetry v0.0.0-20240621194115-a740542b267c
|
||||
## explicit; go 1.20
|
||||
golang.org/x/telemetry
|
||||
golang.org/x/telemetry/counter
|
||||
|
Loading…
Reference in New Issue
Block a user