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>2023-01-27 11:25:59 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-01-27 11:25:59 +0300
commitf349198bec8c1150ccc9548fd0c41078de479a97 (patch)
tree785e9559a50de0429e3e0ee43233a4b40ffd0f98
parent51b5517988b62548345bf97d210df75266132006 (diff)
housekeeping: Also report inverse metric for data structure existence
When reporting whether a data structure exists or not via a Prometheus counter we increase the counter for the corresponding "exists" label. But if no repository ever reports the metric with the inverse value then clients will never see that line. This makes it harder than necessary to properly use these metrics e.g. in Grafana. Improve this by also reporting the inverse label, even though we don't increase the counter there.
-rw-r--r--internal/git/housekeeping/optimize_repository.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/git/housekeeping/optimize_repository.go b/internal/git/housekeeping/optimize_repository.go
index 74f70d1b5..1238e74f7 100644
--- a/internal/git/housekeeping/optimize_repository.go
+++ b/internal/git/housekeeping/optimize_repository.go
@@ -101,6 +101,8 @@ func (m *RepositoryManager) reportRepositoryInfo(ctx context.Context, info stats
func (m *RepositoryManager) reportDataStructureExistence(dataStructure string, exists bool) {
m.dataStructureExistence.WithLabelValues(dataStructure, strconv.FormatBool(exists)).Inc()
+ // We also report the inverse metric so that it will be visible to clients.
+ m.dataStructureExistence.WithLabelValues(dataStructure, strconv.FormatBool(!exists)).Add(0)
}
func (m *RepositoryManager) reportDataStructureCount(dataStructure string, count uint64) {