blob: c3016ea1a9a09c04c5c57a2000b31d47d51ab856 (
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
34
35
|
package mock
import (
"github.com/ydb-platform/ydb/library/go/core/metrics"
"go.uber.org/atomic"
)
var _ metrics.Counter = (*Counter)(nil)
// Counter tracks monotonically increasing value.
type Counter struct {
Name string
Tags map[string]string
Value *atomic.Int64
}
// Inc increments counter by 1.
func (c *Counter) Inc() {
c.Add(1)
}
// Add adds delta to the counter. Delta must be >=0.
func (c *Counter) Add(delta int64) {
c.Value.Add(delta)
}
var _ metrics.FuncCounter = (*FuncCounter)(nil)
type FuncCounter struct {
function func() int64
}
func (c FuncCounter) Function() func() int64 {
return c.function
}
|