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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3ac1d9ad
Commit
3ac1d9ad
authored
Sep 20, 2019
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Init http_request_duration_seconds metric
parent
880cb155
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
config/initializers/7_prometheus_metrics.rb
config/initializers/7_prometheus_metrics.rb
+2
-0
lib/gitlab/metrics/requests_rack_middleware.rb
lib/gitlab/metrics/requests_rack_middleware.rb
+11
-0
No files found.
config/initializers/7_prometheus_metrics.rb
View file @
3ac1d9ad
...
...
@@ -30,6 +30,8 @@ Gitlab::Application.configure do |config|
config
.
middleware
.
insert
(
1
,
Gitlab
::
Metrics
::
RequestsRackMiddleware
)
end
Gitlab
::
Metrics
::
RequestsRackMiddleware
.
initialize_http_request_duration_seconds
Sidekiq
.
configure_server
do
|
config
|
config
.
on
(
:startup
)
do
# webserver metrics are cleaned up in config.ru: `warmup` block
...
...
lib/gitlab/metrics/requests_rack_middleware.rb
View file @
3ac1d9ad
...
...
@@ -3,6 +3,9 @@
module
Gitlab
module
Metrics
class
RequestsRackMiddleware
METHODS
=
%w(delete get head options patch post put trace)
.
freeze
STATUSES
=
%w(200 301 304 400 401 403 404 500)
.
freeze
def
initialize
(
app
)
@app
=
app
end
...
...
@@ -20,6 +23,14 @@ module Gitlab
{},
[
0.05
,
0.1
,
0.25
,
0.5
,
0.7
,
1
,
2.5
,
5
,
10
,
25
])
end
def
self
.
initialize_http_request_duration_seconds
METHODS
.
each
do
|
method
|
STATUSES
.
each
do
|
status
|
::
Gitlab
::
Metrics
.
histogram
(
:http_request_duration_seconds
,
'Request handling execution time'
).
get
({
method:
method
,
status:
status
})
end
end
end
def
call
(
env
)
method
=
env
[
'REQUEST_METHOD'
].
downcase
started
=
Time
.
now
.
to_f
...
...
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