rack-mini-profiler 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7544df4d22f5f615b146fb0d63f18098ffd702ac9dec966d8040187f2e8302b9
4
- data.tar.gz: 7c39c41a96205c8c7fbd69765ab5f1e0a3a3a37950055fc58d0f27f4a0591e0f
3
+ metadata.gz: bced31d81d2044a03b4c98ccd43359253866115a7cdec13897155df6df2cf58b
4
+ data.tar.gz: ef8fe2fa2f9ab20c6d8d2fe9138e693ce9891ad40d4af37d7e4cad86b1edc233
5
5
  SHA512:
6
- metadata.gz: 6e3f5f9a51fc5395dda4a7e793903f998513499d850aeb291fe036171a78617d11c3d8cd6fef57d1144359aa4992055ad54ba878075896c3d0280c426a84e3be
7
- data.tar.gz: c4e353c8442db93f29d11d04e2724e6c3f8dacaaf082210acbbb7d47655ffc3a6b5297079750e305fe9f1cd3e7efb1d806aef0ec68bbc1a8e40a0f958de0ec52
6
+ metadata.gz: e8d03dadee75d6e1bccff74b9b8359fdc6b4c574652874b0f6c70e873c8ce7c131a25114051f5001bc906add142c4660786b7d8efff2242702b9b4327fdce6b6
7
+ data.tar.gz: 5399488dbf48cb7c270a8095f3555965015eccf2abb0aeeeb2190dec604a4748e7ad43ea5ca3d295d8238e4369fbdc95a6322661e6b5274dc665e2ad6ed9298e
data/CHANGELOG.md CHANGED
@@ -1,11 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.1.1 - 2023-08-01
4
+
5
+ - [FIX] Include configured base path in speedscope iframe URL [#587](https://github.com/MiniProfiler/rack-mini-profiler/pull/587)
6
+ - [FIX] Race condition starting CacheCleanupThread [#586](https://github.com/MiniProfiler/rack-mini-profiler/pull/586)
7
+ - [FEATURE] Add controller name to description [#567](https://github.com/MiniProfiler/rack-mini-profiler/pull/567)
8
+ - [FIX] 'more' link w/HTTPS [#574](https://github.com/MiniProfiler/rack-mini-profiler/pull/574)
9
+
3
10
  ## 3.1.0 - 2023-04-11
4
11
 
5
12
  - [FEATURE] The query parameter that RMP uses (by default, pp) is now configurable [#553](https://github.com/MiniProfiler/rack-mini-profiler/pull/553)
6
13
  - [FEATURE] You can now opt-out of the Net::HTTP patch by using RACK_MINI_PROFILER_PATCH_NET_HTTP="false"
7
14
  - [FIX] Error responses now include header values from the app, and stackprof not installed message now has correct content [#547](https://github.com/MiniProfiler/rack-mini-profiler/pull/547)
8
- - [FIX] RMP pages now have more valid HTML, with title elements [#562](https://github.com/MiniProfiler/rack-mini-profiler/pull/562)
15
+ - [FIX] RMP pages now have more valid HTML, with title elements [#552](https://github.com/MiniProfiler/rack-mini-profiler/pull/552)
9
16
  - [BREAKING CHANGE] Ruby 2.4 and Ruby 2.5 are no longer supported.
10
17
  - [FIX] Now works with apps that don't otherwise require erb [#531](https://github.com/MiniProfiler/rack-mini-profiler/pull/531)
11
18
  - [DOCS] Added Heroku Redis instructions
data/lib/html/includes.js CHANGED
@@ -1240,11 +1240,8 @@ var _MiniProfiler = (function() {
1240
1240
  return options.path + "flamegraph?id=" + id;
1241
1241
  },
1242
1242
  moreUrl: function moreUrl(requestName) {
1243
- var requestParts = requestName.split(" ");
1244
- var linkSrc =
1245
- requestParts[0] == "GET" ? requestParts[1] : window.location.href;
1246
- var linkSuffix = linkSrc.indexOf("?") > 0 ? "&pp=help" : "?pp=help";
1247
- return linkSrc + linkSuffix;
1243
+ var linkSuffix = requestName.indexOf("?") > 0 ? "&pp=help" : "?pp=help";
1244
+ return requestName + linkSuffix;
1248
1245
  },
1249
1246
  getClientTimings: function getClientTimings(clientTimings) {
1250
1247
  var list = [];
@@ -141,7 +141,7 @@
141
141
 
142
142
  <script id="linksTemplate" type="text/x-dot-tmpl">
143
143
  <a href="{{= MiniProfiler.shareUrl(it.page.id) }}" class="profiler-share-profiler-results" target="_blank">share</a>
144
- <a href="{{= MiniProfiler.moreUrl(it.timing.name) }}" class="profiler-more-actions">more</a>
144
+ <a href="{{= MiniProfiler.moreUrl(it.page.name) }}" class="profiler-more-actions">more</a>
145
145
  {{? it.page.has_flamegraph}}
146
146
  <a href="{{= MiniProfiler.flamegraphUrl(it.page.id) }}" class="profiler-show-flamegraph" target="_blank">flamegraph</a>
147
147
  {{?}}
data/lib/html/vendor.js CHANGED
@@ -11,7 +11,7 @@ var out=' <div class="profiler-result"> <div class="profiler-button ';if(it.has_
11
11
  }
12
12
  MiniProfiler.templates["linksTemplate"] = function anonymous(it
13
13
  ) {
14
- var out=' <a href="'+( MiniProfiler.shareUrl(it.page.id) )+'" class="profiler-share-profiler-results" target="_blank">share</a> <a href="'+( MiniProfiler.moreUrl(it.timing.name) )+'" class="profiler-more-actions">more</a> ';if(it.page.has_flamegraph){out+=' <a href="'+( MiniProfiler.flamegraphUrl(it.page.id) )+'" class="profiler-show-flamegraph" target="_blank">flamegraph</a> ';}out+=' ';if(it.custom_link){out+=' <a href="'+( it.custom_link )+'" class="profiler-custom-link" target="_blank">'+( it.custom_link_name )+'</a> ';}out+=' ';if(it.page.has_trivial_timings){out+=' <a class="profiler-toggle-trivial" data-show-on-load="'+( it.page.has_all_trivial_timings )+'" title="toggles any rows with &lt; '+( it.page.trivial_duration_threshold_milliseconds )+' ms"> show trivial </a> ';}return out;
14
+ var out=' <a href="'+( MiniProfiler.shareUrl(it.page.id) )+'" class="profiler-share-profiler-results" target="_blank">share</a> <a href="'+( MiniProfiler.moreUrl(it.page.name) )+'" class="profiler-more-actions">more</a> ';if(it.page.has_flamegraph){out+=' <a href="'+( MiniProfiler.flamegraphUrl(it.page.id) )+'" class="profiler-show-flamegraph" target="_blank">flamegraph</a> ';}out+=' ';if(it.custom_link){out+=' <a href="'+( it.custom_link )+'" class="profiler-custom-link" target="_blank">'+( it.custom_link_name )+'</a> ';}out+=' ';if(it.page.has_trivial_timings){out+=' <a class="profiler-toggle-trivial" data-show-on-load="'+( it.page.has_all_trivial_timings )+'" title="toggles any rows with &lt; '+( it.page.trivial_duration_threshold_milliseconds )+' ms"> show trivial </a> ';}return out;
15
15
  }
16
16
  MiniProfiler.templates["timingTemplate"] = function anonymous(it
17
17
  ) {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Rack
3
3
  class MiniProfiler
4
- ASSET_VERSION = '35a79b300ab5afa978cb59af0b05e059'
4
+ ASSET_VERSION = '90a68676a0c0d704b4438ca3f27d46c4'
5
5
  end
6
6
  end
@@ -10,11 +10,11 @@ module Rack
10
10
  class CacheCleanupThread < Thread
11
11
 
12
12
  def initialize(interval, cycle, store)
13
- super
14
13
  @store = store
15
14
  @interval = interval
16
15
  @cycle = cycle
17
16
  @cycle_count = 1
17
+ super
18
18
  end
19
19
 
20
20
  def should_cleanup?
@@ -78,7 +78,7 @@ module Rack
78
78
  cleanup_cycle = args.fetch(:cleanup_cycle) { CLEANUP_CYCLE }
79
79
  t = CacheCleanupThread.new(cleanup_interval, cleanup_cycle, self) do
80
80
  until Thread.current[:should_exit] do
81
- t.sleepy_run
81
+ Thread.current.sleepy_run
82
82
  end
83
83
  end
84
84
  at_exit { t[:should_exit] = true }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Rack
4
4
  class MiniProfiler
5
- VERSION = '3.1.0'
5
+ VERSION = '3.1.1'
6
6
  SOURCE_CODE_URI = 'https://github.com/MiniProfiler/rack-mini-profiler'
7
7
  end
8
8
  end
data/lib/mini_profiler.rb CHANGED
@@ -462,7 +462,7 @@ module Rack
462
462
 
463
463
  if flamegraph && query_string =~ /#{@config.profile_parameter}=flamegraph/
464
464
  body.close if body.respond_to? :close
465
- return client_settings.handle_cookie(self.flamegraph(flamegraph, path))
465
+ return client_settings.handle_cookie(self.flamegraph(flamegraph, path, env))
466
466
  elsif flamegraph # async-flamegraph
467
467
  page_struct[:has_flamegraph] = true
468
468
  page_struct[:flamegraph] = flamegraph
@@ -705,8 +705,9 @@ module Rack
705
705
  [200, headers, [html]]
706
706
  end
707
707
 
708
- def flamegraph(graph, path)
708
+ def flamegraph(graph, path, env)
709
709
  headers = { 'Content-Type' => 'text/html' }
710
+ iframe_src = "#{public_base_path(env)}speedscope/index.html"
710
711
  html = <<~HTML
711
712
  <!DOCTYPE html>
712
713
  <html>
@@ -726,7 +727,7 @@ module Rack
726
727
  var iframe = document.createElement('IFRAME');
727
728
  iframe.setAttribute('id', 'speedscope-iframe');
728
729
  document.body.appendChild(iframe);
729
- var iframeUrl = '#{@config.base_url_path}speedscope/index.html#profileURL=' + objUrl + '&title=' + 'Flamegraph for #{CGI.escape(path)}';
730
+ var iframeUrl = '#{iframe_src}#profileURL=' + objUrl + '&title=' + 'Flamegraph for #{CGI.escape(path)}';
730
731
  iframe.setAttribute('src', iframeUrl);
731
732
  </script>
732
733
  </body>
@@ -755,7 +756,7 @@ module Rack
755
756
  # * you have disabled auto append behaviour throught :auto_inject => false flag
756
757
  # * you do not want script to be automatically appended for the current page. You can also call cancel_auto_inject
757
758
  def get_profile_script(env)
758
- path = "#{env['RACK_MINI_PROFILER_ORIGINAL_SCRIPT_NAME']}#{@config.base_url_path}"
759
+ path = public_base_path(env)
759
760
  version = MiniProfiler::ASSET_VERSION
760
761
  if @config.assets_url
761
762
  url = @config.assets_url.call('rack-mini-profiler.js', version, env)
@@ -887,7 +888,7 @@ module Rack
887
888
  return [404, {}, ["No flamegraph available for #{ERB::Util.html_escape(id)}"]]
888
889
  end
889
890
 
890
- self.flamegraph(page_struct[:flamegraph], page_struct[:request_path])
891
+ self.flamegraph(page_struct[:flamegraph], page_struct[:request_path], env)
891
892
  end
892
893
 
893
894
  def rails_route_from_path(path, method)
@@ -945,5 +946,9 @@ module Rack
945
946
  self.current = nil
946
947
  results
947
948
  end
949
+
950
+ def public_base_path(env)
951
+ "#{env['RACK_MINI_PROFILER_ORIGINAL_SCRIPT_NAME']}#{@config.base_url_path}"
952
+ end
948
953
  end
949
954
  end
@@ -75,7 +75,8 @@ module Rack::MiniProfilerRails
75
75
  next if !should_measure?
76
76
 
77
77
  current = Rack::MiniProfiler.current
78
- description = "Executing action: #{payload[:action]}"
78
+ controller_name = payload[:controller].sub(/Controller\z/, '').downcase
79
+ description = "Executing: #{controller_name}##{payload[:action]}"
79
80
  Thread.current[get_key(payload)] = current.current_timer
80
81
  Rack::MiniProfiler.current.current_timer = current.current_timer.add_child(description)
81
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-mini-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-04-11 00:00:00.000000000 Z
13
+ date: 2023-08-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack