diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/experiments/empty_repo_upload_experiment.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/experiments/empty_repo_upload_experiment.rb')
-rw-r--r-- | app/experiments/empty_repo_upload_experiment.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/experiments/empty_repo_upload_experiment.rb b/app/experiments/empty_repo_upload_experiment.rb new file mode 100644 index 00000000000..d0d79a5fb45 --- /dev/null +++ b/app/experiments/empty_repo_upload_experiment.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class EmptyRepoUploadExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass + include ProjectCommitCount + + TRACKING_START_DATE = DateTime.parse('2021/4/20') + INITIAL_COMMIT_COUNT = 1 + + def track_initial_write + return unless should_track? # early return if we don't need to ask for commit counts + return unless context.project.created_at > TRACKING_START_DATE # early return for older projects + return unless commit_count == INITIAL_COMMIT_COUNT + + track(:initial_write, project: context.project) + end + + private + + def commit_count + commit_count_for(context.project, max_count: INITIAL_COMMIT_COUNT, experiment: name) + end +end |