Documentation ¶
Index ¶
- type Counter
- type CounterT
- type Histogram
- type HistogramT
- type Manager
- func (m *Manager) AddCounter(name, help string, labelNames []string) error
- func (m *Manager) AddHistogram(name, help string, labelNames []string, buckets []float64) error
- func (m *Manager) GetCounter(name string) (CounterT, error)
- func (m *Manager) GetHistogram(name string) (HistogramT, error)
- func (m *Manager) UnregisterAll() error
- type ManagerT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a concrete impl of CounterT.
func (*Counter) Add ¶
Add adds the supplied value to the counter associated with the supplied labels.
func (*Counter) CreationTime ¶
CreationTime returns the creation time of this metric.
func (*Counter) Metric ¶
func (c *Counter) Metric() *prometheus.CounterVec
Metric returns a pointer to the underlying CounterVec.
type CounterT ¶
type CounterT interface { Add(labels map[string]string, value float64) error Metric() *prometheus.CounterVec CreationTime() time.Time }
CounterT is an interface for "wrapped" (i.e. owned by the Manager) counters.
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is a concrete impl of HistogramT.
func (*Histogram) CreationTime ¶
CreationTime returns the creation time of this metric.
func (*Histogram) Metric ¶
func (h *Histogram) Metric() prometheus.ObserverVec
Metric returns the underlying ObserverVec interface.
type HistogramT ¶
type HistogramT interface { Observe(labels map[string]string, values []float64) error Metric() prometheus.ObserverVec CreationTime() time.Time }
HistogramT is an interface for "wrapped" (i.e. owned by the Manager) histograms.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an abstraction for ownership and access to counter and histogram metrics, intended to reduce boilerplate over managing Prometheus metrics directly.
func NewManager ¶
NewManager returns a Manager configured with the supplied "base" labels. All metrics created by the manager will be curried so as to already have those labels partially applied.
func (*Manager) AddCounter ¶
AddCounter adds a counter metric with the supplied name, help string, and field labels.
func (*Manager) AddHistogram ¶
AddHistogram adds a histogram metric with the supplied name, help string, field labels, and (optionally) buckets. Pass nil for buckets to use the defaults.
func (*Manager) GetCounter ¶
GetCounter returns the counter with the specified name (i.e. passed on an earlier call to AddCounter). Note that the returned counter will already have the base labels supplied to the Manager partially applied.
func (*Manager) GetHistogram ¶
func (m *Manager) GetHistogram(name string) (HistogramT, error)
GetHistogram returns the histogram with the specified name (i.e. passed on an earlier call to AddHistogram). Note that the returned histogram will already have the base labels supplied to the Manager partially applied.
func (*Manager) UnregisterAll ¶
UnregisterAll unregisters all previously created metrics from prometheus.
type ManagerT ¶
type ManagerT interface { AddCounter(name, help string, labelNames []string) error AddHistogram(name, help string, labelNames []string, buckets []float64) error GetCounter(name string) (CounterT, error) GetHistogram(name string) (HistogramT, error) }
ManagerT is an interface representing a Manager (useful for mocks).
Directories ¶
Path | Synopsis |
---|---|
Package mock_metrics is a generated GoMock package.
|
Package mock_metrics is a generated GoMock package. |