rails-profiler 0.40.0 → 0.41.0
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/app/assets/builds/profiler-toolbar.js +2 -2
- data/app/assets/builds/profiler.js +10 -10
- data/app/controllers/profiler/api/config_controller.rb +17 -0
- data/config/routes.rb +1 -0
- data/lib/profiler/configuration.rb +28 -1
- data/lib/profiler/version.rb +1 -1
- metadata +3 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Profiler
|
|
4
|
+
module Api
|
|
5
|
+
# Read-only: the settings the file:line links need, for the dashboard and for the browser
|
|
6
|
+
# extension, which falls back on them when it has none of its own.
|
|
7
|
+
class ConfigController < ApplicationController
|
|
8
|
+
def show
|
|
9
|
+
config = Profiler.configuration
|
|
10
|
+
render json: {
|
|
11
|
+
editor_url_scheme: config.editor_link_scheme,
|
|
12
|
+
editor_path_map: config.editor_path_map
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/config/routes.rb
CHANGED
|
@@ -45,6 +45,7 @@ Profiler::Engine.routes.draw do
|
|
|
45
45
|
collection { delete :clear }
|
|
46
46
|
end
|
|
47
47
|
resources :outbound_http, only: [:index]
|
|
48
|
+
get "config", to: "config#show"
|
|
48
49
|
get "toolbar/:token", to: "toolbar#show"
|
|
49
50
|
post "ajax/link", to: "ajax#link"
|
|
50
51
|
post "explain", to: "explain#create"
|
|
@@ -37,6 +37,9 @@ module Profiler
|
|
|
37
37
|
# config.http_skip_hosts += Profiler::Configuration::LOCAL_HTTP_HOSTS.
|
|
38
38
|
LOCAL_HTTP_HOSTS = [/\A127\.0\.0\.1\z/, /\Alocalhost\z/i, /\A::1\z/].freeze
|
|
39
39
|
|
|
40
|
+
# URL schemes the source links can use. Anything else is never turned into a link.
|
|
41
|
+
EDITOR_URL_SCHEMES = %w[vscode idea cursor].freeze
|
|
42
|
+
|
|
40
43
|
attr_accessor :storage_options, :collectors,
|
|
41
44
|
:slow_query_threshold, :max_queries_warning, :sql_backtrace,
|
|
42
45
|
:track_memory, :allocated_objects_warning_threshold,
|
|
@@ -61,7 +64,7 @@ module Profiler
|
|
|
61
64
|
:cluster_allow_insecure_http, :logger,
|
|
62
65
|
:collector_circuit_breaker_enabled
|
|
63
66
|
|
|
64
|
-
attr_reader :authorize_block, :enabled, :track_tests, :max_profiles
|
|
67
|
+
attr_reader :authorize_block, :enabled, :track_tests, :max_profiles, :editor_url_scheme, :editor_path_map
|
|
65
68
|
|
|
66
69
|
def initialize
|
|
67
70
|
@assigned = []
|
|
@@ -167,6 +170,8 @@ module Profiler
|
|
|
167
170
|
# Profiler::Collectors::CircuitBreaker); false never stops one.
|
|
168
171
|
@collector_circuit_breaker_enabled = true
|
|
169
172
|
@collector_circuit_breaker_threshold = 3
|
|
173
|
+
@editor_url_scheme = "vscode"
|
|
174
|
+
@editor_path_map = {}
|
|
170
175
|
end
|
|
171
176
|
|
|
172
177
|
attr_reader :collector_circuit_breaker_threshold
|
|
@@ -182,6 +187,28 @@ module Profiler
|
|
|
182
187
|
end
|
|
183
188
|
end
|
|
184
189
|
|
|
190
|
+
# The editor the file:line links open: "vscode", "idea" or "cursor" (String or Symbol). A
|
|
191
|
+
# value outside that list is kept as given, but #editor_link_scheme answers nil for it, so
|
|
192
|
+
# that no link is built.
|
|
193
|
+
def editor_url_scheme=(value)
|
|
194
|
+
@editor_url_scheme = value.nil? ? nil : value.to_s
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Container path prefix => host path prefix, for a server running in a container while the
|
|
198
|
+
# editor runs on the host: { "/app" => "/home/me/project" }. The longest matching prefix wins.
|
|
199
|
+
def editor_path_map=(value)
|
|
200
|
+
unless value.nil? || value.respond_to?(:to_h)
|
|
201
|
+
raise ArgumentError, "editor_path_map must be a Hash of container path => host path"
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
@editor_path_map = (value || {}).to_h.to_h { |from, to| [from.to_s, to.to_s] }
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# The scheme the dashboard may use, or nil when the setting is not on the allow list.
|
|
208
|
+
def editor_link_scheme
|
|
209
|
+
EDITOR_URL_SCHEMES.include?(@editor_url_scheme) ? @editor_url_scheme : nil
|
|
210
|
+
end
|
|
211
|
+
|
|
185
212
|
# Always a Pathname, whether set from a String or left to its default.
|
|
186
213
|
def tmp_path
|
|
187
214
|
@tmp_path || default_tmp_path
|
data/lib/profiler/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-profiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.41.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sébastien Duplessy
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -119,6 +119,7 @@ files:
|
|
|
119
119
|
- app/assets/javascript/profiler-ajax-interceptor.js
|
|
120
120
|
- app/controllers/profiler/api/ajax_controller.rb
|
|
121
121
|
- app/controllers/profiler/api/cluster_controller.rb
|
|
122
|
+
- app/controllers/profiler/api/config_controller.rb
|
|
122
123
|
- app/controllers/profiler/api/console_controller.rb
|
|
123
124
|
- app/controllers/profiler/api/env_vars_controller.rb
|
|
124
125
|
- app/controllers/profiler/api/events_controller.rb
|