Documentation
¶
Index ¶
- func CleanRegistry() error
- func RegisterCollector(collectors ...Collector) error
- func RegisterMetrics(allMetrics ...[]Metric) error
- func UnregisterMetrics(allMetrics ...[]Metric) error
- type Collector
- type CollectorResult
- type Counter
- type CounterVec
- type Gauge
- type GaugeVec
- type Histogram
- type HistogramVec
- type Metric
- type MetricOpts
- type MetricType
- type RegistryFunc
- type Summary
- type SummaryVec
- type UnregisterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCollector ¶
RegisterCollector registers the collector with the Prometheus registry.
func RegisterMetrics ¶
RegisterMetrics registers the metrics with the Prometheus registry.
func UnregisterMetrics ¶
UnregisterMetrics unregisters the metrics from the Prometheus registry.
Types ¶
type Collector ¶
type Collector struct {
// Metrics is a list of metrics to be collected by the collector.
Metrics []Metric
// CollectCallback is a function that returns a list of CollectionResults.
// The CollectionResults are used to populate the metrics in the collector.
CollectCallback func() []CollectorResult
}
Collector registers a prometheus.Collector with a set of metrics in the Prometheus registry. The metrics are collected by calling the CollectCallback function.
func (Collector) Collect ¶
func (c Collector) Collect(ch chan<- prometheus.Metric)
func (Collector) Describe ¶
func (c Collector) Describe(ch chan<- *prometheus.Desc)
type CollectorResult ¶
type CollectorResult struct {
Metric Metric
Labels []string
ConstLabels map[string]string
Value float64
Timestamp time.Time
}
func (CollectorResult) GetLabelValue ¶
func (cr CollectorResult) GetLabelValue(key string) (string, error)
type Counter ¶
type Counter struct {
prometheus.Counter
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter(metricOpts MetricOpts) *Counter
NewCounter creates a new Counter. The Counter must be registered with the Prometheus registry through RegisterMetrics.
func (*Counter) GetBaseType ¶
func (c *Counter) GetBaseType() MetricType
func (*Counter) GetCollector ¶
func (c *Counter) GetCollector() prometheus.Collector
func (*Counter) GetOpts ¶
func (c *Counter) GetOpts() MetricOpts
func (*Counter) GetType ¶
func (c *Counter) GetType() MetricType
type CounterVec ¶
type CounterVec struct {
prometheus.CounterVec
// contains filtered or unexported fields
}
func NewCounterVec ¶
func NewCounterVec(metricOpts MetricOpts, labels []string) *CounterVec
NewCounterVec creates a new CounterVec. The CounterVec must be registered with the Prometheus registry through RegisterMetrics.
func (*CounterVec) GetBaseType ¶
func (c *CounterVec) GetBaseType() MetricType
func (*CounterVec) GetCollector ¶
func (c *CounterVec) GetCollector() prometheus.Collector
func (*CounterVec) GetOpts ¶
func (c *CounterVec) GetOpts() MetricOpts
func (*CounterVec) GetType ¶
func (c *CounterVec) GetType() MetricType
type Gauge ¶
type Gauge struct {
prometheus.Gauge
// contains filtered or unexported fields
}
func NewGauge ¶
func NewGauge(metricOpts MetricOpts) *Gauge
NewGauge creates a new Gauge. The Gauge must be registered with the Prometheus registry through RegisterMetrics.
func (*Gauge) GetBaseType ¶
func (c *Gauge) GetBaseType() MetricType
func (*Gauge) GetCollector ¶
func (c *Gauge) GetCollector() prometheus.Collector
func (*Gauge) GetOpts ¶
func (c *Gauge) GetOpts() MetricOpts
func (*Gauge) GetType ¶
func (c *Gauge) GetType() MetricType
type GaugeVec ¶
type GaugeVec struct {
prometheus.GaugeVec
// contains filtered or unexported fields
}
func NewGaugeVec ¶
func NewGaugeVec(metricOpts MetricOpts, labels []string) *GaugeVec
NewGaugeVec creates a new GaugeVec. The GaugeVec must be registered with the Prometheus registry through RegisterMetrics.
func (*GaugeVec) GetBaseType ¶
func (c *GaugeVec) GetBaseType() MetricType
func (*GaugeVec) GetCollector ¶
func (c *GaugeVec) GetCollector() prometheus.Collector
func (*GaugeVec) GetOpts ¶
func (c *GaugeVec) GetOpts() MetricOpts
func (*GaugeVec) GetType ¶
func (c *GaugeVec) GetType() MetricType
type Histogram ¶
type Histogram struct {
prometheus.Histogram
// contains filtered or unexported fields
}
func NewHistogram ¶
func NewHistogram(metricOpts MetricOpts, histogramOpts prometheus.HistogramOpts) *Histogram
NewHistogram creates a new Histogram. The Histogram must be registered with the Prometheus registry through RegisterMetrics.
func (*Histogram) GetBaseType ¶
func (c *Histogram) GetBaseType() MetricType
func (*Histogram) GetCollector ¶
func (c *Histogram) GetCollector() prometheus.Collector
func (*Histogram) GetHistogramOpts ¶
func (c *Histogram) GetHistogramOpts() prometheus.HistogramOpts
func (*Histogram) GetOpts ¶
func (c *Histogram) GetOpts() MetricOpts
func (*Histogram) GetType ¶
func (c *Histogram) GetType() MetricType
type HistogramVec ¶
type HistogramVec struct {
prometheus.HistogramVec
// contains filtered or unexported fields
}
func NewHistogramVec ¶
func NewHistogramVec(metricOpts MetricOpts, histogramOpts prometheus.HistogramOpts, labels []string) *HistogramVec
NewHistogramVec creates a new HistogramVec. The HistogramVec must be registered with the Prometheus registry through RegisterMetrics.
func (*HistogramVec) GetBaseType ¶
func (c *HistogramVec) GetBaseType() MetricType
func (*HistogramVec) GetCollector ¶
func (c *HistogramVec) GetCollector() prometheus.Collector
func (*HistogramVec) GetHistogramOpts ¶
func (c *HistogramVec) GetHistogramOpts() prometheus.HistogramOpts
func (*HistogramVec) GetOpts ¶
func (c *HistogramVec) GetOpts() MetricOpts
func (*HistogramVec) GetType ¶
func (c *HistogramVec) GetType() MetricType
type Metric ¶
type Metric interface {
GetOpts() MetricOpts
GetType() MetricType
GetBaseType() MetricType
GetCollector() prometheus.Collector
}
func ListMetrics ¶
func ListMetrics() []Metric
ListMetrics returns a list of all registered metrics.
type MetricOpts ¶
type MetricType ¶
type MetricType string
const ( CounterType MetricType = "Counter" GaugeType MetricType = "Gauge" HistogramType MetricType = "Histogram" SummaryType MetricType = "Summary" CounterVecType MetricType = "CounterVec" GaugeVecType MetricType = "GaugeVec" HistogramVecType MetricType = "HistogramVec" SummaryVecType MetricType = "SummaryVec" )
type RegistryFunc ¶
type RegistryFunc func(c prometheus.Collector) error
var Register RegistryFunc = prometheus.Register
Register is the function used to register metrics and collectors by this package.
type Summary ¶
type Summary struct {
prometheus.Summary
// contains filtered or unexported fields
}
func NewSummary ¶
func NewSummary(metricOpts MetricOpts, summaryOpts prometheus.SummaryOpts) *Summary
NewSummary creates a new Summary. The Summary must be registered with the Prometheus registry through RegisterMetrics.
func (*Summary) GetBaseType ¶
func (c *Summary) GetBaseType() MetricType
func (*Summary) GetCollector ¶
func (c *Summary) GetCollector() prometheus.Collector
func (*Summary) GetOpts ¶
func (c *Summary) GetOpts() MetricOpts
func (*Summary) GetSummaryOpts ¶
func (c *Summary) GetSummaryOpts() prometheus.SummaryOpts
func (*Summary) GetType ¶
func (c *Summary) GetType() MetricType
type SummaryVec ¶
type SummaryVec struct {
prometheus.SummaryVec
// contains filtered or unexported fields
}
func NewSummaryVec ¶
func NewSummaryVec(metricOpts MetricOpts, summaryOpts prometheus.SummaryOpts, labels []string) *SummaryVec
NewSummaryVec creates a new SummaryVec. The SummaryVec must be registered with the Prometheus registry through RegisterMetrics.
func (*SummaryVec) GetBaseType ¶
func (c *SummaryVec) GetBaseType() MetricType
func (*SummaryVec) GetCollector ¶
func (c *SummaryVec) GetCollector() prometheus.Collector
func (*SummaryVec) GetOpts ¶
func (c *SummaryVec) GetOpts() MetricOpts
func (*SummaryVec) GetSummaryOpts ¶
func (c *SummaryVec) GetSummaryOpts() prometheus.SummaryOpts
func (*SummaryVec) GetType ¶
func (c *SummaryVec) GetType() MetricType
type UnregisterFunc ¶
type UnregisterFunc func(c prometheus.Collector) bool
var Unregister UnregisterFunc = prometheus.Unregister
Unregister is the function used to unregister metrics and collectors by this package.