Commit b9ed06e2 authored by James Fargher's avatar James Fargher

Merge branch '216174-move-metric-to-counts' into 'master'

Move merge_requests_users under counts section

See merge request gitlab-org/gitlab!34492
parents 9ace12e4 25c08cd4
...@@ -504,6 +504,7 @@ appear to be associated to any of the services running, since they all appear to ...@@ -504,6 +504,7 @@ appear to be associated to any of the services running, since they all appear to
| `projects_jira_dvcs_server_active` | `counts` | | | | | `projects_jira_dvcs_server_active` | `counts` | | | |
| `labels` | `counts` | | | | | `labels` | `counts` | | | |
| `merge_requests` | `counts` | | | | | `merge_requests` | `counts` | | | |
| `merge_requests_users` | `counts` | | | |
| `notes` | `counts` | | | | | `notes` | `counts` | | | |
| `wiki_pages_create` | `counts` | | | | | `wiki_pages_create` | `counts` | | | |
| `wiki_pages_update` | `counts` | | | | | `wiki_pages_update` | `counts` | | | |
......
...@@ -37,7 +37,6 @@ module Gitlab ...@@ -37,7 +37,6 @@ module Gitlab
.merge(object_store_usage_data) .merge(object_store_usage_data)
.merge(topology_usage_data) .merge(topology_usage_data)
.merge(recording_ce_finish_data) .merge(recording_ce_finish_data)
.merge(merge_requests_usage_data(default_time_period))
end end
def to_json(force_refresh: false) def to_json(force_refresh: false)
...@@ -162,7 +161,8 @@ module Gitlab ...@@ -162,7 +161,8 @@ module Gitlab
usage_counters, usage_counters,
user_preferences_usage, user_preferences_usage,
ingress_modsecurity_usage, ingress_modsecurity_usage,
container_expiration_policies_usage container_expiration_policies_usage,
merge_requests_usage(default_time_period)
) )
} }
end end
...@@ -400,7 +400,7 @@ module Gitlab ...@@ -400,7 +400,7 @@ module Gitlab
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def merge_requests_usage_data(time_period) def merge_requests_usage(time_period)
query = query =
Event Event
.where(target_type: Event::TARGET_TYPES[:merge_request].to_s) .where(target_type: Event::TARGET_TYPES[:merge_request].to_s)
......
...@@ -580,7 +580,7 @@ describe Gitlab::UsageData, :aggregate_failures do ...@@ -580,7 +580,7 @@ describe Gitlab::UsageData, :aggregate_failures do
end end
end end
describe '#merge_requests_usage_data' do describe '#merge_requests_usage' do
let(:time_period) { { created_at: 2.days.ago..Time.current } } let(:time_period) { { created_at: 2.days.ago..Time.current } }
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:other_user) { create(:user) } let(:other_user) { create(:user) }
...@@ -597,7 +597,7 @@ describe Gitlab::UsageData, :aggregate_failures do ...@@ -597,7 +597,7 @@ describe Gitlab::UsageData, :aggregate_failures do
end end
it 'returns the distinct count of users using merge requests (via events table) within the specified time period' do it 'returns the distinct count of users using merge requests (via events table) within the specified time period' do
expect(described_class.merge_requests_usage_data(time_period)).to eq( expect(described_class.merge_requests_usage(time_period)).to eq(
merge_requests_users: 2 merge_requests_users: 2
) )
end end
......
...@@ -78,6 +78,7 @@ module UsageDataHelpers ...@@ -78,6 +78,7 @@ module UsageDataHelpers
labels labels
lfs_objects lfs_objects
merge_requests merge_requests
merge_requests_users
milestone_lists milestone_lists
milestones milestones
notes notes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment