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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-14 17:52:38 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-15 11:24:20 +0300
commit423ec9e7f1dfa7bc9b7384d4b980df04a550484b (patch)
tree59ead0b0f94a78ba3c5d0788bdbbeedc7e0230a8
parenta8d36fc380ad872d74d7c2a4f80fdf69e6395e0f (diff)
housekeeping: Generalize counter for pruned empty directories
We expose a Prometheus counter that is counting how many empty directories we have pruned. This is a broader concept in our housekeeping code, where we also prune other kinds of stale files. Generalize the counter into a counter vector such that we can reuse the same counter for all the different types of data we prune. While this breaks the metric in case it was used anywhere, there are no references to this counter across the complete GitLab group. Furthermore, we haven't ever guaranteed backwards compatibility for metrics anyway. Changelog: changed
-rw-r--r--internal/git/housekeeping/clean_stale_data.go2
-rw-r--r--internal/git/housekeeping/manager.go15
2 files changed, 9 insertions, 8 deletions
diff --git a/internal/git/housekeeping/clean_stale_data.go b/internal/git/housekeeping/clean_stale_data.go
index 802230927..42efc60f2 100644
--- a/internal/git/housekeeping/clean_stale_data.go
+++ b/internal/git/housekeeping/clean_stale_data.go
@@ -83,7 +83,7 @@ func (m *RepositoryManager) CleanStaleData(ctx context.Context, repo *localrepo.
}
prunedRefDirs, err := removeRefEmptyDirs(ctx, repo)
- m.optimizeEmptyDirRemovalTotal.Add(float64(prunedRefDirs))
+ m.prunedFilesTotal.WithLabelValues("refsemptydir").Add(float64(prunedRefDirs))
if err != nil {
return fmt.Errorf("housekeeping could not remove empty refs: %w", err)
}
diff --git a/internal/git/housekeeping/manager.go b/internal/git/housekeeping/manager.go
index 68deb69da..859d7091e 100644
--- a/internal/git/housekeeping/manager.go
+++ b/internal/git/housekeeping/manager.go
@@ -22,9 +22,9 @@ type Manager interface {
type RepositoryManager struct {
txManager transaction.Manager
- tasksTotal *prometheus.CounterVec
- tasksLatency *prometheus.HistogramVec
- optimizeEmptyDirRemovalTotal prometheus.Counter
+ tasksTotal *prometheus.CounterVec
+ tasksLatency *prometheus.HistogramVec
+ prunedFilesTotal *prometheus.CounterVec
}
// NewManager creates a new RepositoryManager.
@@ -46,11 +46,12 @@ func NewManager(txManager transaction.Manager) *RepositoryManager {
},
[]string{"housekeeping_task"},
),
- optimizeEmptyDirRemovalTotal: prometheus.NewCounter(
+ prunedFilesTotal: prometheus.NewCounterVec(
prometheus.CounterOpts{
- Name: "gitaly_repository_optimizerepository_empty_dir_removal_total",
- Help: "Total number of empty directories removed by OptimizeRepository RPC",
+ Name: "gitaly_housekeeping_pruned_files_total",
+ Help: "Total number of files pruned",
},
+ []string{"filetype"},
),
}
}
@@ -64,5 +65,5 @@ func (m *RepositoryManager) Describe(descs chan<- *prometheus.Desc) {
func (m *RepositoryManager) Collect(metrics chan<- prometheus.Metric) {
m.tasksTotal.Collect(metrics)
m.tasksLatency.Collect(metrics)
- m.optimizeEmptyDirRemovalTotal.Collect(metrics)
+ m.prunedFilesTotal.Collect(metrics)
}