aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/core/metrics/prometheus/int_gauge.go
blob: 813b87828c31206545bdad9fbde4a28e8d8d246a (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.IntGauge = (*IntGauge)(nil)

// IntGauge tracks single int64 value.
type IntGauge struct {
	metrics.Gauge
}

func (i IntGauge) Set(value int64) {
	i.Gauge.Set(float64(value))
}

func (i IntGauge) Add(value int64) {
	i.Gauge.Add(float64(value))
}

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

type FuncIntGauge struct {
	ff       prometheus.GaugeFunc
	function func() int64
}

func (g FuncIntGauge) Function() func() int64 {
	return g.function
}