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
8a5ddea1
Commit
8a5ddea1
authored
May 18, 2021
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duration_chart endpoint
This change removes the VSA duration_chart endpoint.
parent
de7dabeb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
3 additions
and
66 deletions
+3
-66
ee/app/controllers/groups/analytics/cycle_analytics/stages_controller.rb
...ers/groups/analytics/cycle_analytics/stages_controller.rb
+2
-6
ee/config/routes/group.rb
ee/config/routes/group.rb
+0
-2
ee/lib/ee/gitlab/analytics/cycle_analytics/data_collector.rb
ee/lib/ee/gitlab/analytics/cycle_analytics/data_collector.rb
+0
-7
ee/lib/gitlab/analytics/cycle_analytics/data_for_duration_chart.rb
...tlab/analytics/cycle_analytics/data_for_duration_chart.rb
+0
-8
ee/spec/fixtures/api/schemas/analytics/cycle_analytics/duration_chart.json
...api/schemas/analytics/cycle_analytics/duration_chart.json
+0
-16
ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb
...b/gitlab/analytics/cycle_analytics/data_collector_spec.rb
+0
-10
ee/spec/support/shared_examples/controllers/analytics/cycle_analytics/shared_stage_shared_examples.rb
...analytics/cycle_analytics/shared_stage_shared_examples.rb
+1
-17
No files found.
ee/app/controllers/groups/analytics/cycle_analytics/stages_controller.rb
View file @
8a5ddea1
...
...
@@ -9,8 +9,8 @@ module Groups
before_action
:load_group
before_action
:load_value_stream
before_action
:validate_params
,
only:
%i[median average records
duration_chart
average_duration_chart count]
before_action
:authorize_read_group_stage
,
only:
%i[median average records
duration_chart
average_duration_chart count]
before_action
:validate_params
,
only:
%i[median average records average_duration_chart count]
before_action
:authorize_read_group_stage
,
only:
%i[median average records average_duration_chart count]
def
index
return
render_403
unless
can?
(
current_user
,
:read_group_cycle_analytics
,
@group
)
...
...
@@ -58,10 +58,6 @@ module Groups
render
json:
serialized_records
end
def
duration_chart
render
json:
::
Analytics
::
CycleAnalytics
::
DurationChartItemEntity
.
represent
(
data_collector
.
duration_chart_data
)
end
def
average_duration_chart
render
json:
::
Analytics
::
CycleAnalytics
::
DurationChartAverageItemEntity
.
represent
(
data_collector
.
duration_chart_average_data
)
end
...
...
ee/config/routes/group.rb
View file @
8a5ddea1
...
...
@@ -28,7 +28,6 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resources
:stages
,
only:
[
:index
,
:create
,
:update
,
:destroy
]
do
member
do
get
:average_duration_chart
get
:duration_chart
get
:median
get
:average
get
:records
...
...
@@ -39,7 +38,6 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resources
:stages
,
only:
[
:index
,
:create
,
:update
,
:destroy
]
do
member
do
get
:average_duration_chart
get
:duration_chart
get
:median
get
:average
get
:records
...
...
ee/lib/ee/gitlab/analytics/cycle_analytics/data_collector.rb
View file @
8a5ddea1
...
...
@@ -5,13 +5,6 @@ module EE
module
Analytics
module
CycleAnalytics
module
DataCollector
# Deprecated, will be removed in the next milestone: https://gitlab.com/gitlab-org/gitlab/-/issues/328219
def
duration_chart_data
strong_memoize
(
:duration_chart
)
do
duration_chart
.
load
end
end
def
duration_chart_average_data
strong_memoize
(
:duration_chart_average_data
)
do
duration_chart
.
average_by_day
...
...
ee/lib/gitlab/analytics/cycle_analytics/data_for_duration_chart.rb
View file @
8a5ddea1
...
...
@@ -14,14 +14,6 @@ module Gitlab
@query
=
query
end
# rubocop: disable CodeReuse/ActiveRecord
def
load
order_by
(
query
,
:end_event
,
:desc
)
.
select
(
round_duration_to_seconds
.
as
(
'duration_in_seconds'
),
stage
.
end_event
.
timestamp_projection
.
as
(
'finished_at'
))
.
limit
(
MAX_RESULTS
)
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
average_by_day
date
=
Arel
::
Nodes
::
NamedFunction
.
new
(
'DATE'
,
[
stage
.
end_event
.
timestamp_projection
])
...
...
ee/spec/fixtures/api/schemas/analytics/cycle_analytics/duration_chart.json
deleted
100644 → 0
View file @
de7dabeb
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"required"
:
[
"duration_in_seconds"
,
"finished_at"
],
"properties"
:
{
"duration_in_seconds"
:
{
"type"
:
"integer"
},
"finished_at"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
}
ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb
View file @
8a5ddea1
...
...
@@ -104,16 +104,6 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::DataCollector do
expect
(
round_to_days
(
data_collector
.
median
.
seconds
)).
to
eq
(
10
)
end
describe
'#duration_chart_data'
do
subject
{
data_collector
.
duration_chart_data
}
it
'loads data ordered by event time'
do
days
=
subject
.
map
{
|
item
|
round_to_days
(
item
.
duration_in_seconds
)
}
expect
(
days
).
to
eq
([
15
,
10
,
5
])
end
end
describe
'#duration_chart_average_data'
do
subject
{
data_collector
.
duration_chart_average_data
}
...
...
ee/spec/support/shared_examples/controllers/analytics/cycle_analytics/shared_stage_shared_examples.rb
View file @
8a5ddea1
...
...
@@ -251,23 +251,7 @@ RSpec.shared_examples 'Value Stream Analytics Stages controller' do
end
end
describe
'GET #duration_chart'
do
subject
{
get
:duration_chart
,
params:
params
}
it
'matches the response schema'
do
fake_result
=
[
double
(
MergeRequest
,
duration_in_seconds:
10
,
finished_at:
Time
.
current
)]
expect_any_instance_of
(
Gitlab
::
Analytics
::
CycleAnalytics
::
DataForDurationChart
).
to
receive
(
:load
).
and_return
(
fake_result
)
subject
expect
(
response
).
to
match_response_schema
(
'analytics/cycle_analytics/duration_chart'
,
dir:
'ee'
)
end
include_examples
'Value Stream Analytics data endpoint examples'
include_examples
'group permission check on the controller level'
end
describe
'GET #duration_chart'
do
describe
'GET #average_duration_chart'
do
subject
{
get
:average_duration_chart
,
params:
params
}
it
'matches the response schema'
do
...
...
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