summaryrefslogtreecommitdiff
path: root/internal/metrics/metrics.go
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2022-02-18 13:10:38 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2022-03-07 16:54:15 +0300
commite1ddbdd161a28ff53ca4d3b3f0fc4fa19687d80b (patch)
tree9427a8f7add05d0eece7df0c48638209bea88d8d /internal/metrics/metrics.go
parentede95ae77b591fdffab6ea1f7b1c01e4402af2e1 (diff)
downloadgitlab-shell-e1ddbdd161a28ff53ca4d3b3f0fc4fa19687d80b.tar.gz
Reuse Gitaly conns and Sidechannel
When gitlab-sshd has been introduced we've started running our own SSH server. In this case we're able to cache and reuse Gitaly connections and Registry. It helps to reduce memory usage.
Diffstat (limited to 'internal/metrics/metrics.go')
-rw-r--r--internal/metrics/metrics.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go
index c46fb8f..b328445 100644
--- a/internal/metrics/metrics.go
+++ b/internal/metrics/metrics.go
@@ -9,9 +9,10 @@ import (
)
const (
- namespace = "gitlab_shell"
- sshdSubsystem = "sshd"
- httpSubsystem = "http"
+ namespace = "gitlab_shell"
+ sshdSubsystem = "sshd"
+ httpSubsystem = "http"
+ gitalySubsystem = "gitaly"
httpInFlightRequestsMetricName = "in_flight_requests"
httpRequestsTotalMetricName = "requests_total"
@@ -20,6 +21,8 @@ const (
sshdConnectionsInFlightName = "in_flight_connections"
sshdConnectionDuration = "connection_duration_seconds"
sshdHitMaxSessions = "concurrent_limited_sessions_total"
+
+ gitalyConnectionsTotalName = "connections_total"
)
var (
@@ -61,6 +64,16 @@ var (
},
)
+ GitalyConnectionsTotal = promauto.NewCounterVec(
+ prometheus.CounterOpts{
+ Namespace: namespace,
+ Subsystem: gitalySubsystem,
+ Name: gitalyConnectionsTotalName,
+ Help: "Number of Gitaly connections that have been established",
+ },
+ []string{"status"},
+ )
+
// The metrics and the buckets size are similar to the ones we have for handlers in Labkit
// When the MR: https://gitlab.com/gitlab-org/labkit/-/merge_requests/150 is merged,
// these metrics can be refactored out of Gitlab Shell code by using the helper function from Labkit