metrics: fix docstring names (#28923)

This commit is contained in:
Daniel Liu 2024-12-13 14:00:13 +08:00
parent 49b5886150
commit 6f67b357de
8 changed files with 10 additions and 10 deletions

View file

@ -8,7 +8,7 @@ type CounterSnapshot interface {
Count() int64 Count() int64
} }
// Counters hold an int64 value that can be incremented and decremented. // Counter hold an int64 value that can be incremented and decremented.
type Counter interface { type Counter interface {
Clear() Clear()
Dec(int64) Dec(int64)

View file

@ -2,12 +2,12 @@ package metrics
import "sync/atomic" import "sync/atomic"
// gaugeSnapshot contains a readonly int64. // GaugeSnapshot contains a readonly int64.
type GaugeSnapshot interface { type GaugeSnapshot interface {
Value() int64 Value() int64
} }
// Gauges hold an int64 value that can be set arbitrarily. // Gauge holds an int64 value that can be set arbitrarily.
type Gauge interface { type Gauge interface {
Snapshot() GaugeSnapshot Snapshot() GaugeSnapshot
Update(int64) Update(int64)

View file

@ -48,7 +48,7 @@ type gaugeFloat64Snapshot float64
// Value returns the value at the time the snapshot was taken. // Value returns the value at the time the snapshot was taken.
func (g gaugeFloat64Snapshot) Value() float64 { return float64(g) } func (g gaugeFloat64Snapshot) Value() float64 { return float64(g) }
// NilGauge is a no-op Gauge. // NilGaugeFloat64 is a no-op Gauge.
type NilGaugeFloat64 struct{} type NilGaugeFloat64 struct{}
func (NilGaugeFloat64) Snapshot() GaugeFloat64Snapshot { return NilGaugeFloat64{} } func (NilGaugeFloat64) Snapshot() GaugeFloat64Snapshot { return NilGaugeFloat64{} }

View file

@ -9,7 +9,7 @@ type GaugeInfoSnapshot interface {
Value() GaugeInfoValue Value() GaugeInfoValue
} }
// GaugeInfos hold a GaugeInfoValue value that can be set arbitrarily. // GaugeInfo holds a GaugeInfoValue value that can be set arbitrarily.
type GaugeInfo interface { type GaugeInfo interface {
Update(GaugeInfoValue) Update(GaugeInfoValue)
Snapshot() GaugeInfoSnapshot Snapshot() GaugeInfoSnapshot

View file

@ -1,6 +1,6 @@
package metrics package metrics
// Healthchecks hold an error value describing an arbitrary up/down status. // Healthcheck holds an error value describing an arbitrary up/down status.
type Healthcheck interface { type Healthcheck interface {
Check() Check()
Error() error Error() error

View file

@ -4,7 +4,7 @@ type HistogramSnapshot interface {
SampleSnapshot SampleSnapshot
} }
// Histograms calculate distribution statistics from a series of int64 values. // Histogram calculates distribution statistics from a series of int64 values.
type Histogram interface { type Histogram interface {
Clear() Clear()
Update(int64) Update(int64)

View file

@ -25,7 +25,7 @@ type v2Reporter struct {
write api.WriteAPI write api.WriteAPI
} }
// InfluxDBWithTags starts a InfluxDB reporter which will post the from the given metrics.Registry at each d interval with the specified tags // InfluxDBV2WithTags starts a InfluxDB reporter which will post the from the given metrics.Registry at each d interval with the specified tags
func InfluxDBV2WithTags(r metrics.Registry, d time.Duration, endpoint string, token string, bucket string, organization string, namespace string, tags map[string]string) { func InfluxDBV2WithTags(r metrics.Registry, d time.Duration, endpoint string, token string, bucket string, organization string, namespace string, tags map[string]string) {
rep := &v2Reporter{ rep := &v2Reporter{
reg: r, reg: r,

View file

@ -148,13 +148,13 @@ func (NilSample) Clear() {}
func (NilSample) Snapshot() SampleSnapshot { return (*emptySnapshot)(nil) } func (NilSample) Snapshot() SampleSnapshot { return (*emptySnapshot)(nil) }
func (NilSample) Update(v int64) {} func (NilSample) Update(v int64) {}
// SamplePercentiles returns an arbitrary percentile of the slice of int64. // SamplePercentile returns an arbitrary percentile of the slice of int64.
func SamplePercentile(values []int64, p float64) float64 { func SamplePercentile(values []int64, p float64) float64 {
return CalculatePercentiles(values, []float64{p})[0] return CalculatePercentiles(values, []float64{p})[0]
} }
// CalculatePercentiles returns a slice of arbitrary percentiles of the slice of // CalculatePercentiles returns a slice of arbitrary percentiles of the slice of
// int64. This method returns interpolated results, so e.g if there are only two // int64. This method returns interpolated results, so e.g. if there are only two
// values, [0, 10], a 50% percentile will land between them. // values, [0, 10], a 50% percentile will land between them.
// //
// Note: As a side-effect, this method will also sort the slice of values. // Note: As a side-effect, this method will also sort the slice of values.