diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-06-15 12:50:45 +0200 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-06-27 09:39:05 +0200 |
commit | e7d12a70d283b766cbcd4f417c293f34df10de3b (patch) | |
tree | a577fe25f2faee5486cdb86ad3878f618dc6b726 | |
parent | 6f5a68f528d6c11f3bfd013e30cc71845abe6ef8 (diff) | |
download | gitlab-ce-e7d12a70d283b766cbcd4f417c293f34df10de3b.tar.gz |
Add in_review_folder to usage pingzj-review-apps-usage-data
As its hard to reliably check how many review apps there are on the
clients machine, we start by checking where the type is `review`. This
means the folder is called that way. This will lead to a seq
scan on the table. However, this is done once a week, so the benefit of
adding an index seems not to apply here.
-rw-r--r-- | app/models/environment.rb | 1 | ||||
-rw-r--r-- | changelogs/unreleased/zj-review-apps-usage-data.yml | 4 | ||||
-rw-r--r-- | lib/gitlab/usage_data.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb index 6211a5c1e63..c56e4bdb989 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -45,6 +45,7 @@ class Environment < ActiveRecord::Base to_sql order(Gitlab::Database.nulls_first_order("(#{max_deployment_id_sql})", 'ASC')) end + scope :in_review_folder, -> { where(environment_type: "review") } state_machine :state, initial: :available do event :start do diff --git a/changelogs/unreleased/zj-review-apps-usage-data.yml b/changelogs/unreleased/zj-review-apps-usage-data.yml new file mode 100644 index 00000000000..7d224d0fc32 --- /dev/null +++ b/changelogs/unreleased/zj-review-apps-usage-data.yml @@ -0,0 +1,4 @@ +--- +title: Add review apps to usage metrics +merge_request: 12185 +author: diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index bcba2e3e1b6..38dc82493cf 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -27,6 +27,7 @@ module Gitlab deploy_keys: DeployKey.count, deployments: Deployment.count, environments: Environment.count, + in_review_folder: Environment.in_review_folder.count, groups: Group.count, issues: Issue.count, keys: Key.count, diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index b47e1b56fa9..3c7c7562b46 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -37,6 +37,7 @@ describe Gitlab::UsageData do deploy_keys deployments environments + in_review_folder groups issues keys |