metrics: fix function comment (#29843)

pull/29853/head
Wukingbow 4 months ago committed by GitHub
parent d1d9f34e51
commit 7f5cc02a99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 18
      metrics/debug.go

@ -19,18 +19,18 @@ var (
gcStats debug.GCStats gcStats debug.GCStats
) )
// Capture new values for the Go garbage collector statistics exported in // CaptureDebugGCStats captures new values for the Go garbage collector statistics
// debug.GCStats. This is designed to be called as a goroutine. // exported in debug.GCStats. This is designed to be called as a goroutine.
func CaptureDebugGCStats(r Registry, d time.Duration) { func CaptureDebugGCStats(r Registry, d time.Duration) {
for range time.Tick(d) { for range time.Tick(d) {
CaptureDebugGCStatsOnce(r) CaptureDebugGCStatsOnce(r)
} }
} }
// Capture new values for the Go garbage collector statistics exported in // CaptureDebugGCStatsOnce captures new values for the Go garbage collector
// debug.GCStats. This is designed to be called in a background goroutine. // statistics exported in debug.GCStats. This is designed to be called in
// Giving a registry which has not been given to RegisterDebugGCStats will // a background goroutine. Giving a registry which has not been given to
// panic. // RegisterDebugGCStats will panic.
// //
// Be careful (but much less so) with this because debug.ReadGCStats calls // Be careful (but much less so) with this because debug.ReadGCStats calls
// the C function runtime·lock(runtime·mheap) which, while not a stop-the-world // the C function runtime·lock(runtime·mheap) which, while not a stop-the-world
@ -50,9 +50,9 @@ func CaptureDebugGCStatsOnce(r Registry) {
debugMetrics.GCStats.PauseTotal.Update(int64(gcStats.PauseTotal)) debugMetrics.GCStats.PauseTotal.Update(int64(gcStats.PauseTotal))
} }
// Register metrics for the Go garbage collector statistics exported in // RegisterDebugGCStats registers metrics for the Go garbage collector statistics
// debug.GCStats. The metrics are named by their fully-qualified Go symbols, // exported in debug.GCStats. The metrics are named by their fully-qualified Go
// i.e. debug.GCStats.PauseTotal. // symbols, i.e. debug.GCStats.PauseTotal.
func RegisterDebugGCStats(r Registry) { func RegisterDebugGCStats(r Registry) {
debugMetrics.GCStats.LastGC = NewGauge() debugMetrics.GCStats.LastGC = NewGauge()
debugMetrics.GCStats.NumGC = NewGauge() debugMetrics.GCStats.NumGC = NewGauge()

Loading…
Cancel
Save