123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- package metrics
- import (
- "context"
- "time"
- )
- type Gauge interface {
- Set(value float64)
- Add(value float64)
- }
- type FuncGauge interface {
- Function() func() float64
- }
- type IntGauge interface {
- Set(value int64)
- Add(value int64)
- }
- type FuncIntGauge interface {
- Function() func() int64
- }
- type Counter interface {
-
- Inc()
-
- Add(delta int64)
- }
- type FuncCounter interface {
- Function() func() int64
- }
- type Histogram interface {
- RecordValue(value float64)
- }
- type Timer interface {
- RecordDuration(value time.Duration)
- }
- type DurationBuckets interface {
-
- Size() int
-
-
-
- MapDuration(d time.Duration) int
-
-
-
- UpperBound(bucketIndex int) time.Duration
- }
- type Buckets interface {
-
- Size() int
-
-
-
- MapValue(v float64) int
-
-
-
- UpperBound(bucketIndex int) float64
- }
- type GaugeVec interface {
- With(map[string]string) Gauge
-
- Reset()
- }
- type IntGaugeVec interface {
- With(map[string]string) IntGauge
-
- Reset()
- }
- type CounterVec interface {
- With(map[string]string) Counter
-
- Reset()
- }
- type TimerVec interface {
- With(map[string]string) Timer
-
- Reset()
- }
- type HistogramVec interface {
- With(map[string]string) Histogram
-
- Reset()
- }
- type Registry interface {
-
- WithTags(tags map[string]string) Registry
-
- WithPrefix(prefix string) Registry
- ComposeName(parts ...string) string
- Counter(name string) Counter
- CounterVec(name string, labels []string) CounterVec
- FuncCounter(name string, function func() int64) FuncCounter
- Gauge(name string) Gauge
- GaugeVec(name string, labels []string) GaugeVec
- FuncGauge(name string, function func() float64) FuncGauge
- IntGauge(name string) IntGauge
- IntGaugeVec(name string, labels []string) IntGaugeVec
- FuncIntGauge(name string, function func() int64) FuncIntGauge
- Timer(name string) Timer
- TimerVec(name string, labels []string) TimerVec
- Histogram(name string, buckets Buckets) Histogram
- HistogramVec(name string, buckets Buckets, labels []string) HistogramVec
- DurationHistogram(name string, buckets DurationBuckets) Timer
- DurationHistogramVec(name string, buckets DurationBuckets, labels []string) TimerVec
- }
- type CollectPolicy interface {
- RegisteredCounter(counterFunc func() int64) func() int64
- RegisteredGauge(gaugeFunc func() float64) func() float64
- AddCollect(collect func(ctx context.Context))
- }
|