summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChantal Rollison <crollison@gitlab.com>2018-08-14 12:44:17 -0700
committerChantal Rollison <crollison@gitlab.com>2018-08-21 08:21:01 -0700
commite9c1f184bcc928c2c44b772b72b0380efe178efc (patch)
tree68a0ab4d8bdff96c428c5e1d625b61d33e1fe749
parentd2590b154228ed49dd4a949c889fb6234343ec94 (diff)
downloadgitlab-ce-ccr/48800/ping_for_boards.tar.gz
Added count for label, assignee, and milestone listsccr/48800/ping_for_boards
-rw-r--r--changelogs/unreleased/ccr-48800-ping_for_boards.yml6
-rw-r--r--db/migrate/20180815175440_add_index_on_list_type.rb16
-rw-r--r--db/schema.rb1
-rw-r--r--lib/gitlab/usage_data.rb3
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb3
5 files changed, 29 insertions, 0 deletions
diff --git a/changelogs/unreleased/ccr-48800-ping_for_boards.yml b/changelogs/unreleased/ccr-48800-ping_for_boards.yml
new file mode 100644
index 00000000000..c08578cddba
--- /dev/null
+++ b/changelogs/unreleased/ccr-48800-ping_for_boards.yml
@@ -0,0 +1,6 @@
+---
+title: Adds count for different board list types (label lists, assignee lists, and
+ milestone lists) to usage statistics.
+merge_request: 21208
+author:
+type: changed
diff --git a/db/migrate/20180815175440_add_index_on_list_type.rb b/db/migrate/20180815175440_add_index_on_list_type.rb
new file mode 100644
index 00000000000..aad805e436e
--- /dev/null
+++ b/db/migrate/20180815175440_add_index_on_list_type.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+class AddIndexOnListType < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :lists, :list_type
+ end
+
+ def down
+ remove_concurrent_index :lists, :list_type
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6168a1be29e..f5ce7df60e8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1135,6 +1135,7 @@ ActiveRecord::Schema.define(version: 20180816193530) do
add_index "lists", ["board_id", "label_id"], name: "index_lists_on_board_id_and_label_id", unique: true, using: :btree
add_index "lists", ["label_id"], name: "index_lists_on_label_id", using: :btree
+ add_index "lists", ["list_type"], name: "index_lists_on_list_type", using: :btree
create_table "members", force: :cascade do |t|
t.integer "access_level", null: false
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 22c9638ecc0..7797bd5fab2 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -34,6 +34,7 @@ module Gitlab
def system_usage_data
{
counts: {
+ assignee_lists: List.assignee.count,
boards: Board.count,
ci_builds: ::Ci::Build.count,
ci_internal_pipelines: ::Ci::Pipeline.internal.count,
@@ -61,9 +62,11 @@ module Gitlab
groups: Group.count,
issues: Issue.count,
keys: Key.count,
+ label_lists: List.label.count,
labels: Label.count,
lfs_objects: LfsObject.count,
merge_requests: MergeRequest.count,
+ milestone_lists: List.milestone.count,
milestones: Milestone.count,
notes: Note.count,
pages_domains: PagesDomain.count,
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index a19b3c0ba66..de6dd2a9fea 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -56,6 +56,7 @@ describe Gitlab::UsageData do
expect(count_data[:projects]).to eq(3)
expect(count_data.keys).to match_array(%i(
+ assignee_lists
boards
ci_builds
ci_internal_pipelines
@@ -83,9 +84,11 @@ describe Gitlab::UsageData do
groups
issues
keys
+ label_lists
labels
lfs_objects
merge_requests
+ milestone_lists
milestones
notes
projects