Commit 9177608f authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '39-count-unique-users-for-more-accurate-smau-reporting-secure' into 'master'

Count unique users for more accurate SMAU reporting - Secure

See merge request gitlab-org/gitlab!16173
parents 8229b1d1 d2d12c8e
......@@ -175,6 +175,7 @@ module EE
package: usage_activity_by_stage_package,
plan: usage_activity_by_stage_plan,
release: usage_activity_by_stage_release,
secure: usage_activity_by_stage_secure,
verify: usage_activity_by_stage_verify
}
}
......@@ -270,6 +271,15 @@ module EE
projects_reporting_ci_cd_back_to_github: ::Project.with_github_service_pipeline_events.distinct_count_by(:creator_id)
}
end
# Currently too complicated and to get reliable counts for these stats:
# container_scanning_jobs, dast_jobs, dependency_scanning_jobs, license_management_jobs, sast_jobs
# Once https://gitlab.com/gitlab-org/gitlab/merge_requests/17568 is merged, this might be doable
def usage_activity_by_stage_secure
{
user_preferences_group_overview_security_dashboard: count(::User.active.group_view_security_dashboard)
}
end
end
end
end
......
......@@ -170,6 +170,16 @@ describe Gitlab::UsageData do
end
end
context 'for secure' do
it 'includes accurate usage_activity_by_stage data' do
create(:user, group_view: :security_dashboard)
expect(described_class.uncached_data[:usage_activity_by_stage][:secure]).to eq(
user_preferences_group_overview_security_dashboard: 1
)
end
end
context 'for verify' do
it 'includes accurate usage_activity_by_stage data' do
user = create(:user)
......
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