Documentation ¶
Overview ¶
Go port of Coda Hale's Metrics library
<https://github.com/msaf1980/go-metrics>
Coda Hale's original work: <https://github.com/codahale/metrics>
Example ¶
c := NewCounter() Register("money", c) c.Inc(17) // Threadsafe registration // t := GetOrRegisterTimer("db.get.latency", nil) // t.Time(func() {}) // t.Update(1) fmt.Println(c.Count()) // fmt.Println(t.Min())
Output:
Index ¶
- Variables
- func CaptureRuntimeMemStats(d time.Duration)
- func CaptureRuntimeMemStatsOnce()
- func Each(f func(name, tags string, tagsMap map[string]string, i interface{}) error, ...) error
- func Get(name string) interface{}
- func GetOrRegister(name string, i interface{}) interface{}
- func GetOrRegisterT(name string, tagsMap map[string]string, i interface{}) interface{}
- func GetT(name string, tagsMap map[string]string) interface{}
- func JoinTags(tagsMap map[string]string) string
- func Max(a, b int) int
- func MergeTags(a, b map[string]string) map[string]string
- func Min(a, b int) int
- func MustRegister(name string, i interface{})
- func MustRegisterT(name string, tagsMap map[string]string, i interface{})
- func Register(name string, i interface{}) error
- func RegisterRuntimeMemStats(r Registry)
- func RegisterT(name string, tagsMap map[string]string, i interface{}) error
- func RunHealthchecks()
- func Unregister(name string)
- func UnregisterT(name string, tagsMap map[string]string)
- type Counter
- func GetOrRegisterCounter(name string, r Registry) Counter
- func GetOrRegisterCounterT(name string, tagsMap map[string]string, r Registry) Counter
- func NewCounter() Counter
- func NewRegisteredCounter(name string, r Registry) Counter
- func NewRegisteredCounterT(name string, tagsMap map[string]string, r Registry) Counter
- type CounterSnapshot
- type DownCounter
- func GetOrRegisterDownCounter(name string, r Registry) DownCounter
- func GetOrRegisterDownCounterT(name string, tagsMap map[string]string, r Registry) DownCounter
- func NewDownCounter() DownCounter
- func NewRegisteredDownCounter(name string, r Registry) DownCounter
- func NewRegisteredDownCounterT(name string, tagsMap map[string]string, r Registry) DownCounter
- type DownCounterSnapshot
- type DuplicateMetric
- type FFixedHistogram
- type FGauge
- func GetOrRegisterFGauge(name string, r Registry) FGauge
- func GetOrRegisterFGaugeT(name string, tagsMap map[string]string, r Registry) FGauge
- func NewFGauge() FGauge
- func NewFunctionalFGauge(f func() float64) FGauge
- func NewRegisteredFGauge(name string, r Registry) FGauge
- func NewRegisteredFGaugeT(name string, tagsMap map[string]string, r Registry) FGauge
- func NewRegisteredFunctionalFGauge(name string, r Registry, f func() float64) FGauge
- func NewRegisteredFunctionalFGaugeT(name string, tagsMap map[string]string, r Registry, f func() float64) FGauge
- type FGaugeSnapshot
- type FHistogram
- func GetOrRegisterFFixedHistogram(name string, r Registry, startVal, endVal, width float64) FHistogram
- func GetOrRegisterFFixedHistogramT(name string, tagsMap map[string]string, r Registry, ...) FHistogram
- func GetOrRegisterFVHistogram(name string, r Registry, weights []float64, names []string) FHistogram
- func GetOrRegisterFVHistogramT(name string, tagsMap map[string]string, r Registry, weights []float64, ...) FHistogram
- func NewFFixedHistogram(startVal, endVal, width float64) FHistogram
- func NewRegisteredFFixedHistogram(name string, r Registry, startVal, endVal, width float64) FHistogram
- func NewRegisteredFFixedHistogramT(name string, tagsMap map[string]string, r Registry, ...) FHistogram
- func NewRegisteredFVHistogram(name string, r Registry, weights []float64, names []string) FHistogram
- func NewRegisteredFVHistogramT(name string, tagsMap map[string]string, r Registry, weights []float64, ...) FHistogram
- type FHistogramSnapshot
- func (h *FHistogramSnapshot) Add(v float64)
- func (FHistogramSnapshot) AddLabelPrefix(string) FHistogram
- func (h *FHistogramSnapshot) Clear() []uint64
- func (h *FHistogramSnapshot) Interface() HistogramInterface
- func (h *FHistogramSnapshot) IsSummed() bool
- func (h *FHistogramSnapshot) Labels() []string
- func (h *FHistogramSnapshot) NameTotal() string
- func (FHistogramSnapshot) SetLabels([]string) FHistogram
- func (FHistogramSnapshot) SetNameTotal(string) FHistogram
- func (h *FHistogramSnapshot) Snapshot() FHistogram
- func (h *FHistogramSnapshot) Values() []uint64
- func (h *FHistogramSnapshot) Weights() []float64
- func (h *FHistogramSnapshot) WeightsAliases() []string
- type FHistogramStorage
- func (h *FHistogramStorage) AddLabelPrefix(labelPrefix string)
- func (h *FHistogramStorage) Clear() []uint64
- func (h *FHistogramStorage) Interface() HistogramInterface
- func (h *FHistogramStorage) IsSummed() bool
- func (h *FHistogramStorage) Labels() []string
- func (h *FHistogramStorage) NameTotal() string
- func (h *FHistogramStorage) SetLabels(labels []string)
- func (h *FHistogramStorage) SetNameTotal(total string)
- func (h *FHistogramStorage) Snapshot() FHistogram
- func (h *FHistogramStorage) Values() []uint64
- func (h *FHistogramStorage) Weights() []float64
- func (h *FHistogramStorage) WeightsAliases() []string
- type FRate
- type FRateNames
- type FRateSnapshot
- func (FRateSnapshot) Clear() (float64, float64)
- func (g *FRateSnapshot) Name() string
- func (g *FRateSnapshot) RateName() string
- func (FRateSnapshot) SetName(string) FRate
- func (FRateSnapshot) SetRateName(string) FRate
- func (g *FRateSnapshot) Snapshot() FRate
- func (FRateSnapshot) Update(float64)
- func (FRateSnapshot) UpdateTs(float64, int64)
- func (g *FRateSnapshot) Values() (float64, float64)
- type FVHistogram
- func (h *FVHistogram) Add(v float64)
- func (h *FVHistogram) AddLabelPrefix(labelPrefix string) FHistogram
- func (h *FVHistogram) SetLabels(labels []string) FHistogram
- func (h *FVHistogram) SetNameTotal(total string) FHistogram
- func (h *FVHistogram) Snapshot() FHistogram
- func (h *FVHistogram) Values() []uint64
- type FixedHistogram
- type FixedSumHistogram
- func (h *FixedSumHistogram) Add(v int64)
- func (h *FixedSumHistogram) AddLabelPrefix(labelPrefix string) Histogram
- func (h *FixedSumHistogram) Clear() []uint64
- func (h *FixedSumHistogram) IsSummed() bool
- func (h *FixedSumHistogram) SetLabels(labels []string) Histogram
- func (h *FixedSumHistogram) SetNameTotal(total string) Histogram
- type FixedSumUHistogram
- func (h *FixedSumUHistogram) Add(v uint64)
- func (h *FixedSumUHistogram) AddLabelPrefix(labelPrefix string) UHistogram
- func (h *FixedSumUHistogram) Clear() []uint64
- func (h *FixedSumUHistogram) IsSummed() bool
- func (h *FixedSumUHistogram) SetLabels(labels []string) UHistogram
- func (h *FixedSumUHistogram) SetNameTotal(total string) UHistogram
- type FunctionalFGauge
- type FunctionalGauge
- type FunctionalUGauge
- type Gauge
- func GetOrRegisterDiffer(name string, r Registry, d int64) Gauge
- func GetOrRegisterDifferT(name string, tagsMap map[string]string, r Registry, d int64) Gauge
- func GetOrRegisterGauge(name string, r Registry) Gauge
- func GetOrRegisterGaugeT(name string, tagsMap map[string]string, r Registry) Gauge
- func NewDiffer(d int64) Gauge
- func NewFunctionalGauge(f func() int64) Gauge
- func NewGauge() Gauge
- func NewRegisteredDiffer(name string, r Registry, d int64) Gauge
- func NewRegisteredDifferT(name string, tagsMap map[string]string, r Registry, d int64) Gauge
- func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge
- func NewRegisteredFunctionalGaugeT(name string, tagsMap map[string]string, r Registry, f func() int64) Gauge
- func NewRegisteredGauge(name string, r Registry) Gauge
- func NewRegisteredGaugeT(name string, tagsMap map[string]string, r Registry) Gauge
- type GaugeSnapshot
- type Healthcheck
- type Histogram
- func GetOrRegisterFixedHistogram(name string, r Registry, startVal, endVal, width int64) Histogram
- func GetOrRegisterFixedHistogramT(name string, tagsMap map[string]string, r Registry, ...) Histogram
- func GetOrRegisterFixedSumHistogram(name string, r Registry, startVal, endVal, width int64) Histogram
- func GetOrRegisterFixedSumHistogramT(name string, tagsMap map[string]string, r Registry, ...) Histogram
- func GetOrRegisterVHistogram(name string, r Registry, weights []int64, names []string) Histogram
- func GetOrRegisterVHistogramT(name string, tagsMap map[string]string, r Registry, weights []int64, ...) Histogram
- func GetOrRegisterVSumHistogram(name string, r Registry, weights []int64, names []string) Histogram
- func GetOrRegisterVSumHistogramT(name string, tagsMap map[string]string, r Registry, weights []int64, ...) Histogram
- func NewRegisteredFixedHistogram(name string, r Registry, startVal, endVal, width int64) Histogram
- func NewRegisteredFixedHistogramT(name string, tagsMap map[string]string, r Registry, ...) Histogram
- func NewRegisteredFixedSumHistogram(name string, r Registry, startVal, endVal, width int64) Histogram
- func NewRegisteredFixedSumHistogramT(name string, tagsMap map[string]string, r Registry, ...) Histogram
- func NewRegisteredVHistogram(name string, r Registry, weights []int64, names []string) Histogram
- func NewRegisteredVHistogramT(name string, tagsMap map[string]string, r Registry, weights []int64, ...) Histogram
- func NewRegisteredVSumHistogram(name string, r Registry, weights []int64, names []string) Histogram
- func NewRegisteredVSumHistogramT(name string, tagsMap map[string]string, r Registry, weights []int64, ...) Histogram
- type HistogramInterface
- type HistogramSnapshot
- func (h *HistogramSnapshot) Add(v int64)
- func (HistogramSnapshot) AddLabelPrefix(string) Histogram
- func (h *HistogramSnapshot) Clear() []uint64
- func (h *HistogramSnapshot) Interface() HistogramInterface
- func (HistogramSnapshot) IsSummed() bool
- func (h *HistogramSnapshot) Labels() []string
- func (h *HistogramSnapshot) NameTotal() string
- func (HistogramSnapshot) SetLabels([]string) Histogram
- func (HistogramSnapshot) SetNameTotal(string) Histogram
- func (h *HistogramSnapshot) Snapshot() Histogram
- func (h *HistogramSnapshot) Values() []uint64
- func (h *HistogramSnapshot) Weights() []int64
- func (h *HistogramSnapshot) WeightsAliases() []string
- type HistogramStorage
- func (h *HistogramStorage) AddLabelPrefix(labelPrefix string)
- func (h *HistogramStorage) Clear() []uint64
- func (h *HistogramStorage) Interface() HistogramInterface
- func (h *HistogramStorage) IsSummed() bool
- func (h *HistogramStorage) Labels() []string
- func (h *HistogramStorage) NameTotal() string
- func (h *HistogramStorage) SetLabels(labels []string)
- func (h *HistogramStorage) SetNameTotal(total string)
- func (h *HistogramStorage) Snapshot() Histogram
- func (h *HistogramStorage) Values() []uint64
- func (h *HistogramStorage) Weights() []int64
- func (h *HistogramStorage) WeightsAliases() []string
- type NameTagged
- type NilCounter
- type NilDownCounter
- type NilFGauge
- type NilFRate
- func (NilFRate) Clear() (float64, float64)
- func (NilFRate) Name() string
- func (NilFRate) RateName() string
- func (g NilFRate) SetName(string) FRate
- func (g NilFRate) SetRateName(string) FRate
- func (NilFRate) Snapshot() FRate
- func (NilFRate) Update(float64)
- func (NilFRate) UpdateTs(float64, int64)
- func (NilFRate) Values() (float64, float64)
- type NilGauge
- type NilHealthcheck
- type NilRate
- func (NilRate) Clear() (int64, float64)
- func (NilRate) Name() string
- func (NilRate) RateName() string
- func (g NilRate) SetName(string) Rate
- func (g NilRate) SetRateName(string) Rate
- func (NilRate) Snapshot() Rate
- func (NilRate) Update(int64)
- func (NilRate) UpdateTs(int64, int64)
- func (NilRate) Values() (int64, float64)
- type NilUGauge
- type Rate
- type RateNames
- type RateSnapshot
- func (RateSnapshot) Clear() (int64, float64)
- func (g *RateSnapshot) Name() string
- func (g *RateSnapshot) RateName() string
- func (RateSnapshot) SetName(string) Rate
- func (RateSnapshot) SetRateName(string) Rate
- func (g *RateSnapshot) Snapshot() Rate
- func (RateSnapshot) Update(int64)
- func (RateSnapshot) UpdateTs(int64, int64)
- func (g *RateSnapshot) Values() (int64, float64)
- type Registry
- type StandardCounter
- type StandardDiffer
- type StandardDownCounter
- type StandardFGauge
- type StandardFRate
- func (g *StandardFRate) Clear() (float64, float64)
- func (g *StandardFRate) Name() string
- func (g *StandardFRate) RateName() string
- func (g *StandardFRate) SetName(name string) FRate
- func (g *StandardFRate) SetRateName(rateName string) FRate
- func (g *StandardFRate) Snapshot() FRate
- func (g *StandardFRate) Update(v float64)
- func (g *StandardFRate) UpdateTs(v float64, ts int64)
- func (g *StandardFRate) Values() (float64, float64)
- type StandardGauge
- type StandardHealthcheck
- type StandardRate
- func (g *StandardRate) Clear() (int64, float64)
- func (g *StandardRate) Name() string
- func (g *StandardRate) RateName() string
- func (g *StandardRate) SetName(name string) Rate
- func (g *StandardRate) SetRateName(rateName string) Rate
- func (g *StandardRate) Snapshot() Rate
- func (g *StandardRate) Update(v int64)
- func (g *StandardRate) UpdateTs(v int64, ts int64)
- func (g *StandardRate) Values() (int64, float64)
- type StandardRegistry
- func (r *StandardRegistry) Each(f func(string, string, map[string]string, interface{}) error, minLock bool) error
- func (r *StandardRegistry) Get(name string) interface{}
- func (r *StandardRegistry) GetAll() map[string]map[string]interface{}
- func (r *StandardRegistry) GetOrRegister(name string, i interface{}) interface{}
- func (r *StandardRegistry) GetOrRegisterT(name string, tagsMap map[string]string, i interface{}) interface{}
- func (r *StandardRegistry) GetT(name string, tagsMap map[string]string) interface{}
- func (r *StandardRegistry) Register(name string, i interface{}) error
- func (r *StandardRegistry) RegisterT(name string, tagsMap map[string]string, i interface{}) error
- func (r *StandardRegistry) RunHealthchecks()
- func (r *StandardRegistry) Unregister(name string)
- func (r *StandardRegistry) UnregisterAll()
- func (r *StandardRegistry) UnregisterT(name string, tagsMap map[string]string)
- type StandardUGauge
- type SumHistogramSnapshot
- func (h *SumHistogramSnapshot) Add(v int64)
- func (SumHistogramSnapshot) AddLabelPrefix(string) Histogram
- func (h *SumHistogramSnapshot) Clear() []uint64
- func (h *SumHistogramSnapshot) Interface() HistogramInterface
- func (SumHistogramSnapshot) IsSummed() bool
- func (h *SumHistogramSnapshot) Labels() []string
- func (h *SumHistogramSnapshot) NameTotal() string
- func (SumHistogramSnapshot) SetLabels([]string) Histogram
- func (SumHistogramSnapshot) SetNameTotal(string) Histogram
- func (h *SumHistogramSnapshot) Snapshot() Histogram
- func (h *SumHistogramSnapshot) Values() []uint64
- func (h *SumHistogramSnapshot) Weights() []int64
- func (h *SumHistogramSnapshot) WeightsAliases() []string
- type SumUHistogramSnapshot
- func (h *SumUHistogramSnapshot) Add(v uint64)
- func (SumUHistogramSnapshot) AddLabelPrefix(string) UHistogram
- func (h *SumUHistogramSnapshot) Clear() []uint64
- func (h *SumUHistogramSnapshot) Interface() HistogramInterface
- func (SumUHistogramSnapshot) IsSummed() bool
- func (h *SumUHistogramSnapshot) Labels() []string
- func (h *SumUHistogramSnapshot) NameTotal() string
- func (SumUHistogramSnapshot) SetLabels([]string) UHistogram
- func (SumUHistogramSnapshot) SetNameTotal(string) UHistogram
- func (h *SumUHistogramSnapshot) Snapshot() UHistogram
- func (h *SumUHistogramSnapshot) Values() []uint64
- func (h *SumUHistogramSnapshot) Weights() []uint64
- func (h *SumUHistogramSnapshot) WeightsAliases() []string
- type UFixedHistogram
- type UGauge
- func GetOrRegisterUGauge(name string, r Registry) UGauge
- func GetOrRegisterUGaugeT(name string, tagsMap map[string]string, r Registry) UGauge
- func NewFunctionalUGauge(f func() uint64) UGauge
- func NewRegisteredFunctionalUGauge(name string, r Registry, f func() uint64) UGauge
- func NewRegisteredFunctionalUGaugeT(name string, tagsMap map[string]string, r Registry, f func() uint64) UGauge
- func NewRegisteredUGauge(name string, r Registry) UGauge
- func NewRegisteredUGaugeT(name string, tagsMap map[string]string, r Registry) UGauge
- func NewUGauge() UGauge
- type UGaugeSnapshot
- type UHistogram
- func GetOrRegisterFixedSumUHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
- func GetOrRegisterFixedSumUHistogramT(name string, tagsMap map[string]string, r Registry, ...) UHistogram
- func GetOrRegisterUFixedHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
- func GetOrRegisterUFixedHistogramT(name string, tagsMap map[string]string, r Registry, ...) UHistogram
- func GetOrRegisterUVHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
- func GetOrRegisterUVHistogramT(name string, tagsMap map[string]string, r Registry, weights []uint64, ...) UHistogram
- func GetOrRegisterVSumUHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
- func GetOrRegisterVSumUHistogramT(name string, tagsMap map[string]string, r Registry, weights []uint64, ...) UHistogram
- func NewRegisteredFixedSumUHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
- func NewRegisteredFixedSumUHistogramT(name string, tagsMap map[string]string, r Registry, ...) UHistogram
- func NewRegisteredUFixedHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
- func NewRegisteredUFixedHistogramT(name string, tagsMap map[string]string, r Registry, ...) UHistogram
- func NewRegisteredUVHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
- func NewRegisteredUVHistogramT(name string, tagsMap map[string]string, r Registry, weights []uint64, ...) UHistogram
- func NewRegisteredVSumUHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
- func NewRegisteredVSumUHistogramT(name string, tagsMap map[string]string, r Registry, weights []uint64, ...) UHistogram
- type UHistogramSnapshot
- func (h *UHistogramSnapshot) Add(v uint64)
- func (UHistogramSnapshot) AddLabelPrefix(string) UHistogram
- func (h *UHistogramSnapshot) Clear() []uint64
- func (h *UHistogramSnapshot) Interface() HistogramInterface
- func (h *UHistogramSnapshot) IsSummed() bool
- func (h *UHistogramSnapshot) Labels() []string
- func (h *UHistogramSnapshot) NameTotal() string
- func (UHistogramSnapshot) SetLabels([]string) UHistogram
- func (UHistogramSnapshot) SetNameTotal(string) UHistogram
- func (h *UHistogramSnapshot) Snapshot() UHistogram
- func (h *UHistogramSnapshot) Values() []uint64
- func (h *UHistogramSnapshot) Weights() []uint64
- func (h *UHistogramSnapshot) WeightsAliases() []string
- type UHistogramStorage
- func (h *UHistogramStorage) AddLabelPrefix(labelPrefix string)
- func (h *UHistogramStorage) Clear() []uint64
- func (h *UHistogramStorage) Interface() HistogramInterface
- func (h *UHistogramStorage) IsSummed() bool
- func (h *UHistogramStorage) Labels() []string
- func (h *UHistogramStorage) NameTotal() string
- func (h *UHistogramStorage) SetLabels(labels []string)
- func (h *UHistogramStorage) SetNameTotal(total string)
- func (h *UHistogramStorage) Snapshot() UHistogram
- func (h *UHistogramStorage) Values() []uint64
- func (h *UHistogramStorage) Weights() []uint64
- func (h *UHistogramStorage) WeightsAliases() []string
- type UVHistogram
- func (h *UVHistogram) Add(v uint64)
- func (h *UVHistogram) AddLabelPrefix(labelPrefix string) UHistogram
- func (h *UVHistogram) SetLabels(labels []string) UHistogram
- func (h *UVHistogram) SetNameTotal(total string) UHistogram
- func (h *UVHistogram) Snapshot() UHistogram
- func (h *UVHistogram) Values() []uint64
- type Updated
- type VHistogram
- func (h *VHistogram) Add(v int64)
- func (h *VHistogram) AddLabelPrefix(labelPrefix string) Histogram
- func (h *VHistogram) Interface() HistogramInterface
- func (h *VHistogram) SetLabels(labels []string) Histogram
- func (h *VHistogram) SetNameTotal(total string) Histogram
- func (h *VHistogram) Snapshot() Histogram
- func (h *VHistogram) Values() []uint64
- func (h *VHistogram) WeightsAliases() []string
- type VSumHistogram
- func (h *VSumHistogram) Add(v int64)
- func (h *VSumHistogram) AddLabelPrefix(labelPrefix string) Histogram
- func (h *VSumHistogram) Interface() HistogramInterface
- func (h *VSumHistogram) IsSummed() bool
- func (h *VSumHistogram) SetLabels(labels []string) Histogram
- func (h *VSumHistogram) SetNameTotal(total string) Histogram
- func (h *VSumHistogram) Snapshot() Histogram
- func (h *VSumHistogram) Values() []uint64
- func (h *VSumHistogram) WeightsAliases() []string
- type VSumUHistogram
- func (h *VSumUHistogram) Add(v uint64)
- func (h *VSumUHistogram) AddLabelPrefix(labelPrefix string) UHistogram
- func (h *VSumUHistogram) Interface() HistogramInterface
- func (h *VSumUHistogram) IsSummed() bool
- func (h *VSumUHistogram) SetLabels(labels []string) UHistogram
- func (h *VSumUHistogram) SetNameTotal(total string) UHistogram
- func (h *VSumUHistogram) Snapshot() UHistogram
- func (h *VSumUHistogram) Values() []uint64
- func (h *VSumUHistogram) WeightsAliases() []string
- type ValTagged
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( RuntimeNames struct { MemStats struct { Alloc string BuckHashSys string Frees string HeapAlloc string HeapIdle string HeapInUse string HeapObjects string HeapReleased string HeapSys string LastGC string Lookups string Mallocs string MCacheInUse string MCacheSys string MSpanInuse string MSpanSys string NextGC string NumGC string GCCPUFraction string // PauseNs Histogram PauseTotalNs string StackInUse string StackSys string Sys string TotalAlloc string } NumCgoCall string NumGoroutine string NumThread string } )
var UseNilMetrics bool = false
UseNilMetrics is checked by the constructor functions for all of the standard metrics. If it is true, the metric returned is a stub.
This global kill-switch helps quantify the observer effect and makes for less cluttered pprof profiles.
Functions ¶
func CaptureRuntimeMemStats ¶
Capture new values for the Go runtime statistics exported in runtime.MemStats. This is designed to be called as a goroutine.
func CaptureRuntimeMemStatsOnce ¶
func CaptureRuntimeMemStatsOnce()
Capture new values for the Go runtime statistics exported in runtime.MemStats. This is designed to be called in a background goroutine. Giving a registry which has not been given to RegisterRuntimeMemStats will panic.
Be very careful with this because runtime.ReadMemStats calls the C functions runtime·semacquire(&runtime·worldsema) and runtime·stoptheworld() and that last one does what it says on the tin.
func Each ¶
func Each(f func(name, tags string, tagsMap map[string]string, i interface{}) error, minLock bool) error
Call the given function for each registered metric.
func Get ¶
func Get(name string) interface{}
Get the metric by the given name or nil if none is registered.
func GetOrRegister ¶
func GetOrRegister(name string, i interface{}) interface{}
Gets an existing metric or creates and registers a new one. Threadsafe alternative to calling Get and Register on failure.
func GetOrRegisterT ¶
Gets an existing metric or creates and registers a new one. Threadsafe alternative to calling Get and Register on failure.
func JoinTags ¶
JoinTags convert tags map sorted tags string representation (separated by comma), like tags or Graphite
func MustRegister ¶
func MustRegister(name string, i interface{})
Register the given metric under the given name. Panics if a metric by the given name is already registered.
func MustRegisterT ¶
Register the given metric under the given name. Panics if a metric by the given name is already registered.
func Register ¶
Register the given metric under the given name. Returns a DuplicateMetric if a metric by the given name is already registered.
func RegisterRuntimeMemStats ¶
func RegisterRuntimeMemStats(r Registry)
Register runtimeMetrics for the Go runtime statistics exported in runtime and specifically runtime.MemStats. The runtimeMetrics are named by their fully-qualified Go symbols, i.e. runtime.MemStats.Alloc.
func RegisterT ¶
Register the given metric under the given name. Returns a DuplicateMetric if a metric by the given name is already registered.
func UnregisterT ¶
Unregister the metric with the given name.
Types ¶
type Counter ¶
Counters hold an uint64 value that can be incremented only
Graphite naming scheme
Plain: {PREFIX}.{NAME}
Tagged: {TAG_PREFIX}.{NAME}
func GetOrRegisterCounter ¶
GetOrRegisterCounter returns an existing Counter or constructs and registers a new StandardCounter.
func GetOrRegisterCounterT ¶
GetOrRegisterCounterT returns an existing Counter or constructs and registers a new StandardCounter.
func NewRegisteredCounter ¶
NewRegisteredCounter constructs and registers a new StandardCounter.
type CounterSnapshot ¶
type CounterSnapshot uint64
CounterSnapshot is a read-only copy of another Counter.
func (CounterSnapshot) Count ¶
func (c CounterSnapshot) Count() uint64
Count returns the count at the time the snapshot was taken.
func (CounterSnapshot) Snapshot ¶
func (c CounterSnapshot) Snapshot() Counter
Snapshot returns the snapshot.
type DownCounter ¶
type DownCounter interface { Clear() int64 Count() int64 Inc(int64) Dec(int64) Snapshot() DownCounter }
DownCounters hold an int64 value that can be incremented/decremented
func GetOrRegisterDownCounter ¶
func GetOrRegisterDownCounter(name string, r Registry) DownCounter
GetOrRegisterDownCounter returns an existing DownCounter or constructs and registers a new StandardDownCounter.
func GetOrRegisterDownCounterT ¶
func GetOrRegisterDownCounterT(name string, tagsMap map[string]string, r Registry) DownCounter
GetOrRegisterDownCounterT returns an existing DownCounter or constructs and registers a new StandardDownCounter.
func NewDownCounter ¶
func NewDownCounter() DownCounter
NewDownCounter constructs a new StandardDownCounter.
func NewRegisteredDownCounter ¶
func NewRegisteredDownCounter(name string, r Registry) DownCounter
NewRegisteredDownCounter constructs and registers a new StandardDownCounter.
func NewRegisteredDownCounterT ¶
func NewRegisteredDownCounterT(name string, tagsMap map[string]string, r Registry) DownCounter
NewRegisteredDownCounterT constructs and registers a new StandardDownCounter.
type DownCounterSnapshot ¶
type DownCounterSnapshot uint64
DownCounterSnapshot is a read-only copy of another DownCounter.
func (DownCounterSnapshot) Count ¶
func (c DownCounterSnapshot) Count() int64
Count returns the count at the time the snapshot was taken.
func (DownCounterSnapshot) Snapshot ¶
func (c DownCounterSnapshot) Snapshot() DownCounter
Snapshot returns the snapshot.
type DuplicateMetric ¶
type DuplicateMetric string
DuplicateMetric is the error returned by Registry.Register when a metric already exists. If you mean to Register that metric you must first Unregister the existing metric.
func (DuplicateMetric) Error ¶
func (err DuplicateMetric) Error() string
type FFixedHistogram ¶
type FFixedHistogram struct { FHistogramStorage // contains filtered or unexported fields }
A FFixedHistogram is implementation of FHistogram with fixed-size buckets.
func (*FFixedHistogram) Add ¶
func (h *FFixedHistogram) Add(v float64)
func (*FFixedHistogram) AddLabelPrefix ¶
func (h *FFixedHistogram) AddLabelPrefix(labelPrefix string) FHistogram
func (*FFixedHistogram) SetLabels ¶
func (h *FFixedHistogram) SetLabels(labels []string) FHistogram
func (*FFixedHistogram) SetNameTotal ¶
func (h *FFixedHistogram) SetNameTotal(total string) FHistogram
type FGauge ¶ added in v0.0.7
FGauges hold a float64 value that can be set arbitrarily.
Plain: {PREFIX}.{NAME}
Tagged: {TAG_PREFIX}.{NAME}
func GetOrRegisterFGauge ¶ added in v0.0.7
GetOrRegisterFGauge returns an existing FGauge or constructs and registers a new StandardFGauge.
func GetOrRegisterFGaugeT ¶ added in v0.0.7
GetOrRegisterFGaugeT returns an existing FGauge or constructs and registers a new StandardFGauge.
func NewFunctionalFGauge ¶ added in v0.0.7
NewFunctionalGauge constructs a new FunctionalGauge.
func NewRegisteredFGauge ¶ added in v0.0.7
NewRegisteredFGauge constructs and registers a new StandardFGauge.
func NewRegisteredFGaugeT ¶ added in v0.0.7
NewRegisteredFGaugeT constructs and registers a new StandardFGauge.
func NewRegisteredFunctionalFGauge ¶ added in v0.0.7
NewRegisteredFunctionalGauge constructs and registers a new StandardGauge.
type FGaugeSnapshot ¶ added in v0.0.7
type FGaugeSnapshot float64
FGaugeSnapshot is a read-only copy of another FGauge.
func (FGaugeSnapshot) Snapshot ¶ added in v0.0.7
func (g FGaugeSnapshot) Snapshot() FGauge
Snapshot returns the snapshot.
func (FGaugeSnapshot) Value ¶ added in v0.0.7
func (g FGaugeSnapshot) Value() float64
Value returns the value at the time the snapshot was taken.
type FHistogram ¶
type FHistogram interface { HistogramInterface SetLabels([]string) FHistogram AddLabelPrefix(string) FHistogram SetNameTotal(string) FHistogram Snapshot() FHistogram Add(v float64) Weights() []float64 }
A FHistogram is a lossy data structure used to record the distribution of non-normally distributed data (like latency) with a high degree of accuracy and a bounded degree of precision.
func GetOrRegisterFFixedHistogram ¶
func GetOrRegisterFFixedHistogram(name string, r Registry, startVal, endVal, width float64) FHistogram
GetOrRegisterFHistogram returns an existing FHistogram or constructs and registers a new FFixedHistorgam.
func GetOrRegisterFFixedHistogramT ¶
func GetOrRegisterFFixedHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width float64) FHistogram
GetOrRegisterHistogramT returns an existing Histogram or constructs and registers a new FixedHistorgam.
func GetOrRegisterFVHistogram ¶
func GetOrRegisterFVHistogram(name string, r Registry, weights []float64, names []string) FHistogram
func NewFFixedHistogram ¶
func NewFFixedHistogram(startVal, endVal, width float64) FHistogram
func NewRegisteredFFixedHistogram ¶
func NewRegisteredFFixedHistogram(name string, r Registry, startVal, endVal, width float64) FHistogram
NewRegisteredFixedHistogram constructs and registers a new FixedHistogram.
func NewRegisteredFFixedHistogramT ¶
func NewRegisteredFFixedHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width float64) FHistogram
NewRegisteredFixedHistogramT constructs and registers a new FixedHistogram.
func NewRegisteredFVHistogram ¶
func NewRegisteredFVHistogram(name string, r Registry, weights []float64, names []string) FHistogram
NewRegisteredVHistogram constructs and registers a new VHistogram.
func NewRegisteredFVHistogramT ¶
func NewRegisteredFVHistogramT(name string, tagsMap map[string]string, r Registry, weights []float64, names []string) FHistogram
NewRegisteredVHistogramT constructs and registers a new VHistogram.
type FHistogramSnapshot ¶
type FHistogramSnapshot struct {
// contains filtered or unexported fields
}
func (*FHistogramSnapshot) Add ¶
func (h *FHistogramSnapshot) Add(v float64)
func (FHistogramSnapshot) AddLabelPrefix ¶
func (FHistogramSnapshot) AddLabelPrefix(string) FHistogram
func (*FHistogramSnapshot) Clear ¶
func (h *FHistogramSnapshot) Clear() []uint64
func (*FHistogramSnapshot) Interface ¶
func (h *FHistogramSnapshot) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*FHistogramSnapshot) IsSummed ¶ added in v0.0.4
func (h *FHistogramSnapshot) IsSummed() bool
func (*FHistogramSnapshot) Labels ¶
func (h *FHistogramSnapshot) Labels() []string
func (*FHistogramSnapshot) NameTotal ¶
func (h *FHistogramSnapshot) NameTotal() string
func (FHistogramSnapshot) SetLabels ¶
func (FHistogramSnapshot) SetLabels([]string) FHistogram
func (FHistogramSnapshot) SetNameTotal ¶
func (FHistogramSnapshot) SetNameTotal(string) FHistogram
func (*FHistogramSnapshot) Snapshot ¶
func (h *FHistogramSnapshot) Snapshot() FHistogram
func (*FHistogramSnapshot) Values ¶
func (h *FHistogramSnapshot) Values() []uint64
func (*FHistogramSnapshot) Weights ¶
func (h *FHistogramSnapshot) Weights() []float64
func (*FHistogramSnapshot) WeightsAliases ¶
func (h *FHistogramSnapshot) WeightsAliases() []string
type FHistogramStorage ¶
type FHistogramStorage struct {
// contains filtered or unexported fields
}
func (*FHistogramStorage) AddLabelPrefix ¶
func (h *FHistogramStorage) AddLabelPrefix(labelPrefix string)
func (*FHistogramStorage) Clear ¶
func (h *FHistogramStorage) Clear() []uint64
func (*FHistogramStorage) Interface ¶
func (h *FHistogramStorage) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*FHistogramStorage) IsSummed ¶ added in v0.0.4
func (h *FHistogramStorage) IsSummed() bool
func (*FHistogramStorage) Labels ¶
func (h *FHistogramStorage) Labels() []string
func (*FHistogramStorage) NameTotal ¶
func (h *FHistogramStorage) NameTotal() string
func (*FHistogramStorage) SetLabels ¶
func (h *FHistogramStorage) SetLabels(labels []string)
func (*FHistogramStorage) SetNameTotal ¶
func (h *FHistogramStorage) SetNameTotal(total string)
func (*FHistogramStorage) Snapshot ¶
func (h *FHistogramStorage) Snapshot() FHistogram
func (*FHistogramStorage) Values ¶
func (h *FHistogramStorage) Values() []uint64
func (*FHistogramStorage) Weights ¶
func (h *FHistogramStorage) Weights() []float64
func (*FHistogramStorage) WeightsAliases ¶
func (h *FHistogramStorage) WeightsAliases() []string
type FRate ¶
type FRate interface { FRateNames Snapshot() FRate Clear() (float64, float64) Update(v float64) UpdateTs(v float64, timestamp_ns int64) Values() (float64, float64) }
FRate hold an int64 value and timestamp (current and previous) and return diff and diff/s.
func GetOrRegisterFRate ¶
GetOrRegisterFRate returns an existing FRate or constructs and registers a new StandardFRate.
Example ¶
m := "server.memory_used" r := NewRegistry() g := GetOrRegisterFRate(m, r) g.UpdateTs(1.1, 1e9) g.UpdateTs(7.1, 3e9) fmt.Println(g.Values())
Output: 7.1 3
func GetOrRegisterFRateT ¶
GetOrRegisterFRateT returns an existing FRate or constructs and registers a new StandardFRate.
func NewRegisteredFRate ¶
NewRegisteredFRate constructs and registers a new StandardFRate.
type FRateNames ¶
type FRateSnapshot ¶
type FRateSnapshot struct { FRate float64 // contains filtered or unexported fields }
FRateSnapshot is a read-only copy of another FRate.
func (*FRateSnapshot) Name ¶
func (g *FRateSnapshot) Name() string
func (*FRateSnapshot) RateName ¶
func (g *FRateSnapshot) RateName() string
func (FRateSnapshot) SetName ¶
func (FRateSnapshot) SetName(string) FRate
func (FRateSnapshot) SetRateName ¶
func (FRateSnapshot) SetRateName(string) FRate
func (*FRateSnapshot) Snapshot ¶
func (g *FRateSnapshot) Snapshot() FRate
Snapshot returns the snapshot.
func (*FRateSnapshot) Values ¶
func (g *FRateSnapshot) Values() (float64, float64)
Value returns the value at the time the snapshot was taken.
type FVHistogram ¶
type FVHistogram struct {
FHistogramStorage
}
A FVHistogram is implementation of FHistogram with varibale-size buckets.
func NewFVHistogram ¶
func NewFVHistogram(weights []float64, names []string) *FVHistogram
func (*FVHistogram) Add ¶
func (h *FVHistogram) Add(v float64)
func (*FVHistogram) AddLabelPrefix ¶
func (h *FVHistogram) AddLabelPrefix(labelPrefix string) FHistogram
func (*FVHistogram) SetLabels ¶
func (h *FVHistogram) SetLabels(labels []string) FHistogram
func (*FVHistogram) SetNameTotal ¶
func (h *FVHistogram) SetNameTotal(total string) FHistogram
func (*FVHistogram) Snapshot ¶
func (h *FVHistogram) Snapshot() FHistogram
func (*FVHistogram) Values ¶
func (h *FVHistogram) Values() []uint64
type FixedHistogram ¶
type FixedHistogram struct { HistogramStorage // contains filtered or unexported fields }
A FixedHistogram is implementation of Histogram with fixed-size buckets.
func NewFixedHistogram ¶
func NewFixedHistogram(startVal, endVal, width int64) *FixedHistogram
func (*FixedHistogram) Add ¶
func (h *FixedHistogram) Add(v int64)
func (*FixedHistogram) AddLabelPrefix ¶
func (h *FixedHistogram) AddLabelPrefix(labelPrefix string) Histogram
func (*FixedHistogram) SetLabels ¶
func (h *FixedHistogram) SetLabels(labels []string) Histogram
func (*FixedHistogram) SetNameTotal ¶
func (h *FixedHistogram) SetNameTotal(total string) Histogram
type FixedSumHistogram ¶ added in v0.0.4
type FixedSumHistogram struct { HistogramStorage // contains filtered or unexported fields }
A FixedSumHistogram is implementation of prometheus-like Histogram with fixed-size buckets.
func NewFixedSumHistogram ¶ added in v0.0.4
func NewFixedSumHistogram(startVal, endVal, width int64) *FixedSumHistogram
func (*FixedSumHistogram) Add ¶ added in v0.0.4
func (h *FixedSumHistogram) Add(v int64)
func (*FixedSumHistogram) AddLabelPrefix ¶ added in v0.0.4
func (h *FixedSumHistogram) AddLabelPrefix(labelPrefix string) Histogram
func (*FixedSumHistogram) Clear ¶ added in v0.0.4
func (h *FixedSumHistogram) Clear() []uint64
func (*FixedSumHistogram) IsSummed ¶ added in v0.0.4
func (h *FixedSumHistogram) IsSummed() bool
func (*FixedSumHistogram) SetLabels ¶ added in v0.0.4
func (h *FixedSumHistogram) SetLabels(labels []string) Histogram
func (*FixedSumHistogram) SetNameTotal ¶ added in v0.0.4
func (h *FixedSumHistogram) SetNameTotal(total string) Histogram
type FixedSumUHistogram ¶ added in v0.0.8
type FixedSumUHistogram struct { UHistogramStorage // contains filtered or unexported fields }
A FixedSumUHistogram is implementation of prometheus-like UHistogram with fixed-size buckets.
func NewFixedSumUHistogram ¶ added in v0.0.8
func NewFixedSumUHistogram(startVal, endVal, width uint64) *FixedSumUHistogram
func (*FixedSumUHistogram) Add ¶ added in v0.0.8
func (h *FixedSumUHistogram) Add(v uint64)
func (*FixedSumUHistogram) AddLabelPrefix ¶ added in v0.0.8
func (h *FixedSumUHistogram) AddLabelPrefix(labelPrefix string) UHistogram
func (*FixedSumUHistogram) Clear ¶ added in v0.0.8
func (h *FixedSumUHistogram) Clear() []uint64
func (*FixedSumUHistogram) IsSummed ¶ added in v0.0.8
func (h *FixedSumUHistogram) IsSummed() bool
func (*FixedSumUHistogram) SetLabels ¶ added in v0.0.8
func (h *FixedSumUHistogram) SetLabels(labels []string) UHistogram
func (*FixedSumUHistogram) SetNameTotal ¶ added in v0.0.8
func (h *FixedSumUHistogram) SetNameTotal(total string) UHistogram
type FunctionalFGauge ¶ added in v0.0.7
type FunctionalFGauge struct {
// contains filtered or unexported fields
}
FunctionalFGauge returns value from given function
func (FunctionalFGauge) Snapshot ¶ added in v0.0.7
func (g FunctionalFGauge) Snapshot() FGauge
Snapshot returns the snapshot.
func (FunctionalFGauge) Update ¶ added in v0.0.7
func (FunctionalFGauge) Update(float64)
Update panics.
func (FunctionalFGauge) Value ¶ added in v0.0.7
func (g FunctionalFGauge) Value() float64
Value returns the gauge's current value.
type FunctionalGauge ¶
type FunctionalGauge struct {
// contains filtered or unexported fields
}
FunctionalGauge returns value from given function
func (FunctionalGauge) Snapshot ¶
func (g FunctionalGauge) Snapshot() Gauge
Snapshot returns the snapshot.
func (FunctionalGauge) Value ¶
func (g FunctionalGauge) Value() int64
Value returns the gauge's current value.
type FunctionalUGauge ¶ added in v0.0.7
type FunctionalUGauge struct {
// contains filtered or unexported fields
}
FunctionalUGauge returns value from given function
func (FunctionalUGauge) Clear ¶ added in v0.0.7
func (g FunctionalUGauge) Clear() uint64
Clear panics.
func (FunctionalUGauge) Snapshot ¶ added in v0.0.7
func (g FunctionalUGauge) Snapshot() UGauge
Snapshot returns the snapshot.
func (FunctionalUGauge) Update ¶ added in v0.0.7
func (FunctionalUGauge) Update(uint64)
Update panics.
func (FunctionalUGauge) Value ¶ added in v0.0.7
func (g FunctionalUGauge) Value() uint64
Value returns the gauge's current value.
type Gauge ¶
Gauges hold an int64 value that can be set arbitrarily.
Graphite naming scheme
Plain: {PREFIX}.{NAME}
Tagged: {TAG_PREFIX}.{NAME}
func GetOrRegisterDiffer ¶
GetOrRegisterDiffer returns an existing Differ or constructs and registers a new StandardDiffer.
Example ¶
m := "server.memory_used" init := int64(1) g := GetOrRegisterDiffer(m, NewRegistry(), init) g.Update(47) fmt.Println(g.Value())
Output: 46
func GetOrRegisterDifferT ¶
GetOrRegisterDifferT returns an existing Differ or constructs and registers a new StandardDiffer.
func GetOrRegisterGauge ¶
GetOrRegisterGauge returns an existing Gauge or constructs and registers a new StandardGauge.
Example ¶
m := "server.bytes_sent" g := GetOrRegisterGauge(m, NewRegistry()) g.Update(47) fmt.Println(g.Value())
Output: 47
func GetOrRegisterGaugeT ¶
GetOrRegisterGaugeT returns an existing Gauge or constructs and registers a new StandardGauge.
func NewFunctionalGauge ¶
NewFunctionalGauge constructs a new FunctionalGauge.
func NewRegisteredDiffer ¶
NewRegisteredDiffer constructs and registers a new StandardDiffer.
func NewRegisteredDifferT ¶
NewRegisteredDifferT constructs and registers a new StandardDiffer.
func NewRegisteredFunctionalGauge ¶
NewRegisteredFunctionalGauge constructs and registers a new StandardGauge.
func NewRegisteredFunctionalGaugeT ¶
func NewRegisteredFunctionalGaugeT(name string, tagsMap map[string]string, r Registry, f func() int64) Gauge
NewRegisteredFunctionalGaugeT constructs and registers a new StandardGauge.
func NewRegisteredGauge ¶
NewRegisteredGauge constructs and registers a new StandardGauge.
type GaugeSnapshot ¶
type GaugeSnapshot int64
GaugeSnapshot is a read-only copy of another Gauge.
func (GaugeSnapshot) Snapshot ¶
func (g GaugeSnapshot) Snapshot() Gauge
Snapshot returns the snapshot.
func (GaugeSnapshot) Value ¶
func (g GaugeSnapshot) Value() int64
Value returns the value at the time the snapshot was taken.
type Healthcheck ¶
Healthchecks hold an error value describing an arbitrary up/down status.
func NewHealthcheck ¶
func NewHealthcheck(f func(bool) bool) Healthcheck
NewHealthcheck constructs a new Healthcheck which will use the given function to update its status.
type Histogram ¶
type Histogram interface { HistogramInterface SetLabels([]string) Histogram AddLabelPrefix(string) Histogram SetNameTotal(string) Histogram Snapshot() Histogram Add(v int64) Weights() []int64 }
A Histogram is a lossy data structure used to record the distribution of non-normally distributed data (like latency) with a high degree of accuracy and a bounded degree of precision.
func GetOrRegisterFixedHistogram ¶
GetOrRegisterHistogram returns an existing Histogram or constructs and registers a new FixedHistorgam.
func GetOrRegisterFixedHistogramT ¶
func GetOrRegisterFixedHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width int64) Histogram
GetOrRegisterHistogramT returns an existing Histogram or constructs and registers a new FixedHistorgam.
func GetOrRegisterFixedSumHistogram ¶ added in v0.0.4
func GetOrRegisterFixedSumHistogram(name string, r Registry, startVal, endVal, width int64) Histogram
GetOrRegisterHistogram returns an existing Histogram or constructs and registers a new FixedHistorgam (prometheus-like histogram).
func GetOrRegisterFixedSumHistogramT ¶ added in v0.0.4
func GetOrRegisterFixedSumHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width int64) Histogram
GetOrRegisterSumHistogramT returns an existing Histogram or constructs and registers a new FixedHistorgam (prometheus-like histogram).
func GetOrRegisterVHistogram ¶
func GetOrRegisterVSumHistogram ¶ added in v0.0.4
func GetOrRegisterVSumHistogramT ¶ added in v0.0.4
func NewRegisteredFixedHistogram ¶
NewRegisteredFixedHistogram constructs and registers a new FixedHistogram.
func NewRegisteredFixedHistogramT ¶
func NewRegisteredFixedHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width int64) Histogram
NewRegisteredFixedHistogramT constructs and registers a new FixedHistogram.
func NewRegisteredFixedSumHistogram ¶ added in v0.0.4
func NewRegisteredFixedSumHistogram(name string, r Registry, startVal, endVal, width int64) Histogram
NewRegisteredFixedSumHistogram constructs and registers a new FixedSumHistogram (prometheus-like histogram).
func NewRegisteredFixedSumHistogramT ¶ added in v0.0.4
func NewRegisteredFixedSumHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width int64) Histogram
NewRegisteredFixedSumHistogramT constructs and registers a new FixedSumHistogram (prometheus-like histogram).
func NewRegisteredVHistogram ¶
NewRegisteredVHistogram constructs and registers a new VHistogram.
func NewRegisteredVHistogramT ¶
func NewRegisteredVHistogramT(name string, tagsMap map[string]string, r Registry, weights []int64, names []string) Histogram
NewRegisteredVHistogramT constructs and registers a new VHistogram.
func NewRegisteredVSumHistogram ¶ added in v0.0.4
NewRegisteredVSumHistogram constructs and registers a new VSumHistogram (prometheus-like histogram).
type HistogramInterface ¶
type HistogramInterface interface { Clear() []uint64 Values() []uint64 Labels() []string NameTotal() string // Tag aliases values (for le key) WeightsAliases() []string // If true, is prometheus-like (cummulative, increment in bucket[1] also increment bucket[0]) IsSummed() bool }
A HistogramInterface is some strped (no Weights{}, it's not need in registry Each iterator) version of Histogram interface
Graphite naming scheme
Plain:
{PREFIX}.{NAME}{LABEL_BUCKET1}
{PREFIX}.{NAME}{LABEL_BUCKET2}
{PREFIX}.{NAME}{LABEL_BUCKET_INF}
{PREFIX}.{NAME}{TOTAL}
Tagged:
{TAG_PREFIX}.{NAME}{LABEL_BUCKET1};TAG=VAL;..;le=W1
{TAG_PREFIX}.{NAME}{LABEL_BUCKET2};TAG=VAL;..;le=W2
{TAG_PREFIX}.{NAME}{LABEL_BUCKET_INF};TAG=VAL;..;le=inf
{TAG_PREFIX}{NAME}{TOTAL};TAG=VAL;..
type HistogramSnapshot ¶
type HistogramSnapshot struct {
// contains filtered or unexported fields
}
func (*HistogramSnapshot) Add ¶
func (h *HistogramSnapshot) Add(v int64)
func (HistogramSnapshot) AddLabelPrefix ¶
func (HistogramSnapshot) AddLabelPrefix(string) Histogram
func (*HistogramSnapshot) Clear ¶
func (h *HistogramSnapshot) Clear() []uint64
func (*HistogramSnapshot) Interface ¶
func (h *HistogramSnapshot) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (HistogramSnapshot) IsSummed ¶ added in v0.0.4
func (HistogramSnapshot) IsSummed() bool
func (*HistogramSnapshot) Labels ¶
func (h *HistogramSnapshot) Labels() []string
func (*HistogramSnapshot) NameTotal ¶
func (h *HistogramSnapshot) NameTotal() string
func (HistogramSnapshot) SetLabels ¶
func (HistogramSnapshot) SetLabels([]string) Histogram
func (HistogramSnapshot) SetNameTotal ¶
func (HistogramSnapshot) SetNameTotal(string) Histogram
func (*HistogramSnapshot) Snapshot ¶
func (h *HistogramSnapshot) Snapshot() Histogram
func (*HistogramSnapshot) Values ¶
func (h *HistogramSnapshot) Values() []uint64
func (*HistogramSnapshot) Weights ¶
func (h *HistogramSnapshot) Weights() []int64
func (*HistogramSnapshot) WeightsAliases ¶
func (h *HistogramSnapshot) WeightsAliases() []string
type HistogramStorage ¶
type HistogramStorage struct {
// contains filtered or unexported fields
}
func (*HistogramStorage) AddLabelPrefix ¶
func (h *HistogramStorage) AddLabelPrefix(labelPrefix string)
func (*HistogramStorage) Clear ¶
func (h *HistogramStorage) Clear() []uint64
func (*HistogramStorage) Interface ¶
func (h *HistogramStorage) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*HistogramStorage) IsSummed ¶ added in v0.0.4
func (h *HistogramStorage) IsSummed() bool
func (*HistogramStorage) Labels ¶
func (h *HistogramStorage) Labels() []string
func (*HistogramStorage) NameTotal ¶
func (h *HistogramStorage) NameTotal() string
func (*HistogramStorage) SetLabels ¶
func (h *HistogramStorage) SetLabels(labels []string)
func (*HistogramStorage) SetNameTotal ¶
func (h *HistogramStorage) SetNameTotal(total string)
func (*HistogramStorage) Snapshot ¶
func (h *HistogramStorage) Snapshot() Histogram
func (*HistogramStorage) Values ¶
func (h *HistogramStorage) Values() []uint64
func (*HistogramStorage) Weights ¶
func (h *HistogramStorage) Weights() []int64
func (*HistogramStorage) WeightsAliases ¶
func (h *HistogramStorage) WeightsAliases() []string
type NameTagged ¶
type NilDownCounter ¶
type NilDownCounter struct{}
NilDownCounter is a no-op DownCounter.
func (NilDownCounter) Dec ¶
func (NilDownCounter) Dec(i int64)
type NilHealthcheck ¶
type NilHealthcheck struct{}
NilHealthcheck is a no-op.
func (NilHealthcheck) Status ¶
func (NilHealthcheck) Status() int32
type Rate ¶
type Rate interface { RateNames Snapshot() Rate Clear() (int64, float64) Update(v int64) UpdateTs(v int64, timestamp_ns int64) Values() (int64, float64) }
Rate hold an int64 value and timestamp (current and previous) and return diff and diff/s.
func GetOrRegisterRate ¶
GetOrRegisterRate returns an existing Rate or constructs and registers a new StandardRate.
Example ¶
m := "server.memory_used" r := NewRegistry() g := GetOrRegisterRate(m, r) g.UpdateTs(1, 1e9) g.UpdateTs(7, 3e9) fmt.Println(g.Values())
Output: 7 3
func GetOrRegisterRateT ¶
GetOrRegisterRateT returns an existing Rate or constructs and registers a new StandardRate.
func NewRegisteredRate ¶
NewRegisteredRate constructs and registers a new StandardRate.
type RateSnapshot ¶
type RateSnapshot struct {
// contains filtered or unexported fields
}
RateSnapshot is a read-only copy of another Rate.
func (*RateSnapshot) Name ¶
func (g *RateSnapshot) Name() string
func (*RateSnapshot) RateName ¶
func (g *RateSnapshot) RateName() string
func (RateSnapshot) SetName ¶
func (RateSnapshot) SetName(string) Rate
func (RateSnapshot) SetRateName ¶
func (RateSnapshot) SetRateName(string) Rate
func (*RateSnapshot) Snapshot ¶
func (g *RateSnapshot) Snapshot() Rate
Snapshot returns the snapshot.
func (*RateSnapshot) Values ¶
func (g *RateSnapshot) Values() (int64, float64)
Value returns the value at the time the snapshot was taken.
type Registry ¶
type Registry interface { // Call the given function for each registered metric. Each(f func(name string, tags string, tagsMap map[string]string, i interface{}) error, minLock bool) error // Get the metric by the given name or nil if none is registered. Get(name string) interface{} // Get the metric by the given name or nil if none is registered. GetT(name string, tagsMap map[string]string) interface{} // Get an existing metric or registers the given one. // The interface can be the metric to register if not found in registry, // or a function returning the metric for lazy instantiation. GetOrRegister(name string, i interface{}) interface{} // Get get an existing metric or registers the given one. // The interface can be the metric to register if not found in registry, // or a function returning the metric for lazy instantiation. GetOrRegisterT(name string, tagsMap map[string]string, i interface{}) interface{} // Register the given metric under the given name. Register(name string, i interface{}) error // Register the given metric under the given name. RegisterT(name string, tagsMap map[string]string, i interface{}) error // Run all registered healthchecks. RunHealthchecks() // Unregister the metric with the given name. Unregister(name string) // Unregister the metric with the given name. UnregisterT(name string, tagsMap map[string]string) // Unregister all metrics. (Mostly for testing.) UnregisterAll() }
A Registry holds references to a set of metrics by name and can iterate over them, calling callback functions provided by the user.
This is an interface so as to encourage other structs to implement the Registry API as appropriate.
var DefaultRegistry Registry = NewRegistry()
type StandardCounter ¶
type StandardCounter struct {
// contains filtered or unexported fields
}
StandardCounter is the standard implementation of a Counter and uses the sync/atomic package to manage a single uint64 value.
func (*StandardCounter) Clear ¶
func (c *StandardCounter) Clear() uint64
Clear sets the Counter to zero.
func (*StandardCounter) Count ¶
func (c *StandardCounter) Count() uint64
Count returns the current count.
func (*StandardCounter) Inc ¶
func (c *StandardCounter) Inc(i uint64)
Inc increments the Counter by the given amount.
func (*StandardCounter) Snapshot ¶
func (c *StandardCounter) Snapshot() Counter
Snapshot returns a read-only copy of the Counter.
type StandardDiffer ¶
type StandardDiffer struct {
// contains filtered or unexported fields
}
StandardDiffer is the standard implementation of a Differ and uses the sync/atomic package to manage a single int64 value.
func (*StandardDiffer) Clear ¶
func (g *StandardDiffer) Clear() int64
Clear sets the DownCounter to zero.
func (*StandardDiffer) Snapshot ¶
func (g *StandardDiffer) Snapshot() Gauge
Snapshot returns a read-only copy of the Differ.
func (*StandardDiffer) Update ¶
func (g *StandardDiffer) Update(v int64)
Update updates the Differ's value.
func (*StandardDiffer) Value ¶
func (g *StandardDiffer) Value() int64
Value returns the Differ's current value.
type StandardDownCounter ¶
type StandardDownCounter struct {
// contains filtered or unexported fields
}
StandardDownCounter is the standard implementation of a DownCounter and uses the sync/atomic package to manage a single uint64 value.
func (*StandardDownCounter) Clear ¶
func (c *StandardDownCounter) Clear() int64
Clear sets the DownCounter to zero.
func (*StandardDownCounter) Count ¶
func (c *StandardDownCounter) Count() int64
Count returns the current count.
func (*StandardDownCounter) Dec ¶
func (c *StandardDownCounter) Dec(i int64)
Dec decrements the DownCounter by the given amount.
func (*StandardDownCounter) Inc ¶
func (c *StandardDownCounter) Inc(i int64)
Inc increments the DownCounter by the given amount.
func (*StandardDownCounter) Snapshot ¶
func (c *StandardDownCounter) Snapshot() DownCounter
Snapshot returns a read-only copy of the DownCounter.
type StandardFGauge ¶ added in v0.0.7
type StandardFGauge struct {
// contains filtered or unexported fields
}
StandardFGauge is the standard implementation of a FGauge and uses sync.Mutex to manage a single float64 value.
func (*StandardFGauge) Snapshot ¶ added in v0.0.7
func (g *StandardFGauge) Snapshot() FGauge
Snapshot returns a read-only copy of the gauge.
func (*StandardFGauge) Update ¶ added in v0.0.7
func (g *StandardFGauge) Update(v float64)
Update updates the gauge's value.
func (*StandardFGauge) Value ¶ added in v0.0.7
func (g *StandardFGauge) Value() float64
Value returns the gauge's current value.
type StandardFRate ¶
type StandardFRate struct {
// contains filtered or unexported fields
}
StandardFRate is the standard implementation of a FRate and uses the sync/atomic package to manage a single int64 value.
func (*StandardFRate) Clear ¶
func (g *StandardFRate) Clear() (float64, float64)
Clear sets the DownCounter to zero.
func (*StandardFRate) Name ¶
func (g *StandardFRate) Name() string
func (*StandardFRate) RateName ¶
func (g *StandardFRate) RateName() string
func (*StandardFRate) SetName ¶
func (g *StandardFRate) SetName(name string) FRate
func (*StandardFRate) SetRateName ¶
func (g *StandardFRate) SetRateName(rateName string) FRate
func (*StandardFRate) Snapshot ¶
func (g *StandardFRate) Snapshot() FRate
Snapshot returns a read-only copy of the FRate.
func (*StandardFRate) Update ¶
func (g *StandardFRate) Update(v float64)
Update updates the FRate's value.
func (*StandardFRate) UpdateTs ¶
func (g *StandardFRate) UpdateTs(v float64, ts int64)
UpdateTs updates the FRate's value.
func (*StandardFRate) Values ¶
func (g *StandardFRate) Values() (float64, float64)
Value returns the FRate's current value.
type StandardGauge ¶
type StandardGauge struct {
// contains filtered or unexported fields
}
StandardGauge is the standard implementation of a Gauge and uses the sync/atomic package to manage a single int64 value.
func (*StandardGauge) Clear ¶
func (g *StandardGauge) Clear() int64
Clear sets the DownCounter to zero.
func (*StandardGauge) Snapshot ¶
func (g *StandardGauge) Snapshot() Gauge
Snapshot returns a read-only copy of the gauge.
func (*StandardGauge) Update ¶
func (g *StandardGauge) Update(v int64)
Update updates the gauge's value.
func (*StandardGauge) Value ¶
func (g *StandardGauge) Value() int64
Value returns the gauge's current value.
type StandardHealthcheck ¶
type StandardHealthcheck struct {
// contains filtered or unexported fields
}
StandardHealthcheck is the standard implementation of a Healthcheck and stores the status and a function to call to update the status.
func (*StandardHealthcheck) Check ¶
func (h *StandardHealthcheck) Check() int32
Check runs the healthcheck function to update the healthcheck's status.
func (*StandardHealthcheck) Healthy ¶
func (h *StandardHealthcheck) Healthy()
Healthy marks the healthcheck as healthy.
func (*StandardHealthcheck) IsUp ¶
func (h *StandardHealthcheck) IsUp() bool
IsUp returns the healthcheck's status
func (*StandardHealthcheck) Status ¶
func (h *StandardHealthcheck) Status() int32
Status returns the healthcheck's internal status value
func (*StandardHealthcheck) Unhealthy ¶
func (h *StandardHealthcheck) Unhealthy()
Unhealthy marks the healthcheck as unhealthy.
type StandardRate ¶
type StandardRate struct {
// contains filtered or unexported fields
}
StandardRate is the standard implementation of a Rate and uses the sync/atomic package to manage a single int64 value.
func (*StandardRate) Clear ¶
func (g *StandardRate) Clear() (int64, float64)
Clear sets the DownCounter to zero.
func (*StandardRate) Name ¶
func (g *StandardRate) Name() string
func (*StandardRate) RateName ¶
func (g *StandardRate) RateName() string
func (*StandardRate) SetName ¶
func (g *StandardRate) SetName(name string) Rate
func (*StandardRate) SetRateName ¶
func (g *StandardRate) SetRateName(rateName string) Rate
func (*StandardRate) Snapshot ¶
func (g *StandardRate) Snapshot() Rate
Snapshot returns a read-only copy of the Rate.
func (*StandardRate) Update ¶
func (g *StandardRate) Update(v int64)
Update updates the Rate's value.
func (*StandardRate) UpdateTs ¶
func (g *StandardRate) UpdateTs(v int64, ts int64)
UpdateTs updates the Rate's value.
func (*StandardRate) Values ¶
func (g *StandardRate) Values() (int64, float64)
Value returns the Rate's current value.
type StandardRegistry ¶
type StandardRegistry struct {
// contains filtered or unexported fields
}
The standard implementation of a Registry is a mutex-protected map of names to metrics.
func (*StandardRegistry) Get ¶
func (r *StandardRegistry) Get(name string) interface{}
Get the metric by the given name or nil if none is registered.
func (*StandardRegistry) GetAll ¶
func (r *StandardRegistry) GetAll() map[string]map[string]interface{}
GetAll metrics in the Registry
func (*StandardRegistry) GetOrRegister ¶
func (r *StandardRegistry) GetOrRegister(name string, i interface{}) interface{}
Get an existing metric or creates and registers a new one. Threadsafe alternative to calling Get and Register on failure. The interface can be the metric to register if not found in registry, or a function returning the metric for lazy instantiation.
func (*StandardRegistry) GetOrRegisterT ¶
func (r *StandardRegistry) GetOrRegisterT(name string, tagsMap map[string]string, i interface{}) interface{}
Get an existing metric or creates and registers a new one. Threadsafe alternative to calling Get and Register on failure. The interface can be the metric to register if not found in registry, or a function returning the metric for lazy instantiation.
func (*StandardRegistry) GetT ¶
func (r *StandardRegistry) GetT(name string, tagsMap map[string]string) interface{}
func (*StandardRegistry) Register ¶
func (r *StandardRegistry) Register(name string, i interface{}) error
Register the given metric under the given name. Returns a DuplicateMetric if a metric by the given name is already registered.
func (*StandardRegistry) RegisterT ¶
func (r *StandardRegistry) RegisterT(name string, tagsMap map[string]string, i interface{}) error
Register the given metric under the given name. Returns a DuplicateMetric if a metric by the given name is already registered.
func (*StandardRegistry) RunHealthchecks ¶
func (r *StandardRegistry) RunHealthchecks()
Run all registered healthchecks.
func (*StandardRegistry) Unregister ¶
func (r *StandardRegistry) Unregister(name string)
Unregister the metric with the given name.
func (*StandardRegistry) UnregisterAll ¶
func (r *StandardRegistry) UnregisterAll()
Unregister all metrics. (Mostly for testing.)
func (*StandardRegistry) UnregisterT ¶
func (r *StandardRegistry) UnregisterT(name string, tagsMap map[string]string)
Unregister the metric with the given name.
type StandardUGauge ¶ added in v0.0.7
type StandardUGauge struct {
// contains filtered or unexported fields
}
StandardUGauge is the standard implementation of a UGauge and uses the sync/atomic package to manage a single int64 value.
func (*StandardUGauge) Clear ¶ added in v0.0.7
func (g *StandardUGauge) Clear() uint64
Clear sets the DownCounter to zero.
func (*StandardUGauge) Snapshot ¶ added in v0.0.7
func (g *StandardUGauge) Snapshot() UGauge
Snapshot returns a read-only copy of the gauge.
func (*StandardUGauge) Update ¶ added in v0.0.7
func (g *StandardUGauge) Update(v uint64)
Update updates the gauge's value.
func (*StandardUGauge) Value ¶ added in v0.0.7
func (g *StandardUGauge) Value() uint64
Value returns the gauge's current value.
type SumHistogramSnapshot ¶ added in v0.0.4
type SumHistogramSnapshot struct {
// contains filtered or unexported fields
}
func (*SumHistogramSnapshot) Add ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Add(v int64)
func (SumHistogramSnapshot) AddLabelPrefix ¶ added in v0.0.4
func (SumHistogramSnapshot) AddLabelPrefix(string) Histogram
func (*SumHistogramSnapshot) Clear ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Clear() []uint64
func (*SumHistogramSnapshot) Interface ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (SumHistogramSnapshot) IsSummed ¶ added in v0.0.4
func (SumHistogramSnapshot) IsSummed() bool
func (*SumHistogramSnapshot) Labels ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Labels() []string
func (*SumHistogramSnapshot) NameTotal ¶ added in v0.0.4
func (h *SumHistogramSnapshot) NameTotal() string
func (SumHistogramSnapshot) SetLabels ¶ added in v0.0.4
func (SumHistogramSnapshot) SetLabels([]string) Histogram
func (SumHistogramSnapshot) SetNameTotal ¶ added in v0.0.4
func (SumHistogramSnapshot) SetNameTotal(string) Histogram
func (*SumHistogramSnapshot) Snapshot ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Snapshot() Histogram
func (*SumHistogramSnapshot) Values ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Values() []uint64
func (*SumHistogramSnapshot) Weights ¶ added in v0.0.4
func (h *SumHistogramSnapshot) Weights() []int64
func (*SumHistogramSnapshot) WeightsAliases ¶ added in v0.0.4
func (h *SumHistogramSnapshot) WeightsAliases() []string
type SumUHistogramSnapshot ¶ added in v0.0.8
type SumUHistogramSnapshot struct {
// contains filtered or unexported fields
}
func (*SumUHistogramSnapshot) Add ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Add(v uint64)
func (SumUHistogramSnapshot) AddLabelPrefix ¶ added in v0.0.8
func (SumUHistogramSnapshot) AddLabelPrefix(string) UHistogram
func (*SumUHistogramSnapshot) Clear ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Clear() []uint64
func (*SumUHistogramSnapshot) Interface ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Interface() HistogramInterface
for static check compatbility with UHistogramInterface
func (SumUHistogramSnapshot) IsSummed ¶ added in v0.0.8
func (SumUHistogramSnapshot) IsSummed() bool
func (*SumUHistogramSnapshot) Labels ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Labels() []string
func (*SumUHistogramSnapshot) NameTotal ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) NameTotal() string
func (SumUHistogramSnapshot) SetLabels ¶ added in v0.0.8
func (SumUHistogramSnapshot) SetLabels([]string) UHistogram
func (SumUHistogramSnapshot) SetNameTotal ¶ added in v0.0.8
func (SumUHistogramSnapshot) SetNameTotal(string) UHistogram
func (*SumUHistogramSnapshot) Snapshot ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Snapshot() UHistogram
func (*SumUHistogramSnapshot) Values ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Values() []uint64
func (*SumUHistogramSnapshot) Weights ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) Weights() []uint64
func (*SumUHistogramSnapshot) WeightsAliases ¶ added in v0.0.8
func (h *SumUHistogramSnapshot) WeightsAliases() []string
type UFixedHistogram ¶
type UFixedHistogram struct { UHistogramStorage // contains filtered or unexported fields }
A UFixedHistogram is implementation of UHistogram with fixed-size buckets.
func NewUFixedHistogram ¶
func NewUFixedHistogram(startVal, endVal, width uint64) *UFixedHistogram
func (*UFixedHistogram) Add ¶
func (h *UFixedHistogram) Add(v uint64)
func (*UFixedHistogram) AddLabelPrefix ¶
func (h *UFixedHistogram) AddLabelPrefix(labelPrefix string) UHistogram
func (*UFixedHistogram) SetLabels ¶
func (h *UFixedHistogram) SetLabels(labels []string) UHistogram
func (*UFixedHistogram) SetNameTotal ¶
func (h *UFixedHistogram) SetNameTotal(total string) UHistogram
type UGauge ¶ added in v0.0.7
UGauges hold an int64 value that can be set arbitrarily.
Graphite naming scheme
Plain: {PREFIX}.{NAME}
Tagged: {TAG_PREFIX}.{NAME}
func GetOrRegisterUGauge ¶ added in v0.0.7
GetOrRegisterUGauge returns an existing UGauge or constructs and registers a new StandardUGauge.
Example ¶
m := "server.bytes_sent" g := GetOrRegisterUGauge(m, NewRegistry()) g.Update(47) fmt.Println(g.Value())
Output: 47
func GetOrRegisterUGaugeT ¶ added in v0.0.7
GetOrRegisterUGaugeT returns an existing UGauge or constructs and registers a new StandardUGauge.
func NewFunctionalUGauge ¶ added in v0.0.7
NewFunctionalUGauge constructs a new FunctionalUGauge.
func NewRegisteredFunctionalUGauge ¶ added in v0.0.7
NewRegisteredFunctionalUGauge constructs and registers a new StandardUGauge.
func NewRegisteredFunctionalUGaugeT ¶ added in v0.0.7
func NewRegisteredFunctionalUGaugeT(name string, tagsMap map[string]string, r Registry, f func() uint64) UGauge
NewRegisteredFunctionalUGaugeT constructs and registers a new StandardUGauge.
func NewRegisteredUGauge ¶ added in v0.0.7
NewRegisteredUGauge constructs and registers a new StandardUGauge.
func NewRegisteredUGaugeT ¶ added in v0.0.7
NewRegisteredUGaugeT constructs and registers a new StandardUGauge.
type UGaugeSnapshot ¶ added in v0.0.7
type UGaugeSnapshot uint64
UGaugeSnapshot is a read-only copy of another UGauge.
func (UGaugeSnapshot) Snapshot ¶ added in v0.0.7
func (g UGaugeSnapshot) Snapshot() UGauge
Snapshot returns the snapshot.
func (UGaugeSnapshot) Value ¶ added in v0.0.7
func (g UGaugeSnapshot) Value() uint64
Value returns the value at the time the snapshot was taken.
type UHistogram ¶
type UHistogram interface { HistogramInterface SetLabels([]string) UHistogram AddLabelPrefix(string) UHistogram SetNameTotal(string) UHistogram Snapshot() UHistogram Add(v uint64) Weights() []uint64 }
A UHistogram is a lossy data structure used to record the distribution of non-normally distributed data (like latency) with a high degree of accuracy and a bounded degree of precision.
func GetOrRegisterFixedSumUHistogram ¶ added in v0.0.8
func GetOrRegisterFixedSumUHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
GetOrRegisterHistogram returns an existing UHistogram or constructs and registers a new FixedHistorgam (prometheus-like histogram).
func GetOrRegisterFixedSumUHistogramT ¶ added in v0.0.8
func GetOrRegisterFixedSumUHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width uint64) UHistogram
GetOrRegisterSumUHistogramT returns an existing UHistogram or constructs and registers a new FixedHistorgam (prometheus-like histogram).
func GetOrRegisterUFixedHistogram ¶
func GetOrRegisterUFixedHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
GetOrRegisterHistogram returns an existing Histogram or constructs and registers a new FixedHistorgam.
func GetOrRegisterUFixedHistogramT ¶
func GetOrRegisterUFixedHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width uint64) UHistogram
GetOrRegisterHistogramT returns an existing Histogram or constructs and registers a new FixedHistorgam.
func GetOrRegisterUVHistogram ¶
func GetOrRegisterUVHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
func GetOrRegisterVSumUHistogram ¶ added in v0.0.8
func GetOrRegisterVSumUHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
func GetOrRegisterVSumUHistogramT ¶ added in v0.0.8
func NewRegisteredFixedSumUHistogram ¶ added in v0.0.8
func NewRegisteredFixedSumUHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
NewRegisteredFixedSumUHistogram constructs and registers a new FixedSumUHistogram (prometheus-like histogram).
func NewRegisteredFixedSumUHistogramT ¶ added in v0.0.8
func NewRegisteredFixedSumUHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width uint64) UHistogram
NewRegisteredFixedSumUHistogramT constructs and registers a new FixedSumUHistogram (prometheus-like histogram).
func NewRegisteredUFixedHistogram ¶
func NewRegisteredUFixedHistogram(name string, r Registry, startVal, endVal, width uint64) UHistogram
NewRegisteredFixedHistogram constructs and registers a new FixedHistogram.
func NewRegisteredUFixedHistogramT ¶
func NewRegisteredUFixedHistogramT(name string, tagsMap map[string]string, r Registry, startVal, endVal, width uint64) UHistogram
NewRegisteredFixedHistogramT constructs and registers a new FixedHistogram.
func NewRegisteredUVHistogram ¶
func NewRegisteredUVHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
NewRegisteredVHistogram constructs and registers a new VHistogram.
func NewRegisteredUVHistogramT ¶
func NewRegisteredUVHistogramT(name string, tagsMap map[string]string, r Registry, weights []uint64, names []string) UHistogram
NewRegisteredVHistogramT constructs and registers a new VHistogram.
func NewRegisteredVSumUHistogram ¶ added in v0.0.8
func NewRegisteredVSumUHistogram(name string, r Registry, weights []uint64, names []string) UHistogram
NewRegisteredVSumUHistogram constructs and registers a new VSumUHistogram (prometheus-like histogram).
func NewRegisteredVSumUHistogramT ¶ added in v0.0.8
func NewRegisteredVSumUHistogramT(name string, tagsMap map[string]string, r Registry, weights []uint64, names []string) UHistogram
NewRegisteredVSumUHistogramT constructs and registers a new VSumUHistogram (prometheus-like histogram).
type UHistogramSnapshot ¶
type UHistogramSnapshot struct {
// contains filtered or unexported fields
}
func (*UHistogramSnapshot) Add ¶
func (h *UHistogramSnapshot) Add(v uint64)
func (UHistogramSnapshot) AddLabelPrefix ¶
func (UHistogramSnapshot) AddLabelPrefix(string) UHistogram
func (*UHistogramSnapshot) Clear ¶
func (h *UHistogramSnapshot) Clear() []uint64
func (*UHistogramSnapshot) Interface ¶
func (h *UHistogramSnapshot) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*UHistogramSnapshot) IsSummed ¶ added in v0.0.4
func (h *UHistogramSnapshot) IsSummed() bool
func (*UHistogramSnapshot) Labels ¶
func (h *UHistogramSnapshot) Labels() []string
func (*UHistogramSnapshot) NameTotal ¶
func (h *UHistogramSnapshot) NameTotal() string
func (UHistogramSnapshot) SetLabels ¶
func (UHistogramSnapshot) SetLabels([]string) UHistogram
func (UHistogramSnapshot) SetNameTotal ¶
func (UHistogramSnapshot) SetNameTotal(string) UHistogram
func (*UHistogramSnapshot) Snapshot ¶
func (h *UHistogramSnapshot) Snapshot() UHistogram
func (*UHistogramSnapshot) Values ¶
func (h *UHistogramSnapshot) Values() []uint64
func (*UHistogramSnapshot) Weights ¶
func (h *UHistogramSnapshot) Weights() []uint64
func (*UHistogramSnapshot) WeightsAliases ¶
func (h *UHistogramSnapshot) WeightsAliases() []string
type UHistogramStorage ¶
type UHistogramStorage struct {
// contains filtered or unexported fields
}
func (*UHistogramStorage) AddLabelPrefix ¶
func (h *UHistogramStorage) AddLabelPrefix(labelPrefix string)
func (*UHistogramStorage) Clear ¶
func (h *UHistogramStorage) Clear() []uint64
func (*UHistogramStorage) Interface ¶
func (h *UHistogramStorage) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*UHistogramStorage) IsSummed ¶ added in v0.0.4
func (h *UHistogramStorage) IsSummed() bool
func (*UHistogramStorage) Labels ¶
func (h *UHistogramStorage) Labels() []string
func (*UHistogramStorage) NameTotal ¶
func (h *UHistogramStorage) NameTotal() string
func (*UHistogramStorage) SetLabels ¶
func (h *UHistogramStorage) SetLabels(labels []string)
func (*UHistogramStorage) SetNameTotal ¶
func (h *UHistogramStorage) SetNameTotal(total string)
func (*UHistogramStorage) Snapshot ¶
func (h *UHistogramStorage) Snapshot() UHistogram
func (*UHistogramStorage) Values ¶
func (h *UHistogramStorage) Values() []uint64
func (*UHistogramStorage) Weights ¶
func (h *UHistogramStorage) Weights() []uint64
func (*UHistogramStorage) WeightsAliases ¶
func (h *UHistogramStorage) WeightsAliases() []string
type UVHistogram ¶
type UVHistogram struct {
UHistogramStorage
}
A UVHistogram is implementation of UHistogram with varibale-size buckets.
func NewUVHistogram ¶
func NewUVHistogram(weights []uint64, labels []string) *UVHistogram
func (*UVHistogram) Add ¶
func (h *UVHistogram) Add(v uint64)
func (*UVHistogram) AddLabelPrefix ¶
func (h *UVHistogram) AddLabelPrefix(labelPrefix string) UHistogram
func (*UVHistogram) SetLabels ¶
func (h *UVHistogram) SetLabels(labels []string) UHistogram
func (*UVHistogram) SetNameTotal ¶
func (h *UVHistogram) SetNameTotal(total string) UHistogram
func (*UVHistogram) Snapshot ¶
func (h *UVHistogram) Snapshot() UHistogram
func (*UVHistogram) Values ¶
func (h *UVHistogram) Values() []uint64
type Updated ¶
type Updated interface {
Update()
}
Updated defines the metrics which need to be async updated with Tick.
type VHistogram ¶
type VHistogram struct {
HistogramStorage
}
A VHistogram is implementation of Histogram with varibale-size buckets.
func NewVHistogram ¶
func NewVHistogram(weights []int64, labels []string) *VHistogram
func (*VHistogram) Add ¶
func (h *VHistogram) Add(v int64)
func (*VHistogram) AddLabelPrefix ¶
func (h *VHistogram) AddLabelPrefix(labelPrefix string) Histogram
func (*VHistogram) Interface ¶
func (h *VHistogram) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*VHistogram) SetLabels ¶
func (h *VHistogram) SetLabels(labels []string) Histogram
func (*VHistogram) SetNameTotal ¶
func (h *VHistogram) SetNameTotal(total string) Histogram
func (*VHistogram) Snapshot ¶
func (h *VHistogram) Snapshot() Histogram
func (*VHistogram) Values ¶
func (h *VHistogram) Values() []uint64
func (*VHistogram) WeightsAliases ¶
func (h *VHistogram) WeightsAliases() []string
type VSumHistogram ¶ added in v0.0.4
type VSumHistogram struct {
HistogramStorage
}
A VSumHistogram is implementation of prometheus-like Histogram with varibale-size buckets.
func NewVSumHistogram ¶ added in v0.0.4
func NewVSumHistogram(weights []int64, names []string) *VSumHistogram
func (*VSumHistogram) Add ¶ added in v0.0.4
func (h *VSumHistogram) Add(v int64)
func (*VSumHistogram) AddLabelPrefix ¶ added in v0.0.4
func (h *VSumHistogram) AddLabelPrefix(labelPrefix string) Histogram
func (*VSumHistogram) Interface ¶ added in v0.0.4
func (h *VSumHistogram) Interface() HistogramInterface
for static check compatbility with HistogramInterface
func (*VSumHistogram) IsSummed ¶ added in v0.0.4
func (h *VSumHistogram) IsSummed() bool
func (*VSumHistogram) SetLabels ¶ added in v0.0.4
func (h *VSumHistogram) SetLabels(labels []string) Histogram
func (*VSumHistogram) SetNameTotal ¶ added in v0.0.4
func (h *VSumHistogram) SetNameTotal(total string) Histogram
func (*VSumHistogram) Snapshot ¶ added in v0.0.4
func (h *VSumHistogram) Snapshot() Histogram
func (*VSumHistogram) Values ¶ added in v0.0.4
func (h *VSumHistogram) Values() []uint64
func (*VSumHistogram) WeightsAliases ¶ added in v0.0.4
func (h *VSumHistogram) WeightsAliases() []string
type VSumUHistogram ¶ added in v0.0.8
type VSumUHistogram struct {
UHistogramStorage
}
A VSumUHistogram is implementation of prometheus-like UHistogram with varibale-size buckets.
func NewVSumUHistogram ¶ added in v0.0.8
func NewVSumUHistogram(weights []uint64, names []string) *VSumUHistogram
func (*VSumUHistogram) Add ¶ added in v0.0.8
func (h *VSumUHistogram) Add(v uint64)
func (*VSumUHistogram) AddLabelPrefix ¶ added in v0.0.8
func (h *VSumUHistogram) AddLabelPrefix(labelPrefix string) UHistogram
func (*VSumUHistogram) Interface ¶ added in v0.0.8
func (h *VSumUHistogram) Interface() HistogramInterface
for static check compatbility with UHistogramInterface
func (*VSumUHistogram) IsSummed ¶ added in v0.0.8
func (h *VSumUHistogram) IsSummed() bool
func (*VSumUHistogram) SetLabels ¶ added in v0.0.8
func (h *VSumUHistogram) SetLabels(labels []string) UHistogram
func (*VSumUHistogram) SetNameTotal ¶ added in v0.0.8
func (h *VSumUHistogram) SetNameTotal(total string) UHistogram
func (*VSumUHistogram) Snapshot ¶ added in v0.0.8
func (h *VSumUHistogram) Snapshot() UHistogram
func (*VSumUHistogram) Values ¶ added in v0.0.8
func (h *VSumUHistogram) Values() []uint64
func (*VSumUHistogram) WeightsAliases ¶ added in v0.0.8
func (h *VSumUHistogram) WeightsAliases() []string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Hook go-metrics into expvar on any /debug/metrics request, load all vars from the registry into expvar, and execute regular expvar handler
|
Hook go-metrics into expvar on any /debug/metrics request, load all vars from the registry into expvar, and execute regular expvar handler |