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
|
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
promconfig "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config/prometheus"
"gitlab.com/gitlab-org/gitaly/v14/internal/prometheus/metrics"
)
// RegisterReplicationDelay creates and registers a prometheus histogram
// to observe replication delay times
func RegisterReplicationDelay(conf promconfig.Config) (metrics.HistogramVec, error) {
replicationDelay := prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "replication_delay",
Buckets: conf.GRPCLatencyBuckets,
},
[]string{"type"},
)
return replicationDelay, prometheus.Register(replicationDelay)
}
// RegisterReplicationLatency creates and registers a prometheus histogram
// to observe replication latency times
func RegisterReplicationLatency(conf promconfig.Config) (metrics.HistogramVec, error) {
replicationLatency := prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "replication_latency",
Buckets: conf.GRPCLatencyBuckets,
},
[]string{"type"},
)
return replicationLatency, prometheus.Register(replicationLatency)
}
// RegisterNodeLatency creates and registers a prometheus histogram to
// observe internal node latency
func RegisterNodeLatency(conf promconfig.Config) (metrics.HistogramVec, error) {
nodeLatency := prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "node_latency",
Buckets: conf.GRPCLatencyBuckets,
}, []string{"gitaly_storage"},
)
return nodeLatency, prometheus.Register(nodeLatency)
}
var MethodTypeCounter = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "method_types",
}, []string{"method_type"},
)
var PrimaryGauge = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "primaries",
}, []string{"virtual_storage", "gitaly_storage"},
)
var NodeLastHealthcheckGauge = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "node_last_healthcheck_up",
}, []string{"gitaly_storage"},
)
var ChecksumMismatchCounter = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "checksum_mismatch_total",
}, []string{"target", "source"},
)
// ReadDistribution counts how many read operations was routed to each storage.
var ReadDistribution = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: "gitaly",
Subsystem: "praefect",
Name: "read_distribution",
Help: "Counts read operations directed to the storages",
},
[]string{"virtual_storage", "storage"},
)
|