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
fb8d93bd
Commit
fb8d93bd
authored
Jul 06, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move monitor stage usage activity to CE
Also updates the documentation
parent
6047bf27
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
17 deletions
+45
-17
changelogs/unreleased/217362-move-configure-stage-usage-activity-to-ce.yml
...ased/217362-move-configure-stage-usage-activity-to-ce.yml
+5
-0
doc/development/telemetry/usage_ping.md
doc/development/telemetry/usage_ping.md
+7
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+0
-5
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+2
-11
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+9
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+22
-0
No files found.
changelogs/unreleased/217362-move-configure-stage-usage-activity-to-ce.yml
0 → 100644
View file @
fb8d93bd
---
title
:
Move monitor stage usage activity to CE
merge_request
:
36067
author
:
type
:
changed
doc/development/telemetry/usage_ping.md
View file @
fb8d93bd
...
@@ -648,6 +648,13 @@ appear to be associated to any of the services running, since they all appear to
...
@@ -648,6 +648,13 @@ appear to be associated to any of the services running, since they all appear to
|
`projects_slack_slash_active`
|
`usage_activity_by_stage`
|
`configure`
| | EE | Unique projects with Slack '/' commands enabled |
|
`projects_slack_slash_active`
|
`usage_activity_by_stage`
|
`configure`
| | EE | Unique projects with Slack '/' commands enabled |
|
`projects_with_prometheus_alerts`
|
`usage_activity_by_stage`
|
`configure`
| | EE | Projects with Prometheus enabled and no alerts |
|
`projects_with_prometheus_alerts`
|
`usage_activity_by_stage`
|
`configure`
| | EE | Projects with Prometheus enabled and no alerts |
|
`deploy_keys`
|
`usage_activity_by_stage`
|
`create`
| | | |
|
`deploy_keys`
|
`usage_activity_by_stage`
|
`create`
| | | |
|
`clusters`
|
`usage_activity_by_stage`
|
`monitor`
| | CE+EE | |
|
`clusters_applications_prometheus`
|
`usage_activity_by_stage`
|
`monitor`
| | CE+EE | |
|
`operations_dashboard_default_dashboard`
|
`usage_activity_by_stage`
|
`monitor`
| | CE+EE | |
|
`operations_dashboard_users_with_projects_added`
|
`usage_activity_by_stage`
|
`monitor`
| | EE | |
|
`projects_prometheus_active`
|
`usage_activity_by_stage`
|
`monitor`
| | EE | |
|
`projects_with_error_tracking_enabled`
|
`usage_activity_by_stage`
|
`monitor`
| | EE | |
|
`projects_with_tracing_enabled`
|
`usage_activity_by_stage`
|
`monitor`
| | EE | |
|
`keys`
|
`usage_activity_by_stage`
|
`create`
| | | |
|
`keys`
|
`usage_activity_by_stage`
|
`create`
| | | |
|
`projects_jira_dvcs_server_active`
|
`usage_activity_by_stage`
|
`plan`
| | | |
|
`projects_jira_dvcs_server_active`
|
`usage_activity_by_stage`
|
`plan`
| | | |
|
`service_desk_enabled_projects`
|
`usage_activity_by_stage`
|
`plan`
| | | |
|
`service_desk_enabled_projects`
|
`usage_activity_by_stage`
|
`plan`
| | | |
...
...
ee/lib/ee/gitlab/usage_data.rb
View file @
fb8d93bd
...
@@ -255,11 +255,6 @@ module EE
...
@@ -255,11 +255,6 @@ module EE
override
:usage_activity_by_stage_monitor
override
:usage_activity_by_stage_monitor
def
usage_activity_by_stage_monitor
(
time_period
)
def
usage_activity_by_stage_monitor
(
time_period
)
super
.
merge
({
super
.
merge
({
clusters:
distinct_count
(
::
Clusters
::
Cluster
.
where
(
time_period
),
:user_id
),
clusters_applications_prometheus:
cluster_applications_user_distinct_count
(
::
Clusters
::
Applications
::
Prometheus
,
time_period
),
operations_dashboard_default_dashboard:
count
(
::
User
.
active
.
with_dashboard
(
'operations'
).
where
(
time_period
),
start:
user_minimum_id
,
finish:
user_maximum_id
),
operations_dashboard_users_with_projects_added:
distinct_count
(
UsersOpsDashboardProject
.
joins
(
:user
).
merge
(
::
User
.
active
).
where
(
time_period
),
:user_id
),
operations_dashboard_users_with_projects_added:
distinct_count
(
UsersOpsDashboardProject
.
joins
(
:user
).
merge
(
::
User
.
active
).
where
(
time_period
),
:user_id
),
projects_prometheus_active:
distinct_count
(
::
Project
.
with_active_prometheus_service
.
where
(
time_period
),
:creator_id
),
projects_prometheus_active:
distinct_count
(
::
Project
.
with_active_prometheus_service
.
where
(
time_period
),
:creator_id
),
projects_with_error_tracking_enabled:
distinct_count
(
::
Project
.
with_enabled_error_tracking
.
where
(
time_period
),
:creator_id
),
projects_with_error_tracking_enabled:
distinct_count
(
::
Project
.
with_enabled_error_tracking
.
where
(
time_period
),
:creator_id
),
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
fb8d93bd
...
@@ -439,29 +439,20 @@ RSpec.describe Gitlab::UsageData do
...
@@ -439,29 +439,20 @@ RSpec.describe Gitlab::UsageData do
it
'includes accurate usage_activity_by_stage data'
do
it
'includes accurate usage_activity_by_stage data'
do
for_defined_days_back
do
for_defined_days_back
do
user
=
create
(
:user
,
dashboard:
'operations'
)
user
=
create
(
:user
,
dashboard:
'operations'
)
cluster
=
create
(
:cluster
,
user:
user
)
project
=
create
(
:project
,
creator:
user
)
project
=
create
(
:project
,
creator:
user
)
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
create
(
:users_ops_dashboard_project
,
user:
user
)
create
(
:users_ops_dashboard_project
,
user:
user
)
create
(
:prometheus_service
,
project:
project
)
create
(
:prometheus_service
,
project:
project
)
create
(
:project_error_tracking_setting
,
project:
project
)
create
(
:project_error_tracking_setting
,
project:
project
)
create
(
:project_tracing_setting
,
project:
project
)
create
(
:project_tracing_setting
,
project:
project
)
end
end
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage
][
:monitor
]).
to
eq
(
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage
][
:monitor
]).
to
include
(
clusters:
2
,
clusters_applications_prometheus:
2
,
operations_dashboard_default_dashboard:
2
,
operations_dashboard_users_with_projects_added:
2
,
operations_dashboard_users_with_projects_added:
2
,
projects_prometheus_active:
2
,
projects_prometheus_active:
2
,
projects_with_error_tracking_enabled:
2
,
projects_with_error_tracking_enabled:
2
,
projects_with_tracing_enabled:
2
projects_with_tracing_enabled:
2
)
)
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage_monthly
][
:monitor
]).
to
eq
(
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage_monthly
][
:monitor
]).
to
include
(
clusters:
1
,
clusters_applications_prometheus:
1
,
operations_dashboard_default_dashboard:
1
,
operations_dashboard_users_with_projects_added:
1
,
operations_dashboard_users_with_projects_added:
1
,
projects_prometheus_active:
1
,
projects_prometheus_active:
1
,
projects_with_error_tracking_enabled:
1
,
projects_with_error_tracking_enabled:
1
,
...
...
lib/gitlab/usage_data.rb
View file @
fb8d93bd
...
@@ -490,9 +490,17 @@ module Gitlab
...
@@ -490,9 +490,17 @@ module Gitlab
{}
{}
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
usage_activity_by_stage_monitor
(
time_period
)
def
usage_activity_by_stage_monitor
(
time_period
)
{}
{
clusters:
distinct_count
(
::
Clusters
::
Cluster
.
where
(
time_period
),
:user_id
),
clusters_applications_prometheus:
cluster_applications_user_distinct_count
(
::
Clusters
::
Applications
::
Prometheus
,
time_period
),
operations_dashboard_default_dashboard:
count
(
::
User
.
active
.
with_dashboard
(
'operations'
).
where
(
time_period
),
start:
user_minimum_id
,
finish:
user_maximum_id
)
}
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
usage_activity_by_stage_package
(
time_period
)
def
usage_activity_by_stage_package
(
time_period
)
{}
{}
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
fb8d93bd
...
@@ -93,6 +93,28 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
...
@@ -93,6 +93,28 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end
end
end
end
context
'for monitor'
do
it
'includes accurate usage_activity_by_stage data'
do
for_defined_days_back
do
user
=
create
(
:user
,
dashboard:
'operations'
)
cluster
=
create
(
:cluster
,
user:
user
)
create
(
:project
,
creator:
user
)
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
end
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage
][
:monitor
]).
to
include
(
clusters:
2
,
clusters_applications_prometheus:
2
,
operations_dashboard_default_dashboard:
2
)
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage_monthly
][
:monitor
]).
to
include
(
clusters:
1
,
clusters_applications_prometheus:
1
,
operations_dashboard_default_dashboard:
1
)
end
end
it
'ensures recorded_at is set before any other usage data calculation'
do
it
'ensures recorded_at is set before any other usage data calculation'
do
%i(alt_usage_data redis_usage_data distinct_count count)
.
each
do
|
method
|
%i(alt_usage_data redis_usage_data distinct_count count)
.
each
do
|
method
|
expect
(
described_class
).
not_to
receive
(
method
)
expect
(
described_class
).
not_to
receive
(
method
)
...
...
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