Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 10:08:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 10:08:36 +0300
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /db/fixtures
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/development/29_instance_statistics.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/db/fixtures/development/29_instance_statistics.rb b/db/fixtures/development/29_instance_statistics.rb
index c4af13d0f4d..02afdc61339 100644
--- a/db/fixtures/development/29_instance_statistics.rb
+++ b/db/fixtures/development/29_instance_statistics.rb
@@ -3,17 +3,31 @@
require './spec/support/sidekiq_middleware'
Gitlab::Seeder.quiet do
+ chance_for_decrement = 0.1 # 10% chance that we'll generate smaller count than the previous count
+ max_increase = 10000
+ max_decrease = 1000
+
model_class = Analytics::InstanceStatistics::Measurement
- recorded_at = Date.today
- # Insert random counts for the last 10 weeks
- measurements = 10.times.flat_map do
- recorded_at = (recorded_at - 1.week).end_of_week.end_of_day - 5.minutes
+ measurements = model_class.identifiers.flat_map do |_, id|
+ recorded_at = 60.days.ago
+ current_count = rand(1_000_000)
+
+ # Insert random counts for the last 60 days
+ Array.new(60) do
+ recorded_at = (recorded_at + 1.day).end_of_day - 5.minutes
+
+ # Normally our counts should slowly increase as the gitlab instance grows.
+ # Small chance (10%) to have a slight decrease (simulating cleanups, bulk delete)
+ if rand < chance_for_decrement
+ current_count -= rand(max_decrease)
+ else
+ current_count += rand(max_increase)
+ end
- model_class.identifiers.map do |_, id|
{
recorded_at: recorded_at,
- count: rand(1_000_000),
+ count: current_count,
identifier: id
}
end