Skip to content

Add more storage statistics

What does this MR do?

Display more information about used storage:

  • display total repository size for groups (admin/groups#index and admin/groups#show currently)
  • include build artifacts
  • include LFS objects
  • expose counters in API
  • update counters when creating/destroying LFS objects
  • update counters when creating/destroying CI builds
  • handle shared LFS objects (ignored for now, see this comment)
  • use .badge style after https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7873 is merged

This development is sponsored by @siemens (ping @bufferoverflow)

Are there points in the code the reviewer needs to double check?

Answered in comment below:

  • Not sure if ProjectCacheWorker is the most appropriate place to update the namespace cache, or if I should add a NamespaceCacheWorker
  • Not sure yet how I should display the other object types, it probably makes sense to store them in dedicated columns, but display a total in most places in the interface

Why was this MR needed?

  • Currently the storage information is only displayed per project, making it inconvenient to find out how much storage a whole group is using
  • The storage information is only for the bare Git repository, other things like builds and uploads are not included

Screenshots

Admin group overview, displays total storage:

Selection_001

Admin project overview, displays total storage:

Selection_002

Admin group detail, displays total and individual counters:

Selection_003

Admin project detail, displays total and individual counters:

Selection_004

User project view, displays repository size + LFS objects:

Selection_005

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Info: Updating storage counters after update

The new storage counters will be updated when necessary, to force an update for specific columns run the following in gitlab-rails console:

ProjectStatistics.includes(:project).find_each(batch_size: 100) do |stats|
  stats.refresh! only: [:build_artifacts_size, :lfs_objects_size]
end

Merge request reports