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
a9bb458c
Commit
a9bb458c
authored
Jul 07, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move release stage usage activity to CE
Also updates the documentation
parent
501b56ec
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
27 deletions
+47
-27
changelogs/unreleased/217362-move-release-stage-usage-activity-to-ce.yml
...leased/217362-move-release-stage-usage-activity-to-ce.yml
+5
-0
doc/development/telemetry/usage_ping.md
doc/development/telemetry/usage_ping.md
+5
-5
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-5
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+4
-16
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+8
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+24
-0
No files found.
changelogs/unreleased/217362-move-release-stage-usage-activity-to-ce.yml
0 → 100644
View file @
a9bb458c
---
title
:
Move release stage usage activity to CE
merge_request
:
36083
author
:
type
:
changed
doc/development/telemetry/usage_ping.md
View file @
a9bb458c
...
...
@@ -660,11 +660,11 @@ appear to be associated to any of the services running, since they all appear to
|
`service_desk_enabled_projects`
|
`usage_activity_by_stage`
|
`plan`
| | | |
|
`service_desk_issues`
|
`usage_activity_by_stage`
|
`plan`
| | | |
|
`todos: 0`
|
`usage_activity_by_stage`
|
`plan`
| | | |
|
`deployments`
|
`usage_activity_by_stage`
|
`release`
| |
| Total deployments |
|
`failed_deployments`
|
`usage_activity_by_stage`
|
`release`
| |
| Total failed deployments |
|
`projects_mirrored_with_pipelines_enabled`
|
`usage_activity_by_stage`
|
`release`
| |
| Projects with repository mirroring enabled |
|
`releases`
|
`usage_activity_by_stage`
|
`release`
| |
| Unique release tags in project |
|
`successful_deployments
: 0`
|
`usage_activity_by_stage`
|
`release`
| |
| Total successful deployments |
|
`deployments`
|
`usage_activity_by_stage`
|
`release`
| |
CE+EE
| Total deployments |
|
`failed_deployments`
|
`usage_activity_by_stage`
|
`release`
| |
CE+EE
| Total failed deployments |
|
`projects_mirrored_with_pipelines_enabled`
|
`usage_activity_by_stage`
|
`release`
| |
EE
| Projects with repository mirroring enabled |
|
`releases`
|
`usage_activity_by_stage`
|
`release`
| |
CE+EE
| Unique release tags in project |
|
`successful_deployments
`
|
`usage_activity_by_stage`
|
`release`
| | CE+EE
| Total successful deployments |
|
`user_preferences_group_overview_security_dashboard: 0`
|
`usage_activity_by_stage`
|
`secure`
| | | |
|
`ci_builds`
|
`usage_activity_by_stage`
|
`verify`
| | | Unique builds in project |
|
`ci_external_pipelines`
|
`usage_activity_by_stage`
|
`verify`
| | | Total pipelines in external repositories |
...
...
ee/lib/ee/gitlab/usage_data.rb
View file @
a9bb458c
...
...
@@ -295,11 +295,7 @@ module EE
override
:usage_activity_by_stage_release
def
usage_activity_by_stage_release
(
time_period
)
super
.
merge
({
deployments:
distinct_count
(
::
Deployment
.
where
(
time_period
),
:user_id
),
failed_deployments:
distinct_count
(
::
Deployment
.
failed
.
where
(
time_period
),
:user_id
),
projects_mirrored_with_pipelines_enabled:
distinct_count
(
::
Project
.
mirrored_with_enabled_pipelines
.
where
(
time_period
),
:creator_id
),
releases:
distinct_count
(
::
Release
.
where
(
time_period
),
:author_id
),
successful_deployments:
distinct_count
(
::
Deployment
.
success
.
where
(
time_period
),
:user_id
)
projects_mirrored_with_pipelines_enabled:
distinct_count
(
::
Project
.
mirrored_with_enabled_pipelines
.
where
(
time_period
),
:creator_id
)
})
end
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
a9bb458c
...
...
@@ -532,26 +532,14 @@ RSpec.describe Gitlab::UsageData do
context
'for release'
do
it
'includes accurate usage_activity_by_stage data'
do
for_defined_days_back
do
user
=
create
(
:user
)
create
(
:deployment
,
:failed
,
user:
user
)
create
(
:project
,
:mirror
,
mirror_trigger_builds:
true
)
create
(
:release
,
author:
user
)
create
(
:deployment
,
:success
,
user:
user
)
end
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage
][
:release
]).
to
eq
(
deployments:
2
,
failed_deployments:
2
,
projects_mirrored_with_pipelines_enabled:
2
,
releases:
2
,
successful_deployments:
2
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage
][
:release
]).
to
include
(
projects_mirrored_with_pipelines_enabled:
2
)
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage_monthly
][
:release
]).
to
eq
(
deployments:
1
,
failed_deployments:
1
,
projects_mirrored_with_pipelines_enabled:
1
,
releases:
1
,
successful_deployments:
1
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage_monthly
][
:release
]).
to
include
(
projects_mirrored_with_pipelines_enabled:
1
)
end
end
...
...
lib/gitlab/usage_data.rb
View file @
a9bb458c
...
...
@@ -514,9 +514,16 @@ module Gitlab
end
# Omitted because no user, creator or author associated: `environments`, `feature_flags`, `in_review_folder`, `pages_domains`
# rubocop: disable CodeReuse/ActiveRecord
def
usage_activity_by_stage_release
(
time_period
)
{}
{
deployments:
distinct_count
(
::
Deployment
.
where
(
time_period
),
:user_id
),
failed_deployments:
distinct_count
(
::
Deployment
.
failed
.
where
(
time_period
),
:user_id
),
releases:
distinct_count
(
::
Release
.
where
(
time_period
),
:author_id
),
successful_deployments:
distinct_count
(
::
Deployment
.
success
.
where
(
time_period
),
:user_id
)
}
end
# rubocop: enable CodeReuse/ActiveRecord
# Omitted because no user, creator or author associated: `ci_runners`
def
usage_activity_by_stage_verify
(
time_period
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
a9bb458c
...
...
@@ -115,6 +115,30 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end
end
context
'for release'
do
it
'includes accurate usage_activity_by_stage data'
do
for_defined_days_back
do
user
=
create
(
:user
)
create
(
:deployment
,
:failed
,
user:
user
)
create
(
:release
,
author:
user
)
create
(
:deployment
,
:success
,
user:
user
)
end
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage
][
:release
]).
to
include
(
deployments:
2
,
failed_deployments:
2
,
releases:
2
,
successful_deployments:
2
)
expect
(
described_class
.
uncached_data
[
:usage_activity_by_stage_monthly
][
:release
]).
to
include
(
deployments:
1
,
failed_deployments:
1
,
releases:
1
,
successful_deployments:
1
)
end
end
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
|
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