File tree Expand file tree Collapse file tree 1 file changed +27
-20
lines changed Expand file tree Collapse file tree 1 file changed +27
-20
lines changed Original file line number Diff line number Diff line change @@ -9,32 +9,39 @@ import (
9
9
"time"
10
10
11
11
"code.gitea.io/gitea/modules/setting"
12
+
12
13
"github.com/prometheus/client_golang/prometheus"
13
14
"github.com/prometheus/client_golang/prometheus/promauto"
14
15
15
16
_ "gitea.com/go-chi/cache/memcache" //nolint:depguard // memcache plugin for cache, it is required for config "ADAPTER=memcache"
16
17
)
17
18
18
- var defaultCache StringCache
19
- var hitCounter = promauto .NewCounter (prometheus.CounterOpts {
20
- Namespace : "gitea" ,
21
- Help : "Cache hit count" ,
22
- Subsystem : "cache" ,
23
- Name : "hit" ,
24
- })
25
- var missCounter = promauto .NewCounter (prometheus.CounterOpts {
26
- Namespace : "gitea" ,
27
- Help : "Cache miss count" ,
28
- Subsystem : "cache" ,
29
- Name : "miss" ,
30
- })
31
- var latencyHistogram = promauto .NewHistogram (
32
- prometheus.HistogramOpts {
33
- Namespace : "gitea" ,
34
- Help : "Cache latency" ,
35
- Subsystem : "cache" ,
36
- Name : "duration" ,
37
- },
19
+ var (
20
+ defaultCache StringCache
21
+
22
+ // TODO: Combine hit and miss into one
23
+ hitCounter = promauto .NewCounter (prometheus.CounterOpts {
24
+ Namespace : "gitea" ,
25
+ Help : "Cache count" ,
26
+ Subsystem : "cache" ,
27
+ Name : "response" ,
28
+ ConstLabels : prometheus.Labels {"state" : "hit" },
29
+ })
30
+ missCounter = promauto .NewCounter (prometheus.CounterOpts {
31
+ Namespace : "gitea" ,
32
+ Help : "Cache count" ,
33
+ Subsystem : "cache" ,
34
+ Name : "response" ,
35
+ ConstLabels : prometheus.Labels {"state" : "miss" },
36
+ })
37
+ latencyHistogram = promauto .NewHistogram (
38
+ prometheus.HistogramOpts {
39
+ Namespace : "gitea" ,
40
+ Help : "Cache latency" ,
41
+ Subsystem : "cache" ,
42
+ Name : "duration" ,
43
+ },
44
+ )
38
45
)
39
46
40
47
// Init start cache service
You can’t perform that action at this time.
0 commit comments