Documentation
¶
Index ¶
- Variables
- func RegisterCollector(name string, createFunc func() (Collector, error))
- type Collector
- type HistogramStatsCollector
- func (c *HistogramStatsCollector) Decr(stat types.Stat, value int64)
- func (c *HistogramStatsCollector) Gauge(stat types.Stat, value int64)
- func (c *HistogramStatsCollector) GetStats() Stats
- func (c *HistogramStatsCollector) Histogram(stat types.Stat, value int64)
- func (c *HistogramStatsCollector) Incr(stat types.Stat, value int64)
- func (c *HistogramStatsCollector) Mean(stat types.Stat) float64
- func (c *HistogramStatsCollector) Median(stat types.Stat) float64
- func (c *HistogramStatsCollector) Percentile(stat types.Stat, p float64) float64
- func (c *HistogramStatsCollector) Timing(stat types.Stat, value int64)
- type Stat
- type Stats
Constants ¶
This section is empty.
Variables ¶
var StatsCollectorRegistry = make(map[string]func() (Collector, error))
StatsCollectorRegistry holds the a registry of stats collectors.
Functions ¶
func RegisterCollector ¶ added in v0.0.5
RegisterCollector registers a new stats collector with the given name.
Types ¶
type Collector ¶ added in v0.0.4
type Collector interface { // Incr increments the count of a statistic by the given value. Incr(stat types.Stat, value int64) // Decr decrements the count of a statistic by the given value. Decr(stat types.Stat, value int64) // Timing records the time it took for an event to occur. Timing(stat types.Stat, value int64) // Gauge records the current value of a statistic. Gauge(stat types.Stat, value int64) // Histogram records the statistical distribution of a set of values. Histogram(stat types.Stat, value int64) // GetStats returns the collected statistics. GetStats() Stats }
Collector is an interface that defines the methods that a stats collector should implement.
func NewCollector ¶ added in v0.0.5
NewCollector creates a new stats collector. The statsCollectorName parameter is used to select the stats collector from the registry.
type HistogramStatsCollector ¶
type HistogramStatsCollector struct {
// contains filtered or unexported fields
}
HistogramStatsCollector is a stats collector that collects histogram stats.
func NewHistogramStatsCollector ¶
func NewHistogramStatsCollector() *HistogramStatsCollector
NewHistogramStatsCollector creates a new histogram stats collector.
func (*HistogramStatsCollector) Decr ¶
func (c *HistogramStatsCollector) Decr(stat types.Stat, value int64)
Decr decrements the count of a statistic by the given value.
func (*HistogramStatsCollector) Gauge ¶
func (c *HistogramStatsCollector) Gauge(stat types.Stat, value int64)
Gauge records the current value of a statistic.
func (*HistogramStatsCollector) GetStats ¶ added in v0.0.4
func (c *HistogramStatsCollector) GetStats() Stats
GetStats returns the stats collected by the stats collector. It calculates the mean, median, min, max, count, sum, and variance for each stat. It returns a map where the keys are the stat names and the values are the stat values.
func (*HistogramStatsCollector) Histogram ¶
func (c *HistogramStatsCollector) Histogram(stat types.Stat, value int64)
Histogram records the statistical distribution of a set of values.
func (*HistogramStatsCollector) Incr ¶
func (c *HistogramStatsCollector) Incr(stat types.Stat, value int64)
Incr increments the count of a statistic by the given value.
func (*HistogramStatsCollector) Mean ¶
func (c *HistogramStatsCollector) Mean(stat types.Stat) float64
Mean returns the mean value of a statistic.
func (*HistogramStatsCollector) Median ¶
func (c *HistogramStatsCollector) Median(stat types.Stat) float64
Median returns the median value of a statistic.
func (*HistogramStatsCollector) Percentile ¶
func (c *HistogramStatsCollector) Percentile(stat types.Stat, p float64) float64
Percentile returns the pth percentile value of a statistic.
type Stat ¶
type Stat struct { // Mean value of the stat Mean float64 // Median value of the stat Median float64 // Min is the minumum value of the stat Min int64 // Max maximum value of the stat Max int64 // Values slice of all the values of the stat Values []int64 // Count the number of values of the stat Count int // Sum of all the values of the stat Sum int64 // Variance of the values of the stat Variance float64 }
Stat represents statistical data for a specific stat.