Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2020-04-10 01:55:16 +0300
committerPaul Okstad <pokstad@gitlab.com>2020-04-10 01:55:16 +0300
commit3fd68cb778b5a43c23072b345bf0a27b60b64af6 (patch)
tree315c15dead31c427618606c7630ef7f5f7fcbcc3
parented0edf396da0d62aeec607ee4988e19bec36ea30 (diff)
parentccb6a976216e0e4da50b9cc3b3c6e91c11eec6fc (diff)
Merge branch 'jc-add-metric-for-node-health' into 'master'
Adding metrics to track which nodes are up and down Closes #2622 See merge request gitlab-org/gitaly!2019
-rw-r--r--changelogs/unreleased/jc-add-metric-for-node-health.yml5
-rw-r--r--internal/praefect/metrics/prometheus.go9
-rw-r--r--internal/praefect/nodes/manager.go7
3 files changed, 21 insertions, 0 deletions
diff --git a/changelogs/unreleased/jc-add-metric-for-node-health.yml b/changelogs/unreleased/jc-add-metric-for-node-health.yml
new file mode 100644
index 000000000..e3173e7ae
--- /dev/null
+++ b/changelogs/unreleased/jc-add-metric-for-node-health.yml
@@ -0,0 +1,5 @@
+---
+title: Adding metrics to track which nodes are up and down
+merge_request: 2019
+author:
+type: added
diff --git a/internal/praefect/metrics/prometheus.go b/internal/praefect/metrics/prometheus.go
index 19cb24eb9..48ac91708 100644
--- a/internal/praefect/metrics/prometheus.go
+++ b/internal/praefect/metrics/prometheus.go
@@ -82,6 +82,14 @@ var PrimaryGauge = prometheus.NewGaugeVec(
}, []string{"virtual_storage", "gitaly_storage"},
)
+var NodeLastHealthcheckGauge = prometheus.NewGaugeVec(
+ prometheus.GaugeOpts{
+ Namespace: "gitaly",
+ Subsystem: "praefect",
+ Name: "node_last_healthcheck_up",
+ }, []string{"gitaly_storage"},
+)
+
var ChecksumMismatchCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "gitaly",
@@ -95,5 +103,6 @@ func init() {
MethodTypeCounter,
PrimaryGauge,
ChecksumMismatchCounter,
+ NodeLastHealthcheckGauge,
)
}
diff --git a/internal/praefect/nodes/manager.go b/internal/praefect/nodes/manager.go
index a90a0b080..a1fc8ac15 100644
--- a/internal/praefect/nodes/manager.go
+++ b/internal/praefect/nodes/manager.go
@@ -13,6 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/client"
"gitlab.com/gitlab-org/gitaly/internal/praefect/config"
"gitlab.com/gitlab-org/gitaly/internal/praefect/grpc-proxy/proxy"
+ "gitlab.com/gitlab-org/gitaly/internal/praefect/metrics"
"gitlab.com/gitlab-org/gitaly/internal/praefect/models"
prommetrics "gitlab.com/gitlab-org/gitaly/internal/prometheus/metrics"
correlation "gitlab.com/gitlab-org/labkit/correlation/grpc"
@@ -213,5 +214,11 @@ func (n *nodeStatus) check(ctx context.Context) (bool, error) {
}).Warn("error when pinging healthcheck")
}
+ var gaugeValue float64
+ if status {
+ gaugeValue = 1
+ }
+ metrics.NodeLastHealthcheckGauge.WithLabelValues(n.GetStorage()).Set(gaugeValue)
+
return status, err
}