Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain interface {
// Gauge initialize with initName a gauge chain and return it.
Gauge(initName string, f func() float64) GaugeChain
// Counter initialize with initName a counter chain and return it.
Counter(initName string) CounterChain
// FloatCounter initialize with initName a float counter chain and return it.
FloatCounter(initName string) FloatCounterChain
// Histogram initialize with initName a histogram chain and return it.
Histogram(initName string) HistogramChain
}
Chain represents a set for chains of metrics.
type CounterChain ¶
type CounterChain interface {
WithLabel(name, value string) CounterChain
WithAnyLabel(name string, value any) CounterChain
Add(value int)
AddInt64(value int64)
Set(value uint64)
Inc()
Get() uint64
Dec()
}
func Counter ¶
func Counter(initName string) CounterChain
Counter return existing or create and return new counter metric.
initName is a base name of a metric (without any labels). It must be valid Prometheus-compatible name. Labels can be added separately using WithLabel chain method:
vmchain.Counter("my_counter_metric_name"). // prepare and return metric with name "my_counter_metric_name"
WithLabel("stage", "area"). // add a label, so metric name became "my_counter_metric_name{stage="area"}
WithLabel("userID", "123). // add a label, so metric name became "my_counter_metric_name{stage="area",userID="123"}
Inc() // finally construct full name of underlying counter metric, register it if necessary,
// and call method Inc.
type FloatCounterChain ¶
type FloatCounterChain interface {
WithLabel(name, value string) FloatCounterChain
WithAnyLabel(name string, value any) FloatCounterChain
Add(value float64)
Sub(value float64)
Set(value float64)
Get() float64
}
func FloatCounter ¶
func FloatCounter(initName string) FloatCounterChain
FloatCounter return existing or create and return new float counter metric.
initName is a base name of a metric (without any labels). It must be valid Prometheus-compatible name. Labels can be added separately using WithLabel chain method:
vmchain.Counter("my_fcounter_metric_name"). // prepare and return metric with name "my_fcounter_metric_name"
WithLabel("stage", "area"). // add a label, so metric name became "my_counter_metric_name{stage="area"}
WithLabel("userID", "123). // add a label, so metric name became "my_counter_metric_name{stage="area",userID="123"}
Inc() // finally construct full name of underlying counter metric, register it if necessary,
// and call method Inc.
type GaugeChain ¶
type GaugeChain interface {
WithLabel(name, value string) GaugeChain
WithAnyLabel(name string, value any) GaugeChain
Add(value float64)
Set(value float64)
Inc()
Get() float64
Dec()
}
func Gauge ¶
func Gauge(initName string, f func() float64) GaugeChain
Gauge return existing or create and return new gauge metric.
initName is a base name of a metric (without any labels). It must be valid Prometheus-compatible name. Labels can be added separately using WithLabel chain method:
vmchain.Gauge("my_gauge_metric_name"). // prepare and return metric with name "my_gauge_metric_name"
WithLabel("stage", "area"). // add a label, so metric name became "my_gauge_metric_name{stage="area"}
WithLabel("userID", "123). // add a label, so metric name became "my_gauge_metric_name{stage="area",userID="123"}
Inc() // finally construct full name of underlying gauge metric, register it if necessary,
// and call method Inc.
type HistogramChain ¶
type HistogramChain interface {
WithLabel(name, value string) HistogramChain
WithAnyLabel(name string, value any) HistogramChain
Update(value float64)
UpdateDuration(startTime time.Time)
VisitNonZeroBuckets(f func(vmrange string, count uint64))
Reset()
}
func Histogram ¶
func Histogram(initName string) HistogramChain
Histogram return existing or create and return new histogram metric.
initName is a base name of a metric (without any labels). It must be valid Prometheus-compatible name. Labels can be added separately using WithLabel chain method:
vmchain.Histogram("my_histogram_metric_name"). // prepare and return metric with name "my_histogram_metric_name"
WithLabel("stage", "area"). // add a label, so metric name became "my_histogram_metric_name{stage="area"}
WithLabel("userID", "123). // add a label, so metric name became "my_histogram_metric_name{stage="area",userID="123"}
Inc() // finally construct full name of underlying gauge metric, register it if necessary,
// and call method Inc.