summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-07-24 12:37:05 +0100
committerSean McGivern <sean@gitlab.com>2019-07-25 15:42:44 +0100
commit1cd04412603b94f6b6b2711a603fab5801d0aeea (patch)
treebe4be4764a23e256629ba220c8604f473b820010
parentba997f3c428d94adfc9a2eb4eb0daaa3d759c4df (diff)
downloadgitlab-ce-remove-line-profile-from-performance-bar.tar.gz
Remove line profiler from performance barremove-line-profile-from-performance-bar
1. The output isn't great. It can be hard to find hotspots and, even when you do find them, to find why those are hotspots. 2. It uses some jQuery-specific frontend code which we can remove now that we don't have this any more. 3. It's only possible to profile the initial request, not any subsequent AJAX requests.
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock4
-rw-r--r--app/assets/javascripts/performance_bar/components/performance_bar_app.vue23
-rw-r--r--app/assets/stylesheets/performance_bar.scss11
-rw-r--r--app/controllers/concerns/with_performance_bar.rb4
-rw-r--r--app/views/peek/_bar.html.haml3
-rw-r--r--changelogs/unreleased/remove-line-profile-from-performance-bar.yml5
-rw-r--r--config/initializers/peek.rb1
-rw-r--r--doc/administration/monitoring/performance/img/performance_bar.pngbin127198 -> 113617 bytes
-rw-r--r--doc/administration/monitoring/performance/img/performance_bar_line_profiling.pngbin93063 -> 0 bytes
-rw-r--r--doc/administration/monitoring/performance/performance_bar.md2
-rw-r--r--lib/peek/rblineprof/custom_controller_helpers.rb124
-rw-r--r--lib/peek/views/redis_detailed.rb2
-rw-r--r--locale/gitlab.pot3
-rw-r--r--vendor/licenses.csv1
15 files changed, 7 insertions, 177 deletions
diff --git a/Gemfile b/Gemfile
index ba958c6ae10..9b468fdcd7f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -298,7 +298,6 @@ gem 'batch-loader', '~> 1.4.0'
gem 'peek', '~> 1.0.1'
gem 'peek-gc', '~> 0.0.2'
gem 'peek-pg', '~> 1.3.0', group: :postgres
-gem 'peek-rblineprof', '~> 0.2.0'
# Memory benchmarks
gem 'derailed_benchmarks', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 7e26c5bbc45..b6dda9b2e99 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -648,9 +648,6 @@ GEM
concurrent-ruby-ext
peek
pg
- peek-rblineprof (0.2.0)
- peek
- rblineprof
pg (1.1.4)
po_to_json (1.0.1)
json (>= 1.6.0)
@@ -1185,7 +1182,6 @@ DEPENDENCIES
peek (~> 1.0.1)
peek-gc (~> 0.0.2)
peek-pg (~> 1.3.0)
- peek-rblineprof (~> 0.2.0)
pg (~> 1.1)
premailer-rails (~> 1.9.7)
prometheus-client-mmap (~> 0.9.8)
diff --git a/app/assets/javascripts/performance_bar/components/performance_bar_app.vue b/app/assets/javascripts/performance_bar/components/performance_bar_app.vue
index f05db8376a4..5a98dc58c64 100644
--- a/app/assets/javascripts/performance_bar/components/performance_bar_app.vue
+++ b/app/assets/javascripts/performance_bar/components/performance_bar_app.vue
@@ -1,5 +1,4 @@
<script>
-import $ from 'jquery';
import { glEmojiTag } from '~/emoji';
import detailedMetric from './detailed_metric.vue';
@@ -28,10 +27,6 @@ export default {
type: String,
required: true,
},
- profileUrl: {
- type: String,
- required: true,
- },
},
detailedMetrics: [
{ metric: 'pg', header: s__('PerformanceBar|SQL queries'), details: 'queries', keys: ['sql'] },
@@ -72,9 +67,6 @@ export default {
initialRequest() {
return this.currentRequestId === this.requestId;
},
- lineProfileModal() {
- return $('#modal-peek-line-profile');
- },
hasHost() {
return this.currentRequest && this.currentRequest.details && this.currentRequest.details.host;
},
@@ -88,10 +80,6 @@ export default {
},
mounted() {
this.currentRequest = this.requestId;
-
- if (this.lineProfileModal.length) {
- this.lineProfileModal.modal('toggle');
- }
},
methods: {
changeCurrentRequest(newRequestId) {
@@ -122,17 +110,6 @@ export default {
:details="metric.details"
:keys="metric.keys"
/>
- <div v-if="initialRequest" id="peek-view-rblineprof" class="view">
- <button
- v-if="lineProfileModal.length"
- class="btn-link btn-blank"
- data-toggle="modal"
- data-target="#modal-peek-line-profile"
- >
- {{ s__('PerformanceBar|profile') }}
- </button>
- <a v-else :href="profileUrl">{{ s__('PerformanceBar|profile') }}</a>
- </div>
<div id="peek-view-gc" class="view">
<span v-if="currentRequest.details" class="bold">
<span title="Invoke Time">{{ currentRequest.details.gc.gc_time }}</span
diff --git a/app/assets/stylesheets/performance_bar.scss b/app/assets/stylesheets/performance_bar.scss
index 5a8940ffd6d..ad7d87f0bf6 100644
--- a/app/assets/stylesheets/performance_bar.scss
+++ b/app/assets/stylesheets/performance_bar.scss
@@ -1,6 +1,5 @@
@import 'framework/variables';
@import 'framework/variables_overrides';
-@import 'peek/views/rblineprof';
#js-peek {
position: fixed;
@@ -128,13 +127,3 @@
#modal-peek-pg-queries-content {
color: $black;
}
-
-.peek-rblineprof-file {
- pre.duration {
- width: 280px;
- }
-
- .data {
- overflow: visible;
- }
-}
diff --git a/app/controllers/concerns/with_performance_bar.rb b/app/controllers/concerns/with_performance_bar.rb
index 77c3d476ac6..4e0ae3c59eb 100644
--- a/app/controllers/concerns/with_performance_bar.rb
+++ b/app/controllers/concerns/with_performance_bar.rb
@@ -3,10 +3,6 @@
module WithPerformanceBar
extend ActiveSupport::Concern
- included do
- include Peek::Rblineprof::CustomControllerHelpers
- end
-
def peek_enabled?
return false unless Gitlab::PerformanceBar.enabled?(current_user)
diff --git a/app/views/peek/_bar.html.haml b/app/views/peek/_bar.html.haml
index 89d3b931f88..5228930293c 100644
--- a/app/views/peek/_bar.html.haml
+++ b/app/views/peek/_bar.html.haml
@@ -2,6 +2,5 @@
#js-peek{ data: { env: Peek.env,
request_id: Peek.request_id,
- peek_url: "#{peek_routes_path}/results",
- profile_url: url_for(safe_params.merge(lineprofiler: 'true')) },
+ peek_url: "#{peek_routes_path}/results" },
class: Peek.env }
diff --git a/changelogs/unreleased/remove-line-profile-from-performance-bar.yml b/changelogs/unreleased/remove-line-profile-from-performance-bar.yml
new file mode 100644
index 00000000000..c1c7450fbbd
--- /dev/null
+++ b/changelogs/unreleased/remove-line-profile-from-performance-bar.yml
@@ -0,0 +1,5 @@
+---
+title: Remove line profiler from performance bar
+merge_request:
+author:
+type: removed
diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb
index 8416ae430c7..0976b93fc5f 100644
--- a/config/initializers/peek.rb
+++ b/config/initializers/peek.rb
@@ -24,7 +24,6 @@ end
Peek.into PEEK_DB_VIEW
Peek.into Peek::Views::Gitaly
-Peek.into Peek::Views::Rblineprof
Peek.into Peek::Views::RedisDetailed
Peek.into Peek::Views::Rugged
Peek.into Peek::Views::GC
diff --git a/doc/administration/monitoring/performance/img/performance_bar.png b/doc/administration/monitoring/performance/img/performance_bar.png
index 8a6f8b3b273..89b09054d46 100644
--- a/doc/administration/monitoring/performance/img/performance_bar.png
+++ b/doc/administration/monitoring/performance/img/performance_bar.png
Binary files differ
diff --git a/doc/administration/monitoring/performance/img/performance_bar_line_profiling.png b/doc/administration/monitoring/performance/img/performance_bar_line_profiling.png
deleted file mode 100644
index a55ce753101..00000000000
--- a/doc/administration/monitoring/performance/img/performance_bar_line_profiling.png
+++ /dev/null
Binary files differ
diff --git a/doc/administration/monitoring/performance/performance_bar.md b/doc/administration/monitoring/performance/performance_bar.md
index 15eab7dcab0..2cc78ccc03c 100644
--- a/doc/administration/monitoring/performance/performance_bar.md
+++ b/doc/administration/monitoring/performance/performance_bar.md
@@ -14,8 +14,6 @@ It allows you to see (from left to right):
![Gitaly profiling using the Performance Bar](img/performance_bar_gitaly_calls.png)
- time taken and number of [Rugged] calls, click through for details of these calls
![Rugged profiling using the Performance Bar](img/performance_bar_rugged_calls.png)
-- profile of the code used to generate the page, line by line. In the profile view, the numbers in the left panel represent wall time, cpu time, and number of calls (based on [rblineprof](https://github.com/tmm1/rblineprof)).
- ![Line profiling using the Performance Bar](img/performance_bar_line_profiling.png)
- time taken and number of Redis calls, click through for details of these calls
![Redis profiling using the Performance Bar](img/performance_bar_redis_calls.png)
- time taken and number of Ruby GC calls
diff --git a/lib/peek/rblineprof/custom_controller_helpers.rb b/lib/peek/rblineprof/custom_controller_helpers.rb
deleted file mode 100644
index 581cc6a37b4..00000000000
--- a/lib/peek/rblineprof/custom_controller_helpers.rb
+++ /dev/null
@@ -1,124 +0,0 @@
-# frozen_string_literal: true
-
-module Peek
- module Rblineprof
- module CustomControllerHelpers
- extend ActiveSupport::Concern
-
- # This will become useless once https://github.com/peek/peek-rblineprof/pull/5
- # is merged
- def pygmentize(file_name, code, lexer = nil)
- if lexer.present?
- Gitlab::Highlight.highlight(file_name, code)
- else
- "<pre>#{Rack::Utils.escape_html(code)}</pre>"
- end
- end
-
- # rubocop:disable all
- def inject_rblineprof
- ret = nil
- profile = lineprof(rblineprof_profiler_regex) do
- ret = yield
- end
-
- if response.content_type =~ %r|text/html|
- sort = params[:lineprofiler_sort]
- mode = params[:lineprofiler_mode] || 'cpu'
- min = (params[:lineprofiler_min] || 5).to_i * 1000
- summary = params[:lineprofiler_summary]
-
- # Sort each file by the longest calculated time
- per_file = profile.map do |file, lines|
- total, child, excl, total_cpu, child_cpu, excl_cpu = lines[0]
-
- wall = summary == 'exclusive' ? excl : total
- cpu = summary == 'exclusive' ? excl_cpu : total_cpu
- idle = summary == 'exclusive' ? (excl - excl_cpu) : (total - total_cpu)
-
- [
- file, lines,
- wall, cpu, idle,
- sort == 'idle' ? idle : sort == 'cpu' ? cpu : wall
- ]
- end.sort_by{ |a,b,c,d,e,f| -f }
-
- output = ["<div class='modal-dialog modal-xl'><div class='modal-content'>"]
- output << "<div class='modal-header'>"
- output << "<h4>Line profiling: #{human_description(params[:lineprofiler])}</h4>"
- output << "<button class='close' type='button' data-dismiss='modal' aria-label='close'><span aria-hidden='true'>&times;</span></button>"
- output << "</div>"
- output << "<div class='modal-body'>"
-
- per_file.each do |file_name, lines, file_wall, file_cpu, file_idle, file_sort|
- output << "<div class='peek-rblineprof-file'><div class='heading'>"
-
- show_src = file_sort > min
- tmpl = show_src ? "<a href='#' class='js-lineprof-file'>%s</a>" : "%s"
-
- if mode == 'cpu'
- output << sprintf("<span class='duration'>% 8.1fms + % 8.1fms</span> #{tmpl}", file_cpu / 1000.0, file_idle / 1000.0, file_name.sub(Rails.root.to_s + '/', ''))
- else
- output << sprintf("<span class='duration'>% 8.1fms</span> #{tmpl}", file_wall/1000.0, file_name.sub(Rails.root.to_s + '/', ''))
- end
-
- output << "</div>" # .heading
-
- next unless show_src
-
- output << "<div class='data'>"
- code = []
- times = []
- File.readlines(file_name).each_with_index do |line, i|
- code << line
- wall, cpu, calls = lines[i + 1]
-
- if calls && calls > 0
- if mode == 'cpu'
- idle = wall - cpu
- times << sprintf("% 8.1fms + % 8.1fms (% 5d)", cpu / 1000.0, idle / 1000.0, calls)
- else
- times << sprintf("% 8.1fms (% 5d)", wall / 1000.0, calls)
- end
- else
- times << ' '
- end
- end
- output << "<pre class='duration'>#{times.join("\n")}</pre>"
- # The following line was changed from
- # https://github.com/peek/peek-rblineprof/blob/8d3b7a283a27de2f40abda45974516693d882258/lib/peek/rblineprof/controller_helpers.rb#L125
- # This will become useless once https://github.com/peek/peek-rblineprof/pull/16
- # is merged and is implemented.
- output << "<pre class='code highlight white'>#{pygmentize(file_name, code.join, 'ruby')}</pre>"
- output << "</div></div>" # .data then .peek-rblineprof-file
- end
-
- output << "</div></div></div>"
-
- response.body += "<div class='modal' id='modal-peek-line-profile' tabindex=-1>#{output.join}</div>".html_safe
- end
-
- ret
- end
-
- private
-
- def human_description(lineprofiler_param)
- case lineprofiler_param
- when 'app'
- 'app/ & lib/'
- when 'views'
- 'app/view/'
- when 'gems'
- 'vendor/gems'
- when 'all'
- 'everything in Rails.root'
- when 'stdlib'
- 'everything in the Ruby standard library'
- else
- 'app/, config/, lib/, vendor/ & plugin/'
- end
- end
- end
- end
-end
diff --git a/lib/peek/views/redis_detailed.rb b/lib/peek/views/redis_detailed.rb
index c61a1e91282..907f7795f9f 100644
--- a/lib/peek/views/redis_detailed.rb
+++ b/lib/peek/views/redis_detailed.rb
@@ -22,7 +22,7 @@ module Gitlab
detail_store << {
cmd: args.first,
duration: duration,
- backtrace: Gitlab::Profiler.clean_backtrace(caller)
+ backtrace: ::Gitlab::Profiler.clean_backtrace(caller)
}
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index cbab027d4a3..d954ad9b7cd 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -7412,9 +7412,6 @@ msgstr ""
msgid "PerformanceBar|SQL queries"
msgstr ""
-msgid "PerformanceBar|profile"
-msgstr ""
-
msgid "PerformanceBar|trace"
msgstr ""
diff --git a/vendor/licenses.csv b/vendor/licenses.csv
index 0c52cb5a947..9cf638090c1 100644
--- a/vendor/licenses.csv
+++ b/vendor/licenses.csv
@@ -817,7 +817,6 @@ peek,1.0.1,MIT
peek-gc,0.0.2,MIT
peek-mysql2,1.1.0,MIT
peek-pg,1.3.0,MIT
-peek-rblineprof,0.2.0,MIT
peek-redis,1.2.0,MIT
pg,0.18.4,"BSD,ruby,GPL"
pify,3.0.0,MIT