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
cb4a9f8a
Commit
cb4a9f8a
authored
Apr 06, 2017
by
Felipe Artur
Committed by
Sean McGivern
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retrieve service desk usage from instances
parent
0e519d55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
7 deletions
+47
-7
doc/user/admin_area/settings/usage_statistics.md
doc/user/admin_area/settings/usage_statistics.md
+3
-1
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+14
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+30
-5
No files found.
doc/user/admin_area/settings/usage_statistics.md
View file @
cb4a9f8a
...
...
@@ -74,9 +74,11 @@ The total number of the following is sent back to GitLab Inc.:
-
Protected branches
-
Releases
-
Remote mirrors
-
Service Desk projects
-
Service Desk issues
-
Web hooks
Also, we track if you've installed Mattermost with GitLab.
Also, we track if you've installed Mattermost with GitLab.
For example:
`"mattermost_enabled":true"`
.
## Privacy policy
...
...
lib/gitlab/usage_data.rb
View file @
cb4a9f8a
...
...
@@ -49,7 +49,20 @@ module Gitlab
todos:
Todo
.
count
,
uploads:
Upload
.
count
,
web_hooks:
WebHook
.
count
}
}.
merge
(
service_desk_counts
)
}
end
def
service_desk_counts
return
{}
unless
::
License
.
current
.
add_on?
(
'GitLab_ServiceDesk'
)
projects_with_service_desk
=
Project
.
where
(
service_desk_enabled:
true
)
{
service_desk_enabled_projects:
projects_with_service_desk
.
count
,
service_desk_issues:
Issue
.
where
(
project:
projects_with_service_desk
,
author:
User
.
support_bot
,
confidential:
true
).
count
}
end
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
cb4a9f8a
require
'spec_helper'
describe
Gitlab
::
UsageData
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project2
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:
empty_
project
)
}
let!
(
:project2
)
{
create
(
:
empty_
project
)
}
let!
(
:board
)
{
create
(
:board
,
project:
project
)
}
describe
'#data'
do
subject
{
Gitlab
::
UsageData
.
data
}
subject
{
described_class
.
data
}
it
"gathers usage data"
do
expect
(
subject
.
keys
).
to
match_array
(
%i(
...
...
@@ -68,8 +68,8 @@ describe Gitlab::UsageData do
end
end
describe
'
#
license_usage_data'
do
subject
{
Gitlab
::
UsageData
.
license_usage_data
}
describe
'
.
license_usage_data'
do
subject
{
described_class
.
license_usage_data
}
it
"gathers license data"
do
license
=
::
License
.
current
...
...
@@ -87,4 +87,29 @@ describe Gitlab::UsageData do
expect
(
subject
[
:recorded_at
]).
to
be_a
(
Time
)
end
end
describe
'.service_desk_counts'
do
subject
{
described_class
.
service_desk_counts
}
let!
(
:project3
)
{
create
(
:empty_project
,
service_desk_enabled:
true
)
}
let!
(
:project4
)
{
create
(
:empty_project
,
service_desk_enabled:
true
)
}
context
'when Service Desk is disabled'
do
it
'returns an empty hash'
do
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
).
and_return
(
false
)
expect
(
subject
).
to
eq
({})
end
end
context
'when Service Desk is enabled'
do
it
'gathers Service Desk data'
do
create_list
(
:issue
,
3
,
confidential:
true
,
author:
User
.
support_bot
,
project:
[
project3
,
project4
].
sample
)
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
).
and_return
(
true
)
expect
(
subject
).
to
eq
(
service_desk_enabled_projects:
2
,
service_desk_issues:
3
)
end
end
end
end
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