metrics: docs

This commit is contained in:
Martin Holst Swende 2024-11-27 02:00:52 +01:00
parent 754c0c8211
commit 6bf03617e0
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
5 changed files with 6 additions and 8 deletions

View file

@ -34,8 +34,7 @@ type CounterSnapshot int64
// Count returns the count at the time the snapshot was taken.
func (c CounterSnapshot) Count() int64 { return int64(c) }
// Counter is the standard implementation of a Counter and uses the
// sync/atomic package to manage a single int64 value.
// Counter hold an int64 value that can be incremented and decremented.
type Counter atomic.Int64
// Clear sets the counter to zero.

View file

@ -35,7 +35,7 @@ type CounterFloat64Snapshot float64
// Count returns the value at the time the snapshot was taken.
func (c CounterFloat64Snapshot) Count() float64 { return float64(c) }
// CounterFloat64 is the uses atomic to manage a single float64 value.
// CounterFloat64 holds a float64 value that can be incremented and decremented.
type CounterFloat64 atomic.Uint64
// Clear sets the counter to zero.

View file

@ -34,9 +34,8 @@ func NewEWMA15() *EWMA {
return NewEWMA(1 - math.Exp(-5.0/60.0/15))
}
// EWMA imlements an exponential weighted moving average. It tracks the number
// of uncounted events and processes them on each tick. It uses the
// sync/atomic package to manage uncounted events.
// EWMA continuously calculate an exponentially-weighted moving average
// based on an outside source of clock ticks.
type EWMA struct {
uncounted atomic.Int64
alpha float64

View file

@ -32,7 +32,7 @@ func NewRegisteredGauge(name string, r Registry) *Gauge {
return c
}
// Gauge and uses the sync/atomic package to manage a single int64 value.
// Gauge holds an int64 value that can be set arbitrarily.
type Gauge atomic.Int64
// Snapshot returns a read-only copy of the gauge.

View file

@ -35,7 +35,7 @@ func NewRegisteredGaugeFloat64(name string, r Registry) *GaugeFloat64 {
return c
}
// GaugeFloat64 and uses atomic to manage a single float64 value.
// GaugeFloat64 hold a float64 value that can be set arbitrarily.
type GaugeFloat64 atomic.Uint64
// Snapshot returns a read-only copy of the gauge.