diff options
author | James Liu <jliu@gitlab.com> | 2023-11-21 02:39:50 +0300 |
---|---|---|
committer | James Liu <jliu@gitlab.com> | 2023-11-23 02:46:31 +0300 |
commit | 120b7729242338870c844c093c26cc67ad2a4831 (patch) | |
tree | 30a54cd7063c1fd16101f3e221a2c5ac213c51e0 | |
parent | 276bfb610a543a5de88a1d5f69219811dad13a6b (diff) |
backup: Add vars for server-side backup metrics
Adds Prometheus observers for backup latency and bundle size to the
backup package. These will later be used by the Manager to track metrics
as a backup progresses.
-rw-r--r-- | internal/backup/backup.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/backup/backup.go b/internal/backup/backup.go index 9f32ee22e..fa729d523 100644 --- a/internal/backup/backup.go +++ b/internal/backup/backup.go @@ -7,8 +7,11 @@ import ( "errors" "fmt" "io" + "math" "strings" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" "gitlab.com/gitlab-org/gitaly/v16/internal/git" "gitlab.com/gitlab-org/gitaly/v16/internal/git/catfile" "gitlab.com/gitlab-org/gitaly/v16/internal/git/localrepo" @@ -27,6 +30,19 @@ var ( ErrSkipped = errors.New("repository skipped") // ErrDoesntExist means that the data was not found. ErrDoesntExist = errors.New("doesn't exist") + + backupLatency = promauto.NewHistogramVec( + prometheus.HistogramOpts{ + Name: "gitaly_backup_latency_seconds", + Help: "Latency of a repository backup by phase", + }, + []string{"phase"}) + backupBundleSize = promauto.NewHistogram( + prometheus.HistogramOpts{ + Name: "gitaly_backup_bundle_bytes", + Help: "Size of a Git bundle uploaded in a backup", + Buckets: prometheus.ExponentialBucketsRange(1, 10*math.Pow(1024, 3), 20), // up to 10GB + }) ) // Sink is an abstraction over the real storage used for storing/restoring backups. |