Documentation
¶
Index ¶
- func DefaultObjectives() map[float64]float64
- 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) AddSummaryVec(subsystem, name, help string, labels, labelValues []string) *SummaryVec
- func (m *Metrics) AddSummaryVecWithCustomObjectives(subsystem, name, help string, labels, labelValues []string, ...) *SummaryVec
- 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
- type SummaryVec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultObjectives ¶ added in v1.3.0
DefaultObjectives returns a default map of quantiles to be used in summaries.
Types ¶
type HistogramVec ¶ added in v1.2.0
type HistogramVec struct {
Key string
Labels []string
LabelValues []string
// contains filtered or unexported fields
}
HistogramVec wraps prometheus.HistogramVec
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.
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.
type Metrics ¶
type Metrics struct {
Namespace string
Counters map[string]prometheus.Counter
CounterVecs map[string]*prometheus.CounterVec
Summaries map[string]prometheus.Summary
SummaryVecs map[string]*prometheus.SummaryVec
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
AddHistogramVecWithCustomBuckets 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) AddSummaryVec ¶ added in v1.3.0
func (m *Metrics) AddSummaryVec(subsystem, name, help string, labels, labelValues []string) *SummaryVec
AddSummaryVec returns the SummaryVec for the specified subsystem and name.
func (*Metrics) AddSummaryVecWithCustomObjectives ¶ added in v1.3.0
func (m *Metrics) AddSummaryVecWithCustomObjectives(subsystem, name, help string, labels, labelValues []string, objectives map[float64]float64) *SummaryVec
AddSummaryVecWithCustomObjectives returns the SummaryVec for the specified subsystem and name with the specified objectives.
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.
type SummaryVec ¶ added in v1.3.0
type SummaryVec struct {
Key string
Labels []string
LabelValues []string
// contains filtered or unexported fields
}
SummaryVec wraps prometheus.SummaryVec
func (*SummaryVec) RecordTimeElapsed ¶ added in v1.3.0
func (vec *SummaryVec) RecordTimeElapsed(start time.Time)
RecordTimeElapsed adds the elapsed time since the specified start to the summary in milliseconds.