Allow everyone to easily track storage usage
This issue is about writing a development guideline on tracking storage usage.
Although this is already possible today, there are some concerns about the performance of the current implementation as stated in #29024 (comment 221894826)
What is possible today?
With gitlab-foss!27420 (merged) tracking a ProjectStatistic
values became very easy.
- create the new column
- add it to
ProjectStatistics.INCREMENTABLE_COLUMNS
- add the following snippet to the model generating the value to track
class MyModel < ApplicationRecord
include UpdateProjectStatistics
update_project_statistics stat: :my_stat, attribute: :attribute_to_track
end
Depending on the case you may need to backfill the old data
This is blocked by gitlab-foss#62214 (closed), we need a root-namespace aggregation in place to keep stats consistent with our billing schema.
/cc @marin
Edited by Alessio Caiazza