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
iv
gitlab-ce
Commits
5771114f
Commit
5771114f
authored
May 26, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename metric to 'rails queue duration'
parent
6ec2730f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
config/initializers/metrics.rb
config/initializers/metrics.rb
+1
-1
lib/gitlab/middleware/rails_queue_duration.rb
lib/gitlab/middleware/rails_queue_duration.rb
+2
-2
spec/lib/gitlab/middleware/rails_queue_duration_spec.rb
spec/lib/gitlab/middleware/rails_queue_duration_spec.rb
+2
-2
No files found.
config/initializers/metrics.rb
View file @
5771114f
...
...
@@ -12,7 +12,7 @@ if Gitlab::Metrics.enabled?
Gitlab
::
Application
.
configure
do
|
config
|
config
.
middleware
.
use
(
Gitlab
::
Metrics
::
RackMiddleware
)
config
.
middleware
.
use
(
Gitlab
::
Middleware
::
ProxyFlightTime
)
config
.
middleware
.
use
(
Gitlab
::
Middleware
::
RailsQueueDuration
)
end
Sidekiq
.
configure_server
do
|
config
|
...
...
lib/gitlab/middleware/
proxy_flight_time
.rb
→
lib/gitlab/middleware/
rails_queue_duration
.rb
View file @
5771114f
...
...
@@ -4,7 +4,7 @@
module
Gitlab
module
Middleware
class
ProxyFlightTime
class
RailsQueueDuration
def
initialize
(
app
)
@app
=
app
end
...
...
@@ -14,7 +14,7 @@ module Gitlab
proxy_start
=
env
[
'HTTP_GITLAB_WORHORSE_PROXY_START'
].
presence
if
trans
&&
proxy_start
# Time in milliseconds since gitlab-workhorse started the request
trans
.
set
(
:
proxy_flight_time
,
Time
.
now
.
to_f
*
1_000
-
proxy_start
.
to_f
/
1_000_000
)
trans
.
set
(
:
rails_queue_duration
,
Time
.
now
.
to_f
*
1_000
-
proxy_start
.
to_f
/
1_000_000
)
end
@app
.
call
(
env
)
...
...
spec/lib/gitlab/middleware/
proxy_flight_time
_spec.rb
→
spec/lib/gitlab/middleware/
rails_queue_duration
_spec.rb
View file @
5771114f
require
'spec_helper'
describe
Gitlab
::
Middleware
::
ProxyFlightTime
do
describe
Gitlab
::
Middleware
::
RailsQueueDuration
do
let
(
:app
)
{
double
(
:app
)
}
let
(
:middleware
)
{
described_class
.
new
(
app
)
}
let
(
:env
)
{
{}
}
...
...
@@ -23,7 +23,7 @@ describe Gitlab::Middleware::ProxyFlightTime do
it
'sets proxy_flight_time and calls the app when the header is present'
do
env
[
'HTTP_GITLAB_WORHORSE_PROXY_START'
]
=
'123'
expect
(
transaction
).
to
receive
(
:set
).
with
(
:
proxy_flight_time
,
an_instance_of
(
Float
))
expect
(
transaction
).
to
receive
(
:set
).
with
(
:
rails_queue_duration
,
an_instance_of
(
Float
))
expect
(
middleware
.
call
(
env
)).
to
eq
(
'yay'
)
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