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
0a42e735
Commit
0a42e735
authored
Apr 27, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add requirements created to usage data
Count created requirements on usage data
parent
d5d64b73
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
doc/user/admin_area/settings/usage_statistics.md
doc/user/admin_area/settings/usage_statistics.md
+1
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+9
-0
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+25
-3
No files found.
doc/user/admin_area/settings/usage_statistics.md
View file @
0a42e735
...
...
@@ -233,6 +233,7 @@ but commented out to help encourage others to add to it in the future. -->
|protected_branches|counts||
|releases|counts||
|remote_mirrors|counts||
|requirements_created|counts||
|snippets|counts||
|suggestions|counts||
|todos|counts||
...
...
ee/lib/ee/gitlab/usage_data.rb
View file @
0a42e735
...
...
@@ -82,6 +82,14 @@ module EE
usage_data
end
def
requirements_counts
return
{}
unless
::
License
.
feature_available?
(
:requirements
)
{
requirements_created:
count
(
RequirementsManagement
::
Requirement
)
}
end
# rubocop: disable CodeReuse/ActiveRecord
def
service_desk_counts
return
{}
unless
::
License
.
feature_available?
(
:service_desk
)
...
...
@@ -160,6 +168,7 @@ module EE
status_page_issues:
count
(
::
Issue
.
on_status_page
),
template_repositories:
count
(
::
Project
.
with_repos_templates
)
+
count
(
::
Project
.
with_groups_level_repos_templates
)
},
requirements_counts
,
service_desk_counts
,
security_products_usage
,
epics_deepest_relationship_level
,
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
0a42e735
...
...
@@ -7,7 +7,7 @@ describe Gitlab::UsageData do
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:transaction_open?
).
and_return
(
false
)
end
describe
'
#
data'
do
describe
'
.
data'
do
# using Array.new to create a different creator User for each of the projects
let_it_be
(
:projects
)
{
Array
.
new
(
3
)
{
create
(
:project
,
:repository
,
creator:
create
(
:user
,
group_view: :security_dashboard
))
}
}
let
(
:count_data
)
{
subject
[
:counts
]
}
...
...
@@ -152,7 +152,7 @@ describe Gitlab::UsageData do
end
end
describe
'
#
features_usage_data_ee'
do
describe
'
.
features_usage_data_ee'
do
subject
{
described_class
.
features_usage_data_ee
}
it
'gathers feature usage data of EE'
do
...
...
@@ -162,7 +162,7 @@ describe Gitlab::UsageData do
end
end
describe
'
#
license_usage_data'
do
describe
'
.
license_usage_data'
do
subject
{
described_class
.
license_usage_data
}
it
'gathers license data'
do
...
...
@@ -180,6 +180,28 @@ describe Gitlab::UsageData do
end
end
describe
'.requirements_counts'
do
subject
{
described_class
.
requirements_counts
}
context
'when requirements are disabled'
do
it
'returns empty hash'
do
stub_licensed_features
(
requirements:
false
)
expect
(
subject
).
to
eq
({})
end
end
context
'when requirements are enabled'
do
it
'returns created requirements count'
do
stub_licensed_features
(
requirements:
true
)
create_list
(
:requirement
,
2
)
expect
(
subject
).
to
eq
({
requirements_created:
2
})
end
end
end
describe
'.service_desk_counts'
do
subject
{
described_class
.
service_desk_counts
}
...
...
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