Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
80420fd9
Commit
80420fd9
authored
Sep 22, 2017
by
Tiago
Committed by
Rémy Coutable
Sep 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds gitlab features and components to usage ping data.
parent
e385458f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
23 deletions
+108
-23
changelogs/unreleased/33328-usage-ping-for-gitlab-features-and-components.yml
...d/33328-usage-ping-for-gitlab-features-and-components.yml
+5
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+56
-23
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+47
-0
No files found.
changelogs/unreleased/33328-usage-ping-for-gitlab-features-and-components.yml
0 → 100644
View file @
80420fd9
---
title
:
Adds gitlab features and components to usage ping data.
merge_request
:
14305
author
:
type
:
other
lib/gitlab/usage_data.rb
View file @
80420fd9
...
@@ -9,12 +9,42 @@ module Gitlab
...
@@ -9,12 +9,42 @@ module Gitlab
def
uncached_data
def
uncached_data
license_usage_data
.
merge
(
system_usage_data
)
license_usage_data
.
merge
(
system_usage_data
)
.
merge
(
features_usage_data
)
.
merge
(
components_usage_data
)
end
end
def
to_json
(
force_refresh:
false
)
def
to_json
(
force_refresh:
false
)
data
(
force_refresh:
force_refresh
).
to_json
data
(
force_refresh:
force_refresh
).
to_json
end
end
def
license_usage_data
usage_data
=
{
uuid:
current_application_settings
.
uuid
,
hostname:
Gitlab
.
config
.
gitlab
.
host
,
version:
Gitlab
::
VERSION
,
active_user_count:
User
.
active
.
count
,
recorded_at:
Time
.
now
,
mattermost_enabled:
Gitlab
.
config
.
mattermost
.
enabled
,
edition:
'EE'
}
license
=
::
License
.
current
if
license
usage_data
[
:edition
]
=
license_edition
(
license
.
plan
)
usage_data
[
:license_md5
]
=
license
.
md5
usage_data
[
:historical_max_users
]
=
::
HistoricalData
.
max_historical_user_count
usage_data
[
:licensee
]
=
license
.
licensee
usage_data
[
:license_user_count
]
=
license
.
restricted_user_count
usage_data
[
:license_starts_at
]
=
license
.
starts_at
usage_data
[
:license_expires_at
]
=
license
.
expires_at
usage_data
[
:license_plan
]
=
license
.
plan
usage_data
[
:license_add_ons
]
=
license
.
add_ons
end
usage_data
end
def
system_usage_data
def
system_usage_data
{
{
counts:
{
counts:
{
...
@@ -73,32 +103,35 @@ module Gitlab
...
@@ -73,32 +103,35 @@ module Gitlab
}
}
end
end
def
license_usage_data
def
features_usage_data
usage_data
=
{
features_usage_data_ce
.
merge
(
features_usage_data_ee
)
uuid:
current_application_settings
.
uuid
,
end
hostname:
Gitlab
.
config
.
gitlab
.
host
,
version:
Gitlab
::
VERSION
,
active_user_count:
User
.
active
.
count
,
recorded_at:
Time
.
now
,
mattermost_enabled:
Gitlab
.
config
.
mattermost
.
enabled
,
edition:
'EE'
}
license
=
::
License
.
current
def
features_usage_data_ce
{
signup:
current_application_settings
.
signup_enabled?
,
ldap:
Gitlab
.
config
.
ldap
.
enabled
,
gravatar:
current_application_settings
.
gravatar_enabled?
,
omniauth:
Gitlab
.
config
.
omniauth
.
enabled
,
reply_by_email:
Gitlab
::
IncomingEmail
.
enabled?
,
container_registry:
Gitlab
.
config
.
registry
.
enabled
,
gitlab_shared_runners:
Gitlab
.
config
.
gitlab_ci
.
shared_runners_enabled
}
end
if
license
def
features_usage_data_ee
usage_data
[
:edition
]
=
license_edition
(
license
.
plan
)
{
usage_data
[
:license_md5
]
=
license
.
md5
elasticsearch:
current_application_settings
.
elasticsearch_search?
,
usage_data
[
:historical_max_users
]
=
::
HistoricalData
.
max_historical_user_count
geo:
Gitlab
::
Geo
.
enabled?
usage_data
[
:licensee
]
=
license
.
licensee
}
usage_data
[
:license_user_count
]
=
license
.
restricted_user_count
end
usage_data
[
:license_starts_at
]
=
license
.
starts_at
usage_data
[
:license_expires_at
]
=
license
.
expires_at
usage_data
[
:license_plan
]
=
license
.
plan
usage_data
[
:license_add_ons
]
=
license
.
add_ons
end
usage_data
def
components_usage_data
{
gitlab_pages:
{
enabled:
Gitlab
.
config
.
pages
.
enabled
,
version:
Gitlab
::
Pages
::
VERSION
},
git:
{
version:
Gitlab
::
Git
.
version
},
database:
{
adapter:
Gitlab
::
Database
.
adapter_name
,
version:
Gitlab
::
Database
.
version
}
}
end
end
def
license_edition
(
plan
)
def
license_edition
(
plan
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
80420fd9
...
@@ -35,6 +35,18 @@ describe Gitlab::UsageData do
...
@@ -35,6 +35,18 @@ describe Gitlab::UsageData do
version
version
uuid
uuid
hostname
hostname
signup
ldap
gravatar
omniauth
reply_by_email
container_registry
gitlab_pages
gitlab_shared_runners
elasticsearch
geo
git
database
)
)
)
)
end
end
...
@@ -101,6 +113,41 @@ describe Gitlab::UsageData do
...
@@ -101,6 +113,41 @@ describe Gitlab::UsageData do
end
end
end
end
describe
'#features_usage_data_ce'
do
subject
{
described_class
.
features_usage_data_ce
}
it
'gathers feature usage data'
do
expect
(
subject
[
:signup
]).
to
eq
(
current_application_settings
.
signup_enabled?
)
expect
(
subject
[
:ldap
]).
to
eq
(
Gitlab
.
config
.
ldap
.
enabled
)
expect
(
subject
[
:gravatar
]).
to
eq
(
current_application_settings
.
gravatar_enabled?
)
expect
(
subject
[
:omniauth
]).
to
eq
(
Gitlab
.
config
.
omniauth
.
enabled
)
expect
(
subject
[
:reply_by_email
]).
to
eq
(
Gitlab
::
IncomingEmail
.
enabled?
)
expect
(
subject
[
:container_registry
]).
to
eq
(
Gitlab
.
config
.
registry
.
enabled
)
expect
(
subject
[
:gitlab_shared_runners
]).
to
eq
(
Gitlab
.
config
.
gitlab_ci
.
shared_runners_enabled
)
end
end
describe
'#features_usage_data_ee'
do
subject
{
described_class
.
features_usage_data_ee
}
it
'gathers feature usage data of EE'
do
expect
(
subject
[
:elasticsearch
]).
to
eq
(
current_application_settings
.
elasticsearch_search?
)
expect
(
subject
[
:geo
]).
to
eq
(
Gitlab
::
Geo
.
enabled?
)
end
end
describe
'#components_usage_data'
do
subject
{
described_class
.
components_usage_data
}
it
'gathers components usage data'
do
expect
(
subject
[
:gitlab_pages
][
:enabled
]).
to
eq
(
Gitlab
.
config
.
pages
.
enabled
)
expect
(
subject
[
:gitlab_pages
][
:version
]).
to
eq
(
Gitlab
::
Pages
::
VERSION
)
expect
(
subject
[
:git
][
:version
]).
to
eq
(
Gitlab
::
Git
.
version
)
expect
(
subject
[
:database
][
:adapter
]).
to
eq
(
Gitlab
::
Database
.
adapter_name
)
expect
(
subject
[
:database
][
:version
]).
to
eq
(
Gitlab
::
Database
.
version
)
end
end
describe
'#license_usage_data'
do
describe
'#license_usage_data'
do
subject
{
described_class
.
license_usage_data
}
subject
{
described_class
.
license_usage_data
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment