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
5618ea7a
Commit
5618ea7a
authored
Oct 21, 2021
by
Vladimir Shushlin
Committed by
Shinya Maeda
Oct 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add metric for users associating group milestones to releases
Changelog: added
parent
a538eac7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
3 deletions
+94
-3
app/models/release.rb
app/models/release.rb
+1
-0
ee/config/metrics/counts_28d/20211008142339_releases_with_group_milestones.yml
...nts_28d/20211008142339_releases_with_group_milestones.yml
+22
-0
ee/config/metrics/counts_all/20211007133842_releases_with_group_milestones.yml
...nts_all/20211007133842_releases_with_group_milestones.yml
+21
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+3
-1
ee/lib/gitlab/usage/metrics/instrumentations/count_users_associating_group_milestones_to_releases_metric.rb
..._users_associating_group_milestones_to_releases_metric.rb
+18
-0
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+10
-2
ee/spec/lib/gitlab/usage/metrics/instrumentations/count_users_associating_group_milestones_to_releases_metric_spec.rb
...s_associating_group_milestones_to_releases_metric_spec.rb
+19
-0
No files found.
app/models/release.rb
View file @
5618ea7a
...
...
@@ -34,6 +34,7 @@ class Release < ApplicationRecord
project:
[
:project_feature
,
:route
,
{
namespace: :route
}])
}
scope
:with_milestones
,
->
{
joins
(
:milestone_releases
)
}
scope
:with_group_milestones
,
->
{
joins
(
:milestones
).
where
.
not
(
milestones:
{
group_id:
nil
})
}
scope
:recent
,
->
{
sorted
.
limit
(
MAX_NUMBER_TO_DISPLAY
)
}
scope
:without_evidence
,
->
{
left_joins
(
:evidences
).
where
(
::
Releases
::
Evidence
.
arel_table
[
:id
].
eq
(
nil
))
}
scope
:released_within_2hrs
,
->
{
where
(
released_at:
Time
.
zone
.
now
-
1
.
hour
..
Time
.
zone
.
now
+
1
.
hour
)
}
...
...
ee/config/metrics/counts_28d/20211008142339_releases_with_group_milestones.yml
0 → 100644
View file @
5618ea7a
---
key_path
:
usage_activity_by_stage_monthly.release.releases_with_group_milestones
description
:
Unique users creating releases with group milestones associated
product_section
:
ops
product_stage
:
release
product_group
:
'
group::release'
product_category
:
Release Orchestration
value_type
:
number
status
:
active
milestone
:
"
14.4"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71650
time_frame
:
28d
data_source
:
database
instrumentation_class
:
'
CountUsersAssociatingGroupMilestonesToReleasesMetric'
data_category
:
optional
performance_indicator_type
:
-
smau
distribution
:
-
ee
tier
:
-
premium
-
ultimate
ee/config/metrics/counts_all/20211007133842_releases_with_group_milestones.yml
0 → 100644
View file @
5618ea7a
---
key_path
:
usage_activity_by_stage.release.releases_with_group_milestones
description
:
Unique users creating releases with group milestones associated
product_section
:
ops
product_stage
:
release
product_group
:
'
group::release'
product_category
:
Release Orchestration
value_type
:
number
status
:
active
milestone
:
"
14.4"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71650
time_frame
:
all
data_source
:
database
instrumentation_class
:
'
CountUsersAssociatingGroupMilestonesToReleasesMetric'
data_category
:
optional
performance_indicator_type
:
[]
distribution
:
-
ee
tier
:
-
premium
-
ultimate
ee/lib/ee/gitlab/usage_data.rb
View file @
5618ea7a
...
...
@@ -344,8 +344,10 @@ module EE
# Omitted because no user, creator or author associated: `environments`, `feature_flags`, `in_review_folder`, `pages_domains`
override
:usage_activity_by_stage_release
def
usage_activity_by_stage_release
(
time_period
)
time_frame
=
metric_time_period
(
time_period
)
super
.
merge
({
projects_mirrored_with_pipelines_enabled:
distinct_count
(
::
Project
.
mirrored_with_enabled_pipelines
.
where
(
time_period
),
:creator_id
)
projects_mirrored_with_pipelines_enabled:
distinct_count
(
::
Project
.
mirrored_with_enabled_pipelines
.
where
(
time_period
),
:creator_id
),
releases_with_group_milestones:
add_metric
(
'CountUsersAssociatingGroupMilestonesToReleasesMetric'
,
time_frame:
time_frame
)
})
end
...
...
ee/lib/gitlab/usage/metrics/instrumentations/count_users_associating_group_milestones_to_releases_metric.rb
0 → 100644
View file @
5618ea7a
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
CountUsersAssociatingGroupMilestonesToReleasesMetric
<
DatabaseMetric
operation
:distinct_count
,
column: :author_id
relation
{
Release
.
with_group_milestones
}
start
{
Release
.
minimum
(
:author_id
)
}
finish
{
Release
.
maximum
(
:author_id
)
}
end
end
end
end
end
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
5618ea7a
...
...
@@ -542,15 +542,23 @@ RSpec.describe Gitlab::UsageData do
describe
'usage_activity_by_stage_release'
do
it
'includes accurate usage_activity_by_stage data'
do
stub_licensed_features
(
group_milestone_project_releases:
true
)
group_milestone
=
create
(
:milestone
,
:on_group
)
project
=
create
(
:project
,
group:
group_milestone
.
group
)
for_defined_days_back
do
create
(
:project
,
:mirror
,
mirror_trigger_builds:
true
)
create
(
:release
,
created_at:
3
.
days
.
ago
,
project:
project
,
milestones:
[
group_milestone
])
end
expect
(
described_class
.
usage_activity_by_stage_release
({})).
to
include
(
projects_mirrored_with_pipelines_enabled:
2
projects_mirrored_with_pipelines_enabled:
2
,
releases_with_group_milestones:
2
)
expect
(
described_class
.
usage_activity_by_stage_release
(
described_class
.
monthly_time_range_db_params
)).
to
include
(
projects_mirrored_with_pipelines_enabled:
1
projects_mirrored_with_pipelines_enabled:
1
,
releases_with_group_milestones:
1
)
end
end
...
...
ee/spec/lib/gitlab/usage/metrics/instrumentations/count_users_associating_group_milestones_to_releases_metric_spec.rb
0 → 100644
View file @
5618ea7a
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
CountUsersAssociatingGroupMilestonesToReleasesMetric
do
before
do
stub_licensed_features
(
group_milestone_project_releases:
true
)
end
let
(
:group_milestone
)
{
create
(
:milestone
,
:on_group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group_milestone
.
group
)
}
let!
(
:release
)
{
create
(
:release
,
created_at:
3
.
days
.
ago
)
}
let!
(
:release_with_milestone
)
{
create
(
:release
,
:with_milestones
,
created_at:
3
.
days
.
ago
)
}
let!
(
:release_with_group_milestone
)
{
create
(
:release
,
created_at:
3
.
days
.
ago
,
project:
project
,
milestones:
[
group_milestone
])
}
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'28d'
,
data_source:
'database'
}
do
let
(
:expected_value
)
{
1
}
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