Documentation ¶
Index ¶
- type Counter
- type CounterRegistry
- func (r *CounterRegistry) Add(name string, n int64) int64
- func (r *CounterRegistry) Get(name string) *Counter
- func (r *CounterRegistry) Inc(name string) int64
- func (r *CounterRegistry) LoadIntervalValues(names ...string) map[string]int64
- func (r *CounterRegistry) LoadValues(names ...string) map[string]int64
- func (r *CounterRegistry) Register(name string, c *Counter)
- func (r *CounterRegistry) UpdateDelta()
- type Gauge
- type GaugeRegistry
- type HDRHistogram
- func (h *HDRHistogram) LoadValues() map[string]int64
- func (h *HDRHistogram) MergedSnapshot() *hdr.Histogram
- func (h *HDRHistogram) RecordMicroseconds(value time.Duration) error
- func (h *HDRHistogram) RecordValue(value int64) error
- func (h *HDRHistogram) Rotate()
- func (h *HDRHistogram) Snapshot() *hdr.Histogram
- type HDRHistogramRegistry
- func (r *HDRHistogramRegistry) Get(name string) *HDRHistogram
- func (r *HDRHistogramRegistry) LoadValues(names ...string) map[string]int64
- func (r *HDRHistogramRegistry) RecordMicroseconds(name string, value time.Duration) error
- func (r *HDRHistogramRegistry) RecordValue(name string, value int64) error
- func (r *HDRHistogramRegistry) Register(name string, h *HDRHistogram)
- func (r *HDRHistogramRegistry) Rotate()
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a wrapper around a set of int64s that count things. It encapsulates both absolute monotonic counter (incremented atomically), and periodic delta which is updated every `app.config.NodeMetricsInterval`.
func (*Counter) IntervalValue ¶
IntervalValue allows to get last interval value for counter.
func (*Counter) UpdateDelta ¶
func (c *Counter) UpdateDelta()
UpdateDelta updates the delta value for last interval based on current value and previous value.
type CounterRegistry ¶
type CounterRegistry struct {
// contains filtered or unexported fields
}
CounterRegistry contains counters with specified names.
func NewCounterRegistry ¶
func NewCounterRegistry() *CounterRegistry
NewCounterRegistry creates new CounterRegistry.
func (*CounterRegistry) Add ¶
func (r *CounterRegistry) Add(name string, n int64) int64
Add by name. Should only be called after registry already initialized.
func (*CounterRegistry) Get ¶
func (r *CounterRegistry) Get(name string) *Counter
Get allows to get Counter from registry.
func (*CounterRegistry) Inc ¶
func (r *CounterRegistry) Inc(name string) int64
Inc by name. Should only be called after registry already initialized.
func (*CounterRegistry) LoadIntervalValues ¶
func (r *CounterRegistry) LoadIntervalValues(names ...string) map[string]int64
LoadIntervalValues allows to get union of last interval snapshot values over registered counters. Should only be called after registry already initialized.
func (*CounterRegistry) LoadValues ¶
func (r *CounterRegistry) LoadValues(names ...string) map[string]int64
LoadValues allows to get union of raw counter values over registered counters. Should only be called after registry already initialized.
func (*CounterRegistry) Register ¶
func (r *CounterRegistry) Register(name string, c *Counter)
Register allows to register Counter in registry.
func (*CounterRegistry) UpdateDelta ¶
func (r *CounterRegistry) UpdateDelta()
UpdateDelta updates snapshot counter values. Should only be called after registry already initialized.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge represents a current value of sth.
type GaugeRegistry ¶
type GaugeRegistry struct {
// contains filtered or unexported fields
}
GaugeRegistry is a registry of gauges by name.
func NewGaugeRegistry ¶
func NewGaugeRegistry() *GaugeRegistry
NewGaugeRegistry creates new GaugeRegistry.
func (*GaugeRegistry) Get ¶
func (r *GaugeRegistry) Get(name string) *Gauge
Get allows to get Gauge from registry by name.
func (*GaugeRegistry) LoadValues ¶
func (r *GaugeRegistry) LoadValues(names ...string) map[string]int64
LoadValues allows to get union of gauge values over registered gauges.
func (*GaugeRegistry) Register ¶
func (r *GaugeRegistry) Register(name string, c *Gauge)
Register allows to register Gauge in registry.
func (*GaugeRegistry) Set ¶
func (r *GaugeRegistry) Set(name string, value int64)
Set allows to set gauge value in registry by name.
type HDRHistogram ¶
type HDRHistogram struct {
// contains filtered or unexported fields
}
HDRHistogram is a synchronized wrapper over github.com/codahale/hdrhistogram.WindowedHistogram
func NewHDRHistogram ¶
func NewHDRHistogram(nHistograms int, minValue, maxValue int64, sigfigs int, quantiles []float64, quantity string) *HDRHistogram
NewHDRHistogram creates new HDRHistogram.
func (*HDRHistogram) LoadValues ¶
func (h *HDRHistogram) LoadValues() map[string]int64
LoadValues allows to export map of histogram values - both current and merged.
func (*HDRHistogram) MergedSnapshot ¶
func (h *HDRHistogram) MergedSnapshot() *hdr.Histogram
MergedSnapshot allows to get snapshot of merged histogram in a thread-safe way.
func (*HDRHistogram) RecordMicroseconds ¶
func (h *HDRHistogram) RecordMicroseconds(value time.Duration) error
RecordMicroseconds allows to record time.Duration value as microseconds.
func (*HDRHistogram) RecordValue ¶
func (h *HDRHistogram) RecordValue(value int64) error
RecordValue is wrapper over github.com/codahale/hdrhistogram.WindowedHistogram.RecordValue with extra mutex protection to allow concurrent writes.
func (*HDRHistogram) Snapshot ¶
func (h *HDRHistogram) Snapshot() *hdr.Histogram
Snapshot allows to get snapshot of current histogram in a thread-safe way.
type HDRHistogramRegistry ¶
type HDRHistogramRegistry struct {
// contains filtered or unexported fields
}
HDRHistogramRegistry is a wrapper to deal with several HDRHistogram instances. After it has been initialized you only can write values into histograms and extract data - do not register histograms dinamically after initial setup.
func NewHDRHistogramRegistry ¶
func NewHDRHistogramRegistry() *HDRHistogramRegistry
NewHDRHistogramRegistry creates new HDRHistogramRegistry.
func (*HDRHistogramRegistry) Get ¶
func (r *HDRHistogramRegistry) Get(name string) *HDRHistogram
Get allows to get Gauge from registry.
func (*HDRHistogramRegistry) LoadValues ¶
func (r *HDRHistogramRegistry) LoadValues(names ...string) map[string]int64
LoadValues allows to get union of metric values over registered histograms - both for current and merged over all buckets. If names not provided then return values for all registered histograms.
func (*HDRHistogramRegistry) RecordMicroseconds ¶
func (r *HDRHistogramRegistry) RecordMicroseconds(name string, value time.Duration) error
RecordMicroseconds into histogram with provided name. Noop if name not registered.
func (*HDRHistogramRegistry) RecordValue ¶
func (r *HDRHistogramRegistry) RecordValue(name string, value int64) error
RecordValue into histogram with provided name. Noop if name not registered.
func (*HDRHistogramRegistry) Register ¶
func (r *HDRHistogramRegistry) Register(name string, h *HDRHistogram)
Register allows to register HDRHistogram in registry so you can use its name later to record values over registry instance using RecordValue and RecordMicroseconds methods.
func (*HDRHistogramRegistry) Rotate ¶
func (r *HDRHistogramRegistry) Rotate()
Rotate all registered histograms.
type Registry ¶
type Registry struct { Gauges *GaugeRegistry Counters *CounterRegistry HDRHistograms *HDRHistogramRegistry }
Registry contains various Centrifugo statistic and metric information aggregated once in a configurable interval.
var DefaultRegistry *Registry
func (*Registry) RegisterCounter ¶
RegisterCounter allows to register counter in registry.
func (*Registry) RegisterGauge ¶
RegisterGauge allows to register gauge in registry.
func (*Registry) RegisterHDRHistogram ¶
func (m *Registry) RegisterHDRHistogram(name string, h *HDRHistogram)
RegisterHDRHistogram allows to register hdr histogram in registry.