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
6c29eaaf
Commit
6c29eaaf
authored
Apr 14, 2020
by
Aakriti Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add deployment frequency to Group Summary
parent
b87db076
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
166 additions
and
8 deletions
+166
-8
ee/changelogs/unreleased/add-deployment-frequency-to-group-vsa-summary.yml
...eleased/add-deployment-frequency-to-group-vsa-summary.yml
+5
-0
ee/spec/features/analytics/cycle_analytics/cycle_analytics_spec.rb
...eatures/analytics/cycle_analytics/cycle_analytics_spec.rb
+8
-1
ee/spec/fixtures/api/schemas/analytics/cycle_analytics/summary.json
...xtures/api/schemas/analytics/cycle_analytics/summary.json
+5
-2
ee/spec/frontend/analytics/cycle_analytics/components/__snapshots__/recent_activity_card_spec.js.snap
...omponents/__snapshots__/recent_activity_card_spec.js.snap
+15
-0
lib/gitlab/cycle_analytics/group_stage_summary.rb
lib/gitlab/cycle_analytics/group_stage_summary.rb
+32
-4
lib/gitlab/cycle_analytics/summary/group/deployment_frequency.rb
...lab/cycle_analytics/summary/group/deployment_frequency.rb
+33
-0
lib/gitlab/cycle_analytics/summary_helper.rb
lib/gitlab/cycle_analytics/summary_helper.rb
+15
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
+46
-0
spec/models/cycle_analytics/group_level_spec.rb
spec/models/cycle_analytics/group_level_spec.rb
+1
-1
No files found.
ee/changelogs/unreleased/add-deployment-frequency-to-group-vsa-summary.yml
0 → 100644
View file @
6c29eaaf
---
title
:
Add deployment frequency to Group Value Stream Analytics summary
merge_request
:
28776
author
:
type
:
added
ee/spec/features/analytics/cycle_analytics/cycle_analytics_spec.rb
View file @
6c29eaaf
...
...
@@ -239,11 +239,18 @@ describe 'Group Value Stream Analytics', :js do
end
it
'displays the number of deploys'
do
deploys_count
=
page
.
all
(
card_metric_selector
)
.
last
deploys_count
=
page
.
all
(
card_metric_selector
)
[
1
]
expect
(
deploys_count
).
to
have_content
(
'Deploys'
)
expect
(
deploys_count
).
to
have_content
(
'-'
)
end
it
'displays the deployment frequency'
do
deployment_frequency
=
page
.
all
(
card_metric_selector
).
last
expect
(
deployment_frequency
).
to
have_content
(
_
(
'Deployment Frequency'
))
expect
(
deployment_frequency
).
to
have_content
(
'-'
)
end
end
context
'with a sub group selected'
do
...
...
ee/spec/fixtures/api/schemas/analytics/cycle_analytics/summary.json
View file @
6c29eaaf
...
...
@@ -2,15 +2,18 @@
"type"
:
"array"
,
"items"
:
{
"minItems"
:
2
,
"maxItems"
:
2
,
"maxItems"
:
3
,
"type"
:
"object"
,
"required"
:
[
"value"
,
"title"
],
"properties"
:
{
"value"
:
{
"type"
:
"
integ
er"
"type"
:
"
numb
er"
},
"title"
:
{
"type"
:
"string"
},
"unit"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
...
...
ee/spec/frontend/analytics/cycle_analytics/components/__snapshots__/recent_activity_card_spec.js.snap
View file @
6c29eaaf
...
...
@@ -51,6 +51,21 @@ exports[`RecentActivityCard matches the snapshot 1`] = `
Deploys
</p>
</div>
<div
class="js-metric-card-item flex-grow text-center"
>
<h3
class="my-2"
>
-
</h3>
<p
class="text-secondary gl-font-size-small mb-2"
>
Deployment Frequency
</p>
</div>
</div>
</div>
...
...
lib/gitlab/cycle_analytics/group_stage_summary.rb
View file @
6c29eaaf
...
...
@@ -12,14 +12,42 @@ module Gitlab
end
def
data
[
serialize
(
Summary
::
Group
::
Issue
.
new
(
group:
group
,
current_user:
current_user
,
options:
options
)),
serialize
(
Summary
::
Group
::
Deploy
.
new
(
group:
group
,
options:
options
))]
[
issue_stats
,
deploy_stats
,
deployment_frequency_stats
]
end
private
def
serialize
(
summary_object
)
AnalyticsSummarySerializer
.
new
.
represent
(
summary_object
)
def
issue_stats
serialize
(
Summary
::
Group
::
Issue
.
new
(
group:
group
,
current_user:
current_user
,
options:
options
)
)
end
def
deployments_summary
@deployments_summary
||=
Summary
::
Group
::
Deploy
.
new
(
group:
group
,
options:
options
)
end
def
deploy_stats
serialize
deployments_summary
end
def
deployment_frequency_stats
serialize
(
Summary
::
Group
::
DeploymentFrequency
.
new
(
deployments:
deployments_summary
.
value
,
group:
group
,
options:
options
),
with_unit:
true
)
end
def
serialize
(
summary_object
,
with_unit:
false
)
AnalyticsSummarySerializer
.
new
.
represent
(
summary_object
,
with_unit:
with_unit
)
end
end
end
...
...
lib/gitlab/cycle_analytics/summary/group/deployment_frequency.rb
0 → 100644
View file @
6c29eaaf
# frozen_string_literal: true
module
Gitlab
module
CycleAnalytics
module
Summary
module
Group
class
DeploymentFrequency
<
Group
::
Base
include
GroupProjectsProvider
include
SummaryHelper
def
initialize
(
deployments
:,
group
:,
options
:)
@deployments
=
deployments
super
(
group:
group
,
options:
options
)
end
def
title
_
(
'Deployment Frequency'
)
end
def
value
@value
||=
frequency
(
@deployments
,
options
[
:from
],
options
[
:to
]
||
Time
.
now
)
end
def
unit
_
(
'per day'
)
end
end
end
end
end
end
lib/gitlab/cycle_analytics/summary_helper.rb
0 → 100644
View file @
6c29eaaf
# frozen_string_literal: true
module
Gitlab
module
CycleAnalytics
module
SummaryHelper
def
frequency
(
count
,
from
,
to
)
(
count
/
days
(
from
,
to
)).
round
(
1
)
end
def
days
(
from
,
to
)
[(
to
.
end_of_day
-
from
.
beginning_of_day
)
/
(
24
*
60
*
60
),
1
].
max
end
end
end
end
locale/gitlab.pot
View file @
6c29eaaf
...
...
@@ -6957,6 +6957,9 @@ msgstr ""
msgid "Deploying to"
msgstr ""
msgid "Deployment Frequency"
msgstr ""
msgid "Deployment|API"
msgstr ""
...
...
@@ -25117,6 +25120,9 @@ msgstr ""
msgid "pending removal"
msgstr ""
msgid "per day"
msgstr ""
msgid "pipeline"
msgstr ""
...
...
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
View file @
6c29eaaf
...
...
@@ -127,4 +127,50 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
end
end
end
describe
'#deployment_frequency'
do
let
(
:from
)
{
6
.
days
.
ago
}
let
(
:to
)
{
nil
}
subject
do
described_class
.
new
(
group
,
options:
{
from:
from
,
to:
to
,
current_user:
user
}).
data
.
third
end
it
'includes the unit: `per day`'
do
expect
(
subject
[
:unit
]).
to
eq
(
_
(
'per day'
))
end
before
do
Timecop
.
freeze
(
5
.
days
.
ago
)
do
create
(
:deployment
,
:success
,
project:
project
)
end
end
context
'when `to` is nil'
do
it
'includes range until now'
do
# 1 deployment over 7 days
expect
(
subject
[
:value
]).
to
eq
(
0.1
)
end
end
context
'when `to` is given'
do
let
(
:from
)
{
10
.
days
.
ago
}
let
(
:to
)
{
10
.
days
.
from_now
}
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
create
(
:deployment
,
:success
,
project:
project
)
end
end
it
'returns deployment frequency within `from` and `to` range'
do
# 2 deployments over 20 days
expect
(
subject
[
:value
]).
to
eq
(
0.1
)
end
end
end
end
spec/models/cycle_analytics/group_level_spec.rb
View file @
6c29eaaf
...
...
@@ -38,7 +38,7 @@ describe CycleAnalytics::GroupLevel do
end
it
'returns medians for each stage for a specific group'
do
expect
(
subject
.
summary
.
map
{
|
summary
|
summary
[
:value
]
}).
to
contain_exactly
(
1
,
1
)
expect
(
subject
.
summary
.
map
{
|
summary
|
summary
[
:value
]
}).
to
contain_exactly
(
0.1
,
1
,
1
)
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