Documentation
¶
Index ¶
- type HistogramVec
- type Metrics
- func (m *Metrics) AddHistogram(subsystem, name, help string) *MetricsHistogram
- func (m *Metrics) AddHistogramVec(subsystem, name, help string, labels, labelValues []string) *HistogramVec
- func (m *Metrics) AddHistogramVecWithCustomBuckets(subsystem, name, help string, labels, labelValues []string, buckets []float64) *HistogramVec
- func (m *Metrics) AddHistogramWithCustomBuckets(subsystem, name, help string, buckets []float64) *MetricsHistogram
- func (m *Metrics) Count(subsystem, name, help string)
- func (m *Metrics) CountLabels(subsystem, name, help string, labels, values []string)
- func (m *Metrics) IncreaseCounter(subsystem, name, help string, increment int)
- func (m *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 HistogramVec ¶ added in v1.2.0
type HistogramVec struct {
Key string
Labels []string
LabelValues []string
// contains filtered or unexported fields
}
HistogramVec combines a histogramVec and summary
func (*HistogramVec) Observe ¶ added in v1.2.0
func (vec *HistogramVec) Observe(value float64)
Observe adds the specified value to the histogram.
func (*HistogramVec) RecordDuration ¶ added in v1.2.0
func (vec *HistogramVec) 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 (*HistogramVec) RecordTimeElapsed ¶ added in v1.2.0
func (vec *HistogramVec) 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.
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
HistogramVecs map[string]*prometheus.HistogramVec
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 (m *Metrics) AddHistogram(subsystem, name, help string) *MetricsHistogram
AddHistogram returns the MetricsHistogram for the specified subsystem and name.
func (*Metrics) AddHistogramVec ¶ added in v1.2.0
func (m *Metrics) AddHistogramVec(subsystem, name, help string, labels, labelValues []string) *HistogramVec
AddHistogramVec returns the HistogramVec for the specified subsystem and name.
func (*Metrics) AddHistogramVecWithCustomBuckets ¶ added in v1.2.0
func (m *Metrics) AddHistogramVecWithCustomBuckets(subsystem, name, help string, labels, labelValues []string, buckets []float64) *HistogramVec
AddHistogramWithCustomBuckets returns the HistogramVec for the specified subsystem and name with the specified buckets.
func (*Metrics) AddHistogramWithCustomBuckets ¶
func (m *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.