|
|
@ -16,8 +16,12 @@ type (
|
|
|
|
Set(v float64, labels ...string)
|
|
|
|
Set(v float64, labels ...string)
|
|
|
|
// Inc increments labels.
|
|
|
|
// Inc increments labels.
|
|
|
|
Inc(labels ...string)
|
|
|
|
Inc(labels ...string)
|
|
|
|
|
|
|
|
// Dec decrements labels.
|
|
|
|
|
|
|
|
Dec(labels ...string)
|
|
|
|
// Add adds v to labels.
|
|
|
|
// Add adds v to labels.
|
|
|
|
Add(v float64, labels ...string)
|
|
|
|
Add(v float64, labels ...string)
|
|
|
|
|
|
|
|
// Sub subtracts v to labels.
|
|
|
|
|
|
|
|
Sub(v float64, labels ...string)
|
|
|
|
close() bool
|
|
|
|
close() bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -50,6 +54,14 @@ func NewGaugeVec(cfg *GaugeVecOpts) GaugeVec {
|
|
|
|
return gv
|
|
|
|
return gv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (gv *promGaugeVec) Set(v float64, labels ...string) {
|
|
|
|
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gv.gauge.WithLabelValues(labels...).Set(v)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (gv *promGaugeVec) Inc(labels ...string) {
|
|
|
|
func (gv *promGaugeVec) Inc(labels ...string) {
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -58,6 +70,13 @@ func (gv *promGaugeVec) Inc(labels ...string) {
|
|
|
|
gv.gauge.WithLabelValues(labels...).Inc()
|
|
|
|
gv.gauge.WithLabelValues(labels...).Inc()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (gv *promGaugeVec) Dec(labels ...string) {
|
|
|
|
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gv.gauge.WithLabelValues(labels...).Dec()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (gv *promGaugeVec) Add(v float64, labels ...string) {
|
|
|
|
func (gv *promGaugeVec) Add(v float64, labels ...string) {
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -66,12 +85,11 @@ func (gv *promGaugeVec) Add(v float64, labels ...string) {
|
|
|
|
gv.gauge.WithLabelValues(labels...).Add(v)
|
|
|
|
gv.gauge.WithLabelValues(labels...).Add(v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (gv *promGaugeVec) Set(v float64, labels ...string) {
|
|
|
|
func (gv *promGaugeVec) Sub(v float64, labels ...string) {
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
if !prometheus.Enabled() {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gv.gauge.WithLabelValues(labels...).Sub(v)
|
|
|
|
gv.gauge.WithLabelValues(labels...).Set(v)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (gv *promGaugeVec) close() bool {
|
|
|
|
func (gv *promGaugeVec) close() bool {
|
|
|
|