diff options
author | Will Chandler <wchandler@gitlab.com> | 2023-07-27 16:05:27 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2023-07-28 20:39:08 +0300 |
commit | d6615e048843869771ac3da934e0ee54d289adb2 (patch) | |
tree | 3b411bbc993b5debacf8902be547c4174a904955 /internal/cli/gitaly/serve.go | |
parent | 9374616416692d67ccf342d060d7bfec1800fc01 (diff) |
counter: Wire up RepositoryCounter to repoutil
All repository creation and removal is done via `repoutil`, so
hooking `RepositoryCounter` in here will allow us to track changes
without dealing with the idiosyncracies of the many RPCs that may
create repositories.
Add a `RepositoryCounter` as a parameter to the `repoutil.Create` and
`repoutil.Remove` functions and wire it up to necessary services.
The exception to this is the `RemoveAll` RPC which deletes an entire
storage, we use the counter directly here.
Diffstat (limited to 'internal/cli/gitaly/serve.go')
-rw-r--r-- | internal/cli/gitaly/serve.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/cli/gitaly/serve.go b/internal/cli/gitaly/serve.go index d89d3d7ba..890195750 100644 --- a/internal/cli/gitaly/serve.go +++ b/internal/cli/gitaly/serve.go @@ -33,6 +33,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/setup" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" + "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/counter" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v16/internal/gitlab" "gitlab.com/gitlab-org/gitaly/v16/internal/grpc/backchannel" @@ -222,6 +223,9 @@ func run(cfg config.Cfg) error { locator := config.NewLocator(cfg) + repoCounter := counter.NewRepositoryCounter() + prometheus.MustRegister(repoCounter) + tempdir.StartCleaning(locator, cfg.Storages, time.Hour) prometheus.MustRegister(gitCmdFactory) @@ -356,6 +360,7 @@ func run(cfg config.Cfg) error { DiskCache: diskCache, PackObjectsCache: streamCache, PackObjectsLimiter: packObjectsLimiter, + RepositoryCounter: repoCounter, Git2goExecutor: git2goExecutor, UpdaterWithHooks: updaterWithHooks, HousekeepingManager: housekeepingManager, |