rails-profiler 0.44.30 → 0.44.32
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 +22 -0
- data/lib/profiler/mcp/tools/run_tests.rb +12 -1
- data/lib/profiler/storage/blob_store.rb +2 -0
- data/lib/profiler/storage/redis_store.rb +22 -5
- data/lib/profiler/storage/sqlite_store.rb +2 -2
- data/lib/profiler/storage/unavailable.rb +1 -1
- data/lib/profiler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '008e541b7482461f631a1863abc0bc3b0c62effa8d06695fa7e169a4b701b361'
|
|
4
|
+
data.tar.gz: 12fe116adf6857b2a9fa9d37a1a3c490cfc03e4778c11a06e295adb6b46c2672
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a34072b79e2487bab74350d572e06d9c735c28a9d8d2bd56c8cbdc0d4324b5198e0f099e76b32fb1815d6d85f7c2eafbfdaabefda1480c8024be3f95e3fd9738
|
|
7
|
+
data.tar.gz: f7ffee7954357ea79973e352bc614becefeed80e8b346b03d07b16375a1d3bd46911fa9027c398ed6687b9bce74b2aff2edd5997a069db6d89dd842019c2bf1d
|
data/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,28 @@ every commit of every tag interval is accounted for one way or the other.
|
|
|
19
19
|
|
|
20
20
|
## [Unreleased]
|
|
21
21
|
|
|
22
|
+
## [0.44.32] - 2026-10-26
|
|
23
|
+
|
|
24
|
+
<!-- stamped -->
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **Storage:** Added missing `find_by_trace` method to `Unavailable` storage class, returning 503 instead of 500 for trace queries when storage is unavailable.
|
|
29
|
+
- **Storage:** SqliteStore now stores the HTTP response bodies of live profiles in the blob store; the symbol-keyed `requests` of the HTTP collector were left inline in the profile row. Saving a hash holding both `:requests` and `"requests"` no longer writes a duplicate key.
|
|
30
|
+
- **Storage:** BlobStore gracefully handles `Errno::ENOENT` race condition during concurrent pruning operations.
|
|
31
|
+
- **Storage:** RedisStore computes the tokens to evict atomically with a Lua script, reducing over-eviction under concurrent saves.
|
|
32
|
+
|
|
33
|
+
## [0.44.31] - 2026-10-26
|
|
34
|
+
|
|
35
|
+
<!-- stamped -->
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **run_tests(max_output):** Reject non-positive max_output values; invalid values fall back to default. Refs #73
|
|
40
|
+
- **run_tests(timeout_seconds):** Cap timeout_seconds to 600 seconds to prevent indefinite blocking of Puma threads. Refs #73
|
|
41
|
+
- **run_tests on slave:** Exit immediately when run error is detected, instead of waiting for timeout. Refs #73
|
|
42
|
+
- **run_tests on slave:** Stop forcing the rspec framework and an empty file list in the request, so the slave detects the framework itself. Refs #73
|
|
43
|
+
|
|
22
44
|
## [0.44.30] - 2026-10-26
|
|
23
45
|
|
|
24
46
|
<!-- stamped -->
|
|
@@ -14,6 +14,7 @@ module Profiler
|
|
|
14
14
|
class RunTests
|
|
15
15
|
DEFAULT_TIMEOUT = 120
|
|
16
16
|
DEFAULT_MAX_OUTPUT = 4000
|
|
17
|
+
MAX_TIMEOUT = 600 # seconds, cap to prevent blocking Puma threads
|
|
17
18
|
POLL_TIMEOUT = 10 # seconds per wait_for_output call
|
|
18
19
|
|
|
19
20
|
def self.call(params)
|
|
@@ -24,7 +25,9 @@ module Profiler
|
|
|
24
25
|
files = Array(params["files"])
|
|
25
26
|
framework = params["framework"]&.to_s
|
|
26
27
|
timeout_secs = (params["timeout_seconds"] || DEFAULT_TIMEOUT).to_i
|
|
28
|
+
timeout_secs = [timeout_secs, MAX_TIMEOUT].min
|
|
27
29
|
max_output = (params["max_output"] || DEFAULT_MAX_OUTPUT).to_i
|
|
30
|
+
max_output = DEFAULT_MAX_OUTPUT if max_output <= 0
|
|
28
31
|
|
|
29
32
|
# Auto-detect framework if not provided
|
|
30
33
|
framework ||= begin
|
|
@@ -81,9 +84,14 @@ module Profiler
|
|
|
81
84
|
files = Array(params["files"])
|
|
82
85
|
framework = params["framework"].to_s
|
|
83
86
|
timeout_secs = (params["timeout_seconds"] || DEFAULT_TIMEOUT).to_i
|
|
87
|
+
timeout_secs = [timeout_secs, MAX_TIMEOUT].min
|
|
84
88
|
max_output = (params["max_output"] || DEFAULT_MAX_OUTPUT).to_i
|
|
89
|
+
max_output = DEFAULT_MAX_OUTPUT if max_output <= 0
|
|
85
90
|
|
|
86
|
-
|
|
91
|
+
payload = {}
|
|
92
|
+
payload[:files] = files if files.any?
|
|
93
|
+
payload[:framework] = framework if framework.present?
|
|
94
|
+
run_data = proxy.post_json("/_profiler/api/test_runner/runs", payload)
|
|
87
95
|
|
|
88
96
|
if run_data["error"]
|
|
89
97
|
return [{ type: "text", text: "Error starting tests on slave: #{run_data["error"]}" }]
|
|
@@ -99,6 +107,9 @@ module Profiler
|
|
|
99
107
|
break
|
|
100
108
|
end
|
|
101
109
|
run_data = proxy.get_json("/_profiler/api/test_runner/runs/#{run_id}")
|
|
110
|
+
if run_data["error"]
|
|
111
|
+
return [{ type: "text", text: "Error reading test run #{run_id} on slave: #{run_data["error"]}" }]
|
|
112
|
+
end
|
|
102
113
|
break if Profiler::TestRunner::RunStore::TERMINAL_STATUSES.include?(run_data["status"])
|
|
103
114
|
sleep 2
|
|
104
115
|
end
|
|
@@ -72,6 +72,8 @@ module Profiler
|
|
|
72
72
|
dir = token_dir(name)
|
|
73
73
|
stat = File.lstat(dir)
|
|
74
74
|
FileUtils.rm_rf(dir) if stat.directory? && stat.mtime < cutoff
|
|
75
|
+
rescue Errno::ENOENT
|
|
76
|
+
# Normal race between concurrent workers
|
|
75
77
|
rescue SystemCallError => e
|
|
76
78
|
Profiler.log_error("BlobStore: could not prune #{name}", e)
|
|
77
79
|
end
|
|
@@ -38,6 +38,19 @@ module Profiler
|
|
|
38
38
|
return 0
|
|
39
39
|
LUA
|
|
40
40
|
|
|
41
|
+
# Atomically retrieves tokens to evict: returns the first N tokens from the sorted set
|
|
42
|
+
# where N is the minimum of (zcard - target) and batch_size, or 0 if already below target.
|
|
43
|
+
GET_EXCESS_TOKENS = <<~LUA
|
|
44
|
+
local key = KEYS[1]
|
|
45
|
+
local target = tonumber(ARGV[1])
|
|
46
|
+
local batch_size = tonumber(ARGV[2])
|
|
47
|
+
local card = redis.call("zcard", key)
|
|
48
|
+
local excess = card - target
|
|
49
|
+
if excess <= 0 then return {} end
|
|
50
|
+
local count = math.min(excess, batch_size)
|
|
51
|
+
return redis.call("zrange", key, 0, count - 1)
|
|
52
|
+
LUA
|
|
53
|
+
|
|
41
54
|
attr_reader :redis
|
|
42
55
|
|
|
43
56
|
def initialize(options = {})
|
|
@@ -256,20 +269,24 @@ module Profiler
|
|
|
256
269
|
return if excess <= @max_profiles - target
|
|
257
270
|
|
|
258
271
|
if excess <= EVICT_BATCH
|
|
259
|
-
|
|
272
|
+
tokens = @redis.eval(GET_EXCESS_TOKENS, keys: [saved_key], argv: [target, EVICT_BATCH])
|
|
273
|
+
remove_tokens(tokens - [keep]) if tokens.any?
|
|
260
274
|
else
|
|
261
275
|
evicted_all = with_lock(evict_lock_key, EVICT_LOCK_SECONDS) do
|
|
262
276
|
loop do
|
|
263
|
-
|
|
264
|
-
break if
|
|
277
|
+
tokens = @redis.eval(GET_EXCESS_TOKENS, keys: [saved_key], argv: [target, INDEX_BATCH])
|
|
278
|
+
break if tokens.empty?
|
|
265
279
|
|
|
266
|
-
batch =
|
|
280
|
+
batch = tokens - [keep]
|
|
267
281
|
break if batch.empty?
|
|
268
282
|
|
|
269
283
|
remove_tokens(batch)
|
|
270
284
|
end
|
|
271
285
|
end
|
|
272
|
-
|
|
286
|
+
unless evicted_all
|
|
287
|
+
tokens = @redis.eval(GET_EXCESS_TOKENS, keys: [saved_key], argv: [target, EVICT_BATCH])
|
|
288
|
+
remove_tokens(tokens - [keep]) if tokens.any?
|
|
289
|
+
end
|
|
273
290
|
end
|
|
274
291
|
end
|
|
275
292
|
|
|
@@ -73,10 +73,10 @@ module Profiler
|
|
|
73
73
|
next unless collector_data.is_a?(Hash)
|
|
74
74
|
|
|
75
75
|
if collector_name.to_s == "http"
|
|
76
|
-
requests = collector_data["requests"]
|
|
76
|
+
requests = collector_data["requests"] || collector_data[:requests]
|
|
77
77
|
if requests
|
|
78
78
|
stripped, bodies_saved = save_http_response_bodies(token, requests)
|
|
79
|
-
collectors_meta[collector_name] = collector_data.merge("requests" => stripped)
|
|
79
|
+
collectors_meta[collector_name] = collector_data.reject { |key, _| key.to_s == "requests" }.merge("requests" => stripped)
|
|
80
80
|
else
|
|
81
81
|
collectors_meta[collector_name] = collector_data
|
|
82
82
|
end
|
|
@@ -49,7 +49,7 @@ module Profiler
|
|
|
49
49
|
token
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
%i[load list cleanup exists? find_by_parent find_by_replay_of delete clear].each do |name|
|
|
52
|
+
%i[load list cleanup exists? find_by_parent find_by_trace find_by_replay_of delete clear].each do |name|
|
|
53
53
|
define_method(name) { |*, **| raise @error }
|
|
54
54
|
end
|
|
55
55
|
end
|
data/lib/profiler/version.rb
CHANGED