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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
a9982762
Commit
a9982762
authored
Nov 21, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added analytics stage serializer and moved some info to the stage classes from the controller
parent
3268e377
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
59 additions
and
0 deletions
+59
-0
app/serializers/analytics_stage_entity.rb
app/serializers/analytics_stage_entity.rb
+12
-0
app/serializers/analytics_stage_serializer.rb
app/serializers/analytics_stage_serializer.rb
+3
-0
lib/gitlab/cycle_analytics/base_stage.rb
lib/gitlab/cycle_analytics/base_stage.rb
+2
-0
lib/gitlab/cycle_analytics/code_stage.rb
lib/gitlab/cycle_analytics/code_stage.rb
+6
-0
lib/gitlab/cycle_analytics/issue_stage.rb
lib/gitlab/cycle_analytics/issue_stage.rb
+6
-0
lib/gitlab/cycle_analytics/plan_stage.rb
lib/gitlab/cycle_analytics/plan_stage.rb
+6
-0
lib/gitlab/cycle_analytics/production_stage.rb
lib/gitlab/cycle_analytics/production_stage.rb
+6
-0
lib/gitlab/cycle_analytics/review_stage.rb
lib/gitlab/cycle_analytics/review_stage.rb
+6
-0
lib/gitlab/cycle_analytics/staging_stage.rb
lib/gitlab/cycle_analytics/staging_stage.rb
+6
-0
lib/gitlab/cycle_analytics/test_stage.rb
lib/gitlab/cycle_analytics/test_stage.rb
+6
-0
No files found.
app/serializers/analytics_stage_entity.rb
0 → 100644
View file @
a9982762
class
AnalyticsStageEntity
<
Grape
::
Entity
include
EntityDateHelper
expose
:stage
,
as: :title
do
|
object
|
object
[
:stage
].
to_s
.
capitalize
end
expose
:description
expose
:median
,
as: :value
do
|
stage
|
stage
[
:median
]
&&
!
stage
[
:median
].
zero?
?
distance_of_time_in_words
(
stage
[
:median
])
:
nil
end
end
app/serializers/analytics_stage_serializer.rb
0 → 100644
View file @
a9982762
class
AnalyticsStageSerializer
<
BaseSerializer
entity
AnalyticsStageEntity
end
lib/gitlab/cycle_analytics/base_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
BaseStage
class
BaseStage
attr_reader
:stage
,
:description
def
initialize
(
project
:,
options
:,
stage:
stage
)
def
initialize
(
project
:,
options
:,
stage:
stage
)
@project
=
project
@project
=
project
@options
=
options
@options
=
options
...
...
lib/gitlab/cycle_analytics/code_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
CodeStage
<
BaseStage
class
CodeStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"Time until first merge request"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:code
,
@fetcher
.
calculate_metric
(
:code
,
Issue
::
Metrics
.
arel_table
[
:first_mentioned_in_commit_at
],
Issue
::
Metrics
.
arel_table
[
:first_mentioned_in_commit_at
],
...
...
lib/gitlab/cycle_analytics/issue_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
IssueStage
<
BaseStage
class
IssueStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"Time before an issue gets scheduled"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:issue
,
@fetcher
.
calculate_metric
(
:issue
,
Issue
.
arel_table
[
:created_at
],
Issue
.
arel_table
[
:created_at
],
...
...
lib/gitlab/cycle_analytics/plan_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
PlanStage
<
BaseStage
class
PlanStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"Time before an issue starts implementation"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:plan
,
@fetcher
.
calculate_metric
(
:plan
,
[
Issue
::
Metrics
.
arel_table
[
:first_associated_with_milestone_at
],
[
Issue
::
Metrics
.
arel_table
[
:first_associated_with_milestone_at
],
...
...
lib/gitlab/cycle_analytics/production_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
ProductionStage
<
BaseStage
class
ProductionStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"From issue creation until deploy to production"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:production
,
@fetcher
.
calculate_metric
(
:production
,
Issue
.
arel_table
[
:created_at
],
Issue
.
arel_table
[
:created_at
],
...
...
lib/gitlab/cycle_analytics/review_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
ReviewStage
<
BaseStage
class
ReviewStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"Time between merge request creation and merge/close"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:review
,
@fetcher
.
calculate_metric
(
:review
,
MergeRequest
.
arel_table
[
:created_at
],
MergeRequest
.
arel_table
[
:created_at
],
...
...
lib/gitlab/cycle_analytics/staging_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
StagingStage
<
BaseStage
class
StagingStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"From merge request merge until deploy to production"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:staging
,
@fetcher
.
calculate_metric
(
:staging
,
MergeRequest
::
Metrics
.
arel_table
[
:merged_at
],
MergeRequest
::
Metrics
.
arel_table
[
:merged_at
],
...
...
lib/gitlab/cycle_analytics/test_stage.rb
View file @
a9982762
module
Gitlab
module
Gitlab
module
CycleAnalytics
module
CycleAnalytics
class
TestStage
<
BaseStage
class
TestStage
<
BaseStage
def
initialize
(
*
args
)
super
(
*
args
)
@description
=
"Total test time for all commits/merges"
end
def
median
def
median
@fetcher
.
calculate_metric
(
:test
,
@fetcher
.
calculate_metric
(
:test
,
MergeRequest
::
Metrics
.
arel_table
[
:latest_build_started_at
],
MergeRequest
::
Metrics
.
arel_table
[
:latest_build_started_at
],
...
...
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