Documentation ¶
Index ¶
- Constants
- type Counter
- type CounterVec
- type DurationHistogramVec
- type FuncCounter
- type FuncGauge
- type FuncIntGauge
- type Gauge
- type GaugeVec
- type Histogram
- type HistogramVec
- type IntGauge
- type IntGaugeVec
- type PrometheusRegistry
- type Registry
- func (r Registry) ComposeName(parts ...string) string
- func (r Registry) Counter(name string) metrics.Counter
- func (r *Registry) CounterVec(name string, labels []string) metrics.CounterVec
- func (r Registry) DurationHistogram(name string, buckets metrics.DurationBuckets) metrics.Timer
- func (r *Registry) DurationHistogramVec(name string, buckets metrics.DurationBuckets, labels []string) metrics.TimerVec
- func (r Registry) FuncCounter(name string, function func() int64) metrics.FuncCounter
- func (r Registry) FuncGauge(name string, function func() float64) metrics.FuncGauge
- func (r Registry) FuncIntGauge(name string, function func() int64) metrics.FuncIntGauge
- func (r Registry) Gather() ([]*dto.MetricFamily, error)
- func (r Registry) Gauge(name string) metrics.Gauge
- func (r *Registry) GaugeVec(name string, labels []string) metrics.GaugeVec
- func (r Registry) Histogram(name string, buckets metrics.Buckets) metrics.Histogram
- func (r *Registry) HistogramVec(name string, buckets metrics.Buckets, labels []string) metrics.HistogramVec
- func (r Registry) IntGauge(name string) metrics.IntGauge
- func (r *Registry) IntGaugeVec(name string, labels []string) metrics.IntGaugeVec
- func (r *Registry) Stream(_ context.Context, w io.Writer) (int, error)
- func (r Registry) Timer(name string) metrics.Timer
- func (r *Registry) TimerVec(name string, labels []string) metrics.TimerVec
- func (r Registry) WithPrefix(prefix string) metrics.Registry
- func (r Registry) WithTags(tags map[string]string) metrics.Registry
- type RegistryOpts
- func (o *RegistryOpts) AddCollectors(ctx context.Context, c metrics.CollectPolicy, collectors ...collect.Func) *RegistryOpts
- func (o *RegistryOpts) AddTags(tags map[string]string) *RegistryOpts
- func (o *RegistryOpts) AppendPrefix(prefix string) *RegistryOpts
- func (o *RegistryOpts) SetNameSanitizer(v func(string) string) *RegistryOpts
- func (o *RegistryOpts) SetPrefix(prefix string) *RegistryOpts
- func (o *RegistryOpts) SetRegistry(rg PrometheusRegistry) *RegistryOpts
- func (o *RegistryOpts) SetStreamFormat(format expfmt.Format) *RegistryOpts
- func (o *RegistryOpts) SetTags(tags map[string]string) *RegistryOpts
- type Timer
- type TimerVec
Constants ¶
const ( StreamText expfmt.Format = expfmt.FmtText StreamCompact expfmt.Format = expfmt.FmtProtoCompact )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter tracks monotonically increasing value.
type CounterVec ¶
type CounterVec struct {
// contains filtered or unexported fields
}
CounterVec wraps prometheus.CounterVec and implements metrics.CounterVec interface.
type DurationHistogramVec ¶
type DurationHistogramVec struct {
// contains filtered or unexported fields
}
DurationHistogramVec wraps prometheus.HistogramVec and implements metrics.TimerVec interface.
func (*DurationHistogramVec) Reset ¶
func (v *DurationHistogramVec) Reset()
Reset deletes all metrics in this vector.
type FuncCounter ¶
type FuncCounter struct {
// contains filtered or unexported fields
}
func (FuncCounter) Function ¶
func (c FuncCounter) Function() func() int64
type FuncIntGauge ¶
type FuncIntGauge struct {
// contains filtered or unexported fields
}
func (FuncIntGauge) Function ¶
func (g FuncIntGauge) Function() func() int64
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge tracks single float64 value.
type GaugeVec ¶
type GaugeVec struct {
// contains filtered or unexported fields
}
GaugeVec wraps prometheus.GaugeVec and implements metrics.GaugeVec interface.
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
func (Histogram) RecordDuration ¶
func (Histogram) RecordValue ¶
type HistogramVec ¶
type HistogramVec struct {
// contains filtered or unexported fields
}
HistogramVec wraps prometheus.HistogramVec and implements metrics.HistogramVec interface.
func (*HistogramVec) Reset ¶
func (v *HistogramVec) Reset()
Reset deletes all metrics in this vector.
type IntGaugeVec ¶
type IntGaugeVec struct {
// contains filtered or unexported fields
}
IntGaugeVec wraps prometheus.GaugeVec and implements metrics.IntGaugeVec interface.
type PrometheusRegistry ¶
type PrometheusRegistry interface { prometheus.Registerer prometheus.Gatherer }
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(opts *RegistryOpts) *Registry
NewRegistry creates new Prometheus backed registry.
func (Registry) ComposeName ¶
ComposeName builds FQ name with appropriate separator.
func (*Registry) CounterVec ¶
func (r *Registry) CounterVec(name string, labels []string) metrics.CounterVec
CounterVec creates a new counters vector with given metric name and partitioned by the given label names.
func (Registry) DurationHistogram ¶
func (*Registry) DurationHistogramVec ¶
func (r *Registry) DurationHistogramVec(name string, buckets metrics.DurationBuckets, labels []string) metrics.TimerVec
DurationHistogramVec creates a new duration histograms vector with given metric name and buckets and partitioned by the given label names.
func (Registry) FuncCounter ¶
func (r Registry) FuncCounter(name string, function func() int64) metrics.FuncCounter
func (Registry) FuncIntGauge ¶
func (r Registry) FuncIntGauge(name string, function func() int64) metrics.FuncIntGauge
func (Registry) Gather ¶
func (r Registry) Gather() ([]*dto.MetricFamily, error)
Gather returns raw collected Prometheus metrics.
func (*Registry) GaugeVec ¶
GaugeVec creates a new gauges vector with given metric name and partitioned by the given label names.
func (*Registry) HistogramVec ¶
func (r *Registry) HistogramVec(name string, buckets metrics.Buckets, labels []string) metrics.HistogramVec
HistogramVec creates a new histograms vector with given metric name and buckets and partitioned by the given label names.
func (*Registry) IntGaugeVec ¶
func (r *Registry) IntGaugeVec(name string, labels []string) metrics.IntGaugeVec
IntGaugeVec creates a new gauges vector with given metric name and partitioned by the given label names.
func (*Registry) TimerVec ¶
TimerVec creates a new timers vector with given metric name and partitioned by the given label names.
func (Registry) WithPrefix ¶
WithPrefix creates new sub-scope, where each metric has prefix added to it name.
type RegistryOpts ¶
type RegistryOpts struct { Prefix string Tags map[string]string Collectors []func(metrics.Registry) NameSanitizer func(string) string StreamFormat expfmt.Format // contains filtered or unexported fields }
func NewRegistryOpts ¶
func NewRegistryOpts() *RegistryOpts
NewRegistryOpts returns new initialized instance of RegistryOpts.
func (*RegistryOpts) AddCollectors ¶
func (o *RegistryOpts) AddCollectors( ctx context.Context, c metrics.CollectPolicy, collectors ...collect.Func, ) *RegistryOpts
AddCollectors adds collectors that handle their metrics automatically (e.g. system metrics).
func (*RegistryOpts) AddTags ¶
func (o *RegistryOpts) AddTags(tags map[string]string) *RegistryOpts
AddTags merges given tags with existing.
func (*RegistryOpts) AppendPrefix ¶
func (o *RegistryOpts) AppendPrefix(prefix string) *RegistryOpts
AppendPrefix adds given prefix as postfix to existing using separator.
func (*RegistryOpts) SetNameSanitizer ¶
func (o *RegistryOpts) SetNameSanitizer(v func(string) string) *RegistryOpts
SetNameSanitizer sets a functions which will be called for each metric's name. It allows to alter names, for example to replace invalid characters
func (*RegistryOpts) SetPrefix ¶
func (o *RegistryOpts) SetPrefix(prefix string) *RegistryOpts
SetPrefix overrides existing prefix.
func (*RegistryOpts) SetRegistry ¶
func (o *RegistryOpts) SetRegistry(rg PrometheusRegistry) *RegistryOpts
SetRegistry sets the given prometheus registry for further usage instead of creating a new one.
This is primarily used to unite externally defined metrics with metrics kept in the core registry.
func (*RegistryOpts) SetStreamFormat ¶
func (o *RegistryOpts) SetStreamFormat(format expfmt.Format) *RegistryOpts
SetStreamFormat sets default metrics stream format
func (*RegistryOpts) SetTags ¶
func (o *RegistryOpts) SetTags(tags map[string]string) *RegistryOpts
SetTags overrides existing tags.
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer measures gauge duration.