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
cfc447b1
Commit
cfc447b1
authored
Jan 16, 2019
by
Logan King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add operations dashboard usage ping data
parent
39d2f9bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+14
-1
ee/spec/factories/user_ops_dashboard_project.rb
ee/spec/factories/user_ops_dashboard_project.rb
+8
-0
ee/spec/lib/gitlab/usage_data_spec.rb
ee/spec/lib/gitlab/usage_data_spec.rb
+27
-0
No files found.
ee/lib/ee/gitlab/usage_data.rb
View file @
cfc447b1
...
...
@@ -105,6 +105,18 @@ module EE
end
end
def
operations_dashboard_usage
users_with_ops_dashboard_as_default
=
count
(
::
User
.
active
.
where
(
dashboard:
'operations'
))
#users_with_projects_added = count(UsersOpsDashboardProject.select('distinct user_id').includes(:user).merge(::User.active))
users_with_projects_added
=
count
(
UsersOpsDashboardProject
.
select
(
'distinct user_id'
))
{
default_dashboard:
users_with_ops_dashboard_as_default
,
users_with_projects_added:
users_with_projects_added
}
end
override
:system_usage_data
def
system_usage_data
usage_data
=
super
...
...
@@ -121,7 +133,8 @@ module EE
projects_with_prometheus_alerts:
count
(
PrometheusAlert
.
distinct_projects
),
projects_with_packages:
count
(
::
Packages
::
Package
.
select
(
'distinct project_id'
)),
projects_with_tracing_enabled:
count
(
ProjectTracingSetting
),
projects_enforcing_code_owner_approval:
count
(
::
Project
.
without_deleted
.
non_archived
.
requiring_code_owner_approval
)
projects_enforcing_code_owner_approval:
count
(
::
Project
.
without_deleted
.
non_archived
.
requiring_code_owner_approval
),
operations_dashboard:
operations_dashboard_usage
}).
merge
(
service_desk_counts
).
merge
(
security_products_usage
)
# MySql does not support recursive queries so we can't retrieve epics relationship depth
...
...
ee/spec/factories/user_ops_dashboard_project.rb
0 → 100644
View file @
cfc447b1
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:users_ops_dashboard_project
,
class:
UsersOpsDashboardProject
do
user
factory: :user
project
factory: :project
end
end
ee/spec/lib/gitlab/usage_data_spec.rb
View file @
cfc447b1
...
...
@@ -81,6 +81,7 @@ describe Gitlab::UsageData do
projects_jira_dvcs_cloud_active
projects_jira_dvcs_server_active
feature_flags
operations_dashboard
)
)
expect
(
count_data
[
:projects_with_prometheus_alerts
]).
to
eq
(
2
)
...
...
@@ -205,4 +206,30 @@ describe Gitlab::UsageData do
expect
(
described_class
.
system_usage_data
[
:counts
][
:projects_enforcing_code_owner_approval
]).
to
eq
(
1
)
end
end
describe
'#operations_dashboard_usage'
do
subject
{
described_class
.
operations_dashboard_usage
}
before
do
blocked_user
=
create
(
:user
,
:blocked
,
dashboard:
'operations'
)
user_with_ops_dashboard
=
create
(
:user
,
dashboard:
'operations'
)
create
(
:users_ops_dashboard_project
,
user:
blocked_user
)
create
(
:users_ops_dashboard_project
)
create
(
:users_ops_dashboard_project
)
create
(
:users_ops_dashboard_project
)
end
it
'gathers data on operations dashboard'
do
expect
(
subject
.
keys
).
to
include
(
*
%i(
default_dashboard,
users_with_projects_added
)
)
end
it
'bases counts on active users'
do
expect
(
subject
[
:default_dashboard
]).
to
eq
(
1
)
expect
(
subject
[
:users_with_projects_added
]).
to
eq
(
3
)
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