diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-08 18:09:08 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-09 17:21:39 +0200 |
commit | d1b4576a79660d0f3360616ec746a06ed0ce62bb (patch) | |
tree | e015d6d6258674c462d6472512da390184824005 | |
parent | 058aeb1ce7e45baf7ebb16a435924554501712ba (diff) | |
download | gitlab-ce-d1b4576a79660d0f3360616ec746a06ed0ce62bb.tar.gz |
Ensure peek-performance_bar doesn't break existing functionalities
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | app/views/peek/views/_mysql2.html.haml | 14 | ||||
-rw-r--r-- | config/initializers/peek.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb | 22 |
3 files changed, 40 insertions, 0 deletions
diff --git a/app/views/peek/views/_mysql2.html.haml b/app/views/peek/views/_mysql2.html.haml new file mode 100644 index 00000000000..5a58c719c73 --- /dev/null +++ b/app/views/peek/views/_mysql2.html.haml @@ -0,0 +1,14 @@ +%strong + %a#peek-show-queries{ href: '#' } + %span{ data: { defer_to: "#{view.defer_key}-duration" } }... + \/ + %span{ data: { defer_to: "#{view.defer_key}-calls" } }... +#modal-peek-pg-queries.modal{ tabindex: -1 } + .modal-dialog + #modal-peek-pg-queries-content.modal-content + .modal-header + %a.close{ href: "#", "data-dismiss" => "modal" } × + %h4 + SQL queries + .modal-body{ data: { defer_to: "#{view.defer_key}-queries" } }... +mysql diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index c1c65cedccf..65432caac2a 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -26,3 +26,7 @@ class PEEK_DB_CLIENT end PEEK_DB_VIEW.prepend ::Gitlab::PerformanceBar::PeekQueryTracker + +class Peek::Views::PerformanceBar::ProcessUtilization + prepend ::Gitlab::PerformanceBar::PeekPerformanceBarWithRackBody +end diff --git a/lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb b/lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb new file mode 100644 index 00000000000..d939a6ea18d --- /dev/null +++ b/lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb @@ -0,0 +1,22 @@ +# This solves a bug with a X-Senfile header that wouldn't be set properly, see +# https://github.com/peek/peek-performance_bar/pull/27 +module Gitlab + module PerformanceBar + module PeekPerformanceBarWithRackBody + def call(env) + @env = env + reset_stats + + @total_requests += 1 + first_request if @total_requests == 1 + + env['process.request_start'] = @start.to_f + env['process.total_requests'] = total_requests + + status, headers, body = @app.call(env) + body = Rack::BodyProxy.new(body) { record_request } + [status, headers, body] + end + end + end +end |