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
Tatuya Kamada
gitlab-ce
Commits
9101915c
Commit
9101915c
authored
Jun 23, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Sidekiq queue duration to transaction metrics.
parent
62948886
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/metrics/sidekiq_middleware.rb
lib/gitlab/metrics/sidekiq_middleware.rb
+2
-0
spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb
spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb
+16
-1
No files found.
CHANGELOG
View file @
9101915c
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.10.0 (unreleased)
v 8.10.0 (unreleased)
- Wrap code blocks on Activies and Todos page. !4783 (winniehell)
- Wrap code blocks on Activies and Todos page. !4783 (winniehell)
- Add Sidekiq queue duration to transaction metrics.
- Fix MR-auto-close text added to description. !4836
- Fix MR-auto-close text added to description. !4836
- Implement Subresource Integrity for CSS and JavaScript assets. This prevents malicious assets from loading in the case of a CDN compromise.
- Implement Subresource Integrity for CSS and JavaScript assets. This prevents malicious assets from loading in the case of a CDN compromise.
...
...
lib/gitlab/metrics/sidekiq_middleware.rb
View file @
9101915c
...
@@ -8,6 +8,8 @@ module Gitlab
...
@@ -8,6 +8,8 @@ module Gitlab
trans
=
Transaction
.
new
(
"
#{
worker
.
class
.
name
}
#perform"
)
trans
=
Transaction
.
new
(
"
#{
worker
.
class
.
name
}
#perform"
)
begin
begin
# Old gitlad-shell messages don't provide enqueued_at/created_at attributes
trans
.
set
(
:sidekiq_queue_duration
,
Time
.
now
.
to_f
-
(
message
[
'enqueued_at'
]
||
message
[
'created_at'
]
||
0
))
trans
.
run
{
yield
}
trans
.
run
{
yield
}
ensure
ensure
trans
.
finish
trans
.
finish
...
...
spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb
View file @
9101915c
...
@@ -2,6 +2,7 @@ require 'spec_helper'
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
Metrics
::
SidekiqMiddleware
do
describe
Gitlab
::
Metrics
::
SidekiqMiddleware
do
let
(
:middleware
)
{
described_class
.
new
}
let
(
:middleware
)
{
described_class
.
new
}
let
(
:message
)
{
{
'args'
=>
[
'test'
],
'enqueued_at'
=>
Time
.
new
(
2016
,
6
,
23
,
6
,
59
).
to_f
}
}
describe
'#call'
do
describe
'#call'
do
it
'tracks the transaction'
do
it
'tracks the transaction'
do
...
@@ -11,9 +12,23 @@ describe Gitlab::Metrics::SidekiqMiddleware do
...
@@ -11,9 +12,23 @@ describe Gitlab::Metrics::SidekiqMiddleware do
with
(
'TestWorker#perform'
).
with
(
'TestWorker#perform'
).
and_call_original
and_call_original
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:set
).
with
(
:sidekiq_queue_duration
,
instance_of
(
Float
))
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:finish
)
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:finish
)
middleware
.
call
(
worker
,
'test'
,
:test
)
{
nil
}
middleware
.
call
(
worker
,
message
,
:test
)
{
nil
}
end
it
'tracks the transaction (for messages without `enqueued_at`)'
do
worker
=
double
(
:worker
,
class:
double
(
:class
,
name:
'TestWorker'
))
expect
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:new
).
with
(
'TestWorker#perform'
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:set
).
with
(
:sidekiq_queue_duration
,
instance_of
(
Float
))
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:finish
)
middleware
.
call
(
worker
,
{},
:test
)
{
nil
}
end
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