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
cee07c59
Commit
cee07c59
authored
May 24, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Measure proxy timing: needs influxdb code
parent
baa9c660
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
config/initializers/proxy_timing.rb
config/initializers/proxy_timing.rb
+1
-0
lib/gitlab/middleware/proxy_timing.rb
lib/gitlab/middleware/proxy_timing.rb
+22
-0
No files found.
config/initializers/proxy_timing.rb
0 → 100644
View file @
cee07c59
Rails
.
application
.
config
.
middleware
.
use
(
Gitlab
::
Middleware
::
ProxyTiming
)
lib/gitlab/middleware/proxy_timing.rb
0 → 100644
View file @
cee07c59
# This Rack middleware is intended to measure the latency between
# gitlab-workhorse forwarding a request to the Rails application and the
# time this middleware is reached.
module
Gitlab
module
Middleware
class
ProxyTiming
def
initialize
(
app
)
@app
=
app
end
def
call
(
env
)
proxy_start
=
env
[
'HTTP_GITLAB_WORHORSE_PROXY_START'
].
to_f
/
1_000_000_000
if
proxy_start
>
0
# send measurement
puts
"
\n\n\n
#{
(
Time
.
now
-
proxy_start
).
to_f
}
\n\n\n
"
end
@app
.
call
(
env
)
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