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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
package cache
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
requestTotals = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_requests_total",
Help: "Total number of disk cache requests",
},
)
missTotals = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_miss_total",
Help: "Total number of disk cache misses",
},
)
bytesStoredtotals = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_bytes_stored_total",
Help: "Total number of disk cache bytes stored",
},
)
bytesFetchedtotals = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_bytes_fetched_total",
Help: "Total number of disk cache bytes fetched",
},
)
bytesLoserTotals = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_bytes_loser_total",
Help: "Total number of disk cache bytes from losing writes",
},
)
errTotal = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "gitaly_diskcache_errors_total",
Help: "Total number of errors encountered by disk cache",
},
[]string{"error"},
)
walkerCheckTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_walker_check_total",
Help: "Total number of events during diskcache filesystem walks",
},
)
walkerRemovalTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_walker_removal_total",
Help: "Total number of events during diskcache filesystem walks",
},
)
walkerErrorTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_walker_error_total",
Help: "Total number of errors during diskcache filesystem walks",
},
)
walkerEmptyDirTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_walker_empty_dir_total",
Help: "Total number of empty directories encountered",
},
)
walkerEmptyDirRemovalTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_diskcache_walker_empty_dir_removal_total",
Help: "Total number of empty directories removed",
},
)
)
func countErr(err error) error {
switch err {
case ErrMissingLeaseFile:
errTotal.WithLabelValues("ErrMissingLeaseFile").Inc()
case ErrPendingExists:
errTotal.WithLabelValues("ErrPendingExists").Inc()
}
return err
}
var (
countRequest = func() { requestTotals.Inc() }
countMiss = func() { missTotals.Inc() }
countWriteBytes = func(n float64) { bytesStoredtotals.Add(n) }
countReadBytes = func(n float64) { bytesFetchedtotals.Add(n) }
countLoserBytes = func(n float64) { bytesLoserTotals.Add(n) }
countWalkRemoval = func() { walkerRemovalTotal.Inc() }
countWalkCheck = func() { walkerCheckTotal.Inc() }
countWalkError = func() { walkerErrorTotal.Inc() }
countEmptyDir = func() { walkerEmptyDirTotal.Inc() }
countEmptyDirRemoval = func() { walkerEmptyDirRemovalTotal.Inc() }
)
|