aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/core/metrics/prometheus/gauge.go
blob: 86837555613313b422dd5ce116be9790c081aa71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package prometheus

import (
	"github.com/prometheus/client_golang/prometheus"
	"github.com/ydb-platform/ydb/library/go/core/metrics"
)

var _ metrics.Gauge = (*Gauge)(nil)

// Gauge tracks single float64 value.
type Gauge struct {
	gg prometheus.Gauge
}

func (g Gauge) Set(value float64) {
	g.gg.Set(value)
}

func (g Gauge) Add(value float64) {
	g.gg.Add(value)
}

var _ metrics.FuncGauge = (*FuncGauge)(nil)

type FuncGauge struct {
	ff       prometheus.GaugeFunc
	function func() float64
}

func (g FuncGauge) Function() func() float64 {
	return g.function
}