Documentation
¶
Overview ¶
Package collector manages a metric collection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collector ¶
type Collector interface {
fmt.Stringer
// AddCounter adds a counter to the list of metrics to return.
AddCounter(name string, help string) error
// AddGauge adds a gauge to the list of metrics to return.
AddGauge(name string, help string) error
// Collect retrieves the values for all the metrics defined.
Collect(ctx context.Context, conn database.Connection) error
// GetFrequency returns how often the collector is called, in seconds.
GetFrequency() int
// GetLastModified retrieve the last time the job was modified.
GetLastModified() time.Time
// Unregister all the prometheus collectors.
Unregister()
// WithFrequency sets the frequency
WithFrequency(frequency int) Collector
// WithMaxResults sets the maximum number of results to collect each time Collect is called.
WithMaxResults(max int) Collector
}
A Collector retrieves all the metric values for all the gauges and counters configured.
func FromCollection ¶
func FromCollection(coll *store.Collection, registerer prometheus.Registerer) (Collector, error)
FromCollection creates a collector from a collection configuration stored in the database.
type MetricKind ¶
type MetricKind int
MetricKind specify the type of the metric: counter or gauge.
const ( // Undefined is for metrics not currently supported. Undefined MetricKind = iota // Counter is a cumulative metric that represents a single monotonically increasing value. Counter // Gauge is a metric that represents a single numerical value that can arbitrarily go up and down. Gauge )
func (MetricKind) String ¶ added in v0.0.1
func (i MetricKind) String() string
Click to show internal directories.
Click to hide internal directories.