blob: 58d2d29bebdf9a01ca7a3e08c36506d6e5fd5eae (
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
33
|
package mock
import (
"github.com/ydb-platform/ydb/library/go/core/metrics"
"go.uber.org/atomic"
)
var _ metrics.Gauge = (*Gauge)(nil)
// Gauge tracks single float64 value.
type Gauge struct {
Name string
Tags map[string]string
Value *atomic.Float64
}
func (g *Gauge) Set(value float64) {
g.Value.Store(value)
}
func (g *Gauge) Add(value float64) {
g.Value.Add(value)
}
var _ metrics.FuncGauge = (*FuncGauge)(nil)
type FuncGauge struct {
function func() float64
}
func (g FuncGauge) Function() func() float64 {
return g.function
}
|