Commit 2ea3f449 authored by Aishwarya Subramanian's avatar Aishwarya Subramanian

Added metric to derive new users count

Includes metric 'users_created' to report distinct number
of users created within the time duration.
parent 960eff07
---
title: Add metric to derive new users count
merge_request: 27351
author:
type: added
......@@ -402,6 +402,7 @@ but commented out to help encourage others to add to it in the future. -->
|groups|usage_activity_by_stage|manage|
|ldap_keys|usage_activity_by_stage|manage|
|ldap_users: 0|usage_activity_by_stage|manage|
|users_created|usage_activity_by_stage|manage|
|clusters|usage_activity_by_stage|monitor|
|clusters_applications_prometheus|usage_activity_by_stage|monitor|
|operations_dashboard_default_dashboard|usage_activity_by_stage|monitor|
......
......@@ -16,6 +16,8 @@ module EE
MAX_USERNAME_SUGGESTION_ATTEMPTS = 15
prepended do
include UsageStatistics
EMAIL_OPT_IN_SOURCE_ID_GITLAB_COM = 1
# We aren't using the `auditor?` method for the `if` condition here
......
......@@ -243,7 +243,8 @@ module EE
events: distinct_count(::Event.where(time_period), :author_id),
groups: distinct_count(::GroupMember.where(time_period), :user_id),
ldap_keys: distinct_count(::LDAPKey.where(time_period), :user_id),
ldap_users: distinct_count(::GroupMember.of_ldap_type.where(time_period), :user_id)
ldap_users: distinct_count(::GroupMember.of_ldap_type.where(time_period), :user_id),
users_created: count(::User.where(time_period))
}
end
......
......@@ -156,13 +156,15 @@ describe Gitlab::UsageData do
events: 2,
groups: 2,
ldap_keys: 2,
ldap_users: 2
ldap_users: 2,
users_created: 6
)
expect(described_class.uncached_data[:usage_activity_by_stage_monthly][:manage]).to eq(
events: 1,
groups: 1,
ldap_keys: 1,
ldap_users: 1
ldap_users: 1,
users_created: 4
)
end
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