Commit cbd4f98d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'fj-fix-smau-usage-counters' into 'master'

Move SMAU usage counters to the UsageData count field

Closes version-gitlab-com#158, version-gitlab-com#159, version-gitlab-com#149, version-gitlab-com#148, version-gitlab-com#150, version-gitlab-com#147, version-gitlab-com#157, and version-gitlab-com#146

See merge request gitlab-org/gitlab!17074
parents ae22b486 e53f5815
---
title: Move SMAU usage counters to the UsageData count field
merge_request: 17074
author:
type: fixed
......@@ -55,12 +55,6 @@ describe Gitlab::UsageData do
))
end
it do
is_expected.to include(design_management_designs_create: a_kind_of(Integer),
design_management_designs_update: a_kind_of(Integer),
design_management_designs_delete: a_kind_of(Integer))
end
it 'gathers usage counts' do
expect(count_data[:boards]).to eq(1)
expect(count_data[:projects]).to eq(3)
......@@ -87,6 +81,9 @@ describe Gitlab::UsageData do
projects_with_prometheus_alerts
projects_with_tracing_enabled
sast_jobs
design_management_designs_create
design_management_designs_update
design_management_designs_delete
))
expect(count_data[:projects_with_prometheus_alerts]).to eq(2)
......
......@@ -17,7 +17,6 @@ module Gitlab
.merge(features_usage_data)
.merge(components_usage_data)
.merge(cycle_analytics_usage_data)
.merge(usage_counters)
end
def to_json(force_refresh: false)
......@@ -99,6 +98,7 @@ module Gitlab
web_hooks: count(WebHook)
}.merge(services_usage)
.merge(approximate_counts)
.merge(usage_counters)
}.tap do |data|
data[:counts][:user_preferences] = user_preferences_usage
end
......
......@@ -64,31 +64,29 @@ describe Gitlab::UsageData do
avg_cycle_analytics
influxdb_metrics_enabled
prometheus_metrics_enabled
cycle_analytics_views
productivity_analytics_views
))
expect(subject).to include(
snippet_create: a_kind_of(Integer),
snippet_update: a_kind_of(Integer),
snippet_comment: a_kind_of(Integer),
merge_request_comment: a_kind_of(Integer),
merge_request_create: a_kind_of(Integer),
commit_comment: a_kind_of(Integer),
wiki_pages_create: a_kind_of(Integer),
wiki_pages_update: a_kind_of(Integer),
wiki_pages_delete: a_kind_of(Integer),
web_ide_views: a_kind_of(Integer),
web_ide_commits: a_kind_of(Integer),
web_ide_merge_requests: a_kind_of(Integer),
navbar_searches: a_kind_of(Integer),
cycle_analytics_views: a_kind_of(Integer),
productivity_analytics_views: a_kind_of(Integer),
source_code_pushes: a_kind_of(Integer)
)
end
it 'gathers usage counts' do
smau_keys = %i(
snippet_create
snippet_update
snippet_comment
merge_request_comment
merge_request_create
commit_comment
wiki_pages_create
wiki_pages_update
wiki_pages_delete
web_ide_views
web_ide_commits
web_ide_merge_requests
navbar_searches
cycle_analytics_views
productivity_analytics_views
source_code_pushes
)
expected_keys = %i(
assignee_lists
boards
......@@ -154,12 +152,13 @@ describe Gitlab::UsageData do
uploads
web_hooks
user_preferences
)
).push(*smau_keys)
count_data = subject[:counts]
expect(count_data[:boards]).to eq(1)
expect(count_data[:projects]).to eq(4)
expect(count_data.values_at(*smau_keys)).to all(be_an(Integer))
expect(count_data.keys).to include(*expected_keys)
expect(expected_keys - count_data.keys).to be_empty
end
......
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