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
1f31c845
Commit
1f31c845
authored
Aug 07, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-add-ci-metrics' into 'master'
Add two more metrics for CI/CD See merge request !13039
parents
b9d4cb34
5f86347e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+24
-0
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+18
-0
No files found.
app/services/ci/register_job_service.rb
View file @
1f31c845
...
@@ -30,6 +30,7 @@ module Ci
...
@@ -30,6 +30,7 @@ module Ci
# with StateMachines::InvalidTransition or StaleObjectError when doing run! or save method.
# with StateMachines::InvalidTransition or StaleObjectError when doing run! or save method.
build
.
runner_id
=
runner
.
id
build
.
runner_id
=
runner
.
id
build
.
run!
build
.
run!
register_success
(
build
)
return
Result
.
new
(
build
,
true
)
return
Result
.
new
(
build
,
true
)
rescue
StateMachines
::
InvalidTransition
,
ActiveRecord
::
StaleObjectError
rescue
StateMachines
::
InvalidTransition
,
ActiveRecord
::
StaleObjectError
...
@@ -46,6 +47,7 @@ module Ci
...
@@ -46,6 +47,7 @@ module Ci
end
end
end
end
register_failure
Result
.
new
(
nil
,
valid
)
Result
.
new
(
nil
,
valid
)
end
end
...
@@ -81,5 +83,27 @@ module Ci
...
@@ -81,5 +83,27 @@ module Ci
def
shared_runner_build_limits_feature_enabled?
def
shared_runner_build_limits_feature_enabled?
ENV
[
'DISABLE_SHARED_RUNNER_BUILD_MINUTES_LIMIT'
].
to_s
!=
'true'
ENV
[
'DISABLE_SHARED_RUNNER_BUILD_MINUTES_LIMIT'
].
to_s
!=
'true'
end
end
def
register_failure
failed_attempt_counter
.
increase
attempt_counter
.
increase
end
def
register_success
(
job
)
job_queue_duration_seconds
.
observe
({
shared_runner:
@runner
.
shared?
},
Time
.
now
-
job
.
created_at
)
attempt_counter
.
increase
end
def
failed_attempt_counter
@failed_attempt_counter
||=
Gitlab
::
Metrics
.
counter
(
:job_register_attempts_failed_total
,
"Counts the times a runner tries to register a job"
)
end
def
attempt_counter
@attempt_counter
||=
Gitlab
::
Metrics
.
counter
(
:job_register_attempts_total
,
"Counts the times a runner tries to register a job"
)
end
def
job_queue_duration_seconds
@job_queue_duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
:job_queue_duration_seconds
,
'Request handling execution time'
)
end
end
end
end
end
app/services/projects/update_pages_service.rb
View file @
1f31c845
...
@@ -33,8 +33,10 @@ module Projects
...
@@ -33,8 +33,10 @@ module Projects
success
success
end
end
rescue
=>
e
rescue
=>
e
register_failure
error
(
e
.
message
)
error
(
e
.
message
)
ensure
ensure
register_attempt
build
.
erase_artifacts!
unless
build
.
has_expiring_artifacts?
build
.
erase_artifacts!
unless
build
.
has_expiring_artifacts?
end
end
...
@@ -168,5 +170,21 @@ module Projects
...
@@ -168,5 +170,21 @@ module Projects
def
sha
def
sha
build
.
sha
build
.
sha
end
end
def
register_attempt
pages_deployments_total_counter
.
increase
end
def
register_failure
pages_deployments_failed_total_counter
.
increase
end
def
pages_deployments_total_counter
@pages_deployments_total_counter
||=
Gitlab
::
Metrics
.
counter
(
:pages_deployments_total
,
"Counter of GitLab Pages deployments triggered"
)
end
def
pages_deployments_failed_total_counter
@pages_deployments_failed_total_counter
||=
Gitlab
::
Metrics
.
counter
(
:pages_deployments_failed_total
,
"Counter of GitLab Pages deployments which failed"
)
end
end
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