Improve increments of `project_daily_statistics`
Problem
In https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/team/-/issues/2856#note_1561104319 we noticed that incrementing project_daily_statistics.fetch_count
can be very slow.
Idea
As per conversation in https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/team/-/issues/2856#note_1562023242 today we have CounterAttribute
module we could possibly use to buffer updates using Redis and flushing them to the database periodically.
You can see CounterAttribute
being used with project_statistics
table: https://gitlab.com/gitlab-org/gitlab/-/blob/64e8b2745649da2f23fdf3e997c97a4a318506f9/app/models/project_statistics.rb#L13-20