metrics: fix some typos in comments and names #31023 (#1557)

This commit is contained in:
Daniel Liu 2025-09-22 20:44:29 +08:00 committed by GitHub
parent 6e5f466df9
commit 13d64fb5b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 6 deletions

View file

@ -1,5 +1,6 @@
// Hook go-metrics into expvar
// on any /debug/metrics request, load all vars from the registry into expvar, and execute regular expvar handler
package exp
import (

View file

@ -39,7 +39,7 @@ func NewRegisteredGaugeInfo(name string, r Registry) *GaugeInfo {
return c
}
// gaugeInfoSnapshot is a read-only copy of another GaugeInfo.
// GaugeInfoSnapshot is a read-only copy of another GaugeInfo.
type GaugeInfoSnapshot GaugeInfoValue
// Value returns the value at the time the snapshot was taken.

View file

@ -12,7 +12,7 @@ func Log(r Registry, freq time.Duration, l Logger) {
LogScaled(r, freq, time.Nanosecond, l)
}
// Output each metric in the given registry periodically using the given
// LogScaled outputs each metric in the given registry periodically using the given
// logger. Print timings in `scale` units (eg time.Millisecond) rather than nanos.
func LogScaled(r Registry, freq time.Duration, scale time.Duration, l Logger) {
du := float64(scale)

View file

@ -3,6 +3,7 @@
// <https://github.com/rcrowley/go-metrics>
//
// Coda Hale's original work: <https://github.com/codahale/metrics>
package metrics
import (

View file

@ -53,14 +53,14 @@ func (t *ResettingTimer) Snapshot() *ResettingTimerSnapshot {
return snapshot
}
// Record the duration of the execution of the given function.
// Time records the duration of the execution of the given function.
func (t *ResettingTimer) Time(f func()) {
ts := time.Now()
f()
t.Update(time.Since(ts))
}
// Record the duration of an event.
// Update records the duration of an event.
func (t *ResettingTimer) Update(d time.Duration) {
if !metricsEnabled {
return
@ -71,7 +71,7 @@ func (t *ResettingTimer) Update(d time.Duration) {
t.sum += int64(d)
}
// Record the duration of an event that started at a time and ends now.
// UpdateSince records the duration of an event that started at a time and ends now.
func (t *ResettingTimer) UpdateSince(ts time.Time) {
t.Update(time.Since(ts))
}

View file

@ -9,7 +9,7 @@ import (
"time"
)
// Output each metric in the given registry to syslog periodically using
// Syslog outputs each metric in the given registry to syslog periodically using
// the given syslogger.
func Syslog(r Registry, d time.Duration, w *syslog.Writer) {
for range time.Tick(d) {