Documentation
¶
Index ¶
- type Metrics
- func (ctx *Metrics) AddHistogram(subsystem, name, help string) *MetricsHistogram
- func (ctx *Metrics) AddHistogramWithCustomBuckets(subsystem, name, help string, buckets []float64) *MetricsHistogram
- func (ctx *Metrics) Count(subsystem, name, help string)
- func (ctx *Metrics) CountLabels(subsystem, name, help string, labels, values []string)
- func (ctx *Metrics) IncreaseCounter(subsystem, name, help string, increment int)
- func (ctx *Metrics) SetGauge(value float64, subsystem, name, help string)
- type MetricsHistogram
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
Namespace string
Counters map[string]prometheus.Counter
CounterVecs map[string]*prometheus.CounterVec
Summaries map[string]prometheus.Summary
Histograms map[string]prometheus.Histogram
Gauges map[string]prometheus.Gauge
Logger *logger.Logger
// contains filtered or unexported fields
}
Metrics provides a set of convenience functions that wrap Prometheus
func NewMetrics ¶
NewMetrics will instantiate a new Metrics wrapper object
func (*Metrics) AddHistogram ¶
func (ctx *Metrics) AddHistogram(subsystem, name, help string) *MetricsHistogram
AddHistogram returns the MetricsHistogram for the specified subsystem and name.
func (*Metrics) AddHistogramWithCustomBuckets ¶
func (ctx *Metrics) AddHistogramWithCustomBuckets(subsystem, name, help string, buckets []float64) *MetricsHistogram
AddHistogramWithCustomBuckets returns the MetricsHistogram for the specified subsystem and name with the specified buckets.
func (*Metrics) CountLabels ¶
CountLabels increases the counter for the specified subsystem and name and adds the specified labels with values.
func (*Metrics) IncreaseCounter ¶
IncreaseCounter increases the counter for the specified subsystem and name with the specified increment.
type MetricsHistogram ¶
type MetricsHistogram struct {
Key string
// contains filtered or unexported fields
}
MetricsHistogram combines a histogram and summary
func (*MetricsHistogram) Observe ¶
func (histogram *MetricsHistogram) Observe(value float64)
Observe adds the specified value to the histogram.
func (*MetricsHistogram) RecordDuration ¶
func (histogram *MetricsHistogram) RecordDuration(start time.Time, unit time.Duration)
RecordDuration adds the elapsed time since the specified start to the histogram in the specified unit of time and to the linked summary in milliseconds.
func (*MetricsHistogram) RecordTimeElapsed ¶
func (histogram *MetricsHistogram) RecordTimeElapsed(start time.Time)
RecordTimeElapsed adds the elapsed time since the specified start to the histogram in seconds and to the linked summary in milliseconds.