dead_bro 0.2.36 → 0.2.37
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 +11 -0
- data/lib/dead_bro/job_subscriber.rb +2 -0
- data/lib/dead_bro/subscriber.rb +20 -15
- data/lib/dead_bro/version.rb +1 -2
- 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: 85f75545759422dfd14db796ac17035d9d6722e8e68e9c31e9ef0382358e93f8
|
|
4
|
+
data.tar.gz: beed782f1043421e364b1548db3dcd29dd1389d54d46440c2ff65aaf81a4b6af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1dd65b6b589c013f24d18a548491aa6203c990cf0522c23c0e9000939898aed0e6927a26793c1a8eb80e4fe96e7a9c72176436f2cf8d3ae84848562b2fb82c2d
|
|
7
|
+
data.tar.gz: c0c020935c96898d9c54bd1b9f39ee77bf7040b8ad0cf2a9d51487af14199dca91b46e6b89b66e99c73cce470452136cb71d49ae2535f725b05edcd8b1511bdc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.2.37] - 2026-10-26
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **`sql_count` stopped at 100 on any page that ran more queries.** It was never a query count: the subscriber read `ActiveRecord::Base.connection.query_cache.size`, the number of distinct SELECTs in the query cache — an LRU capped at 100 entries since Rails 7.1. An N+1 page that ran 188 queries reported "SQL Count 100" and "100 calls/request". `sql_count` is now the sum of the per-statement aggregate counts the SQL subscriber already keeps (every query, not only the first `MAX_TRACKED_QUERIES`), with query-cache hits included the way Rails counts them in its `(N queries, M cached)` log line. The old lookup also leased a database connection on requests that ran no SQL; nothing in the subscriber touches `ActiveRecord::Base.connection` any more.
|
|
7
|
+
- Background jobs sent no `sql_count` at all, so the dashboard showed 0 database calls for every job; job payloads now carry the same count.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `sql_cached_count` on request and job payloads: how many of `sql_count` were answered by the query cache.
|
|
11
|
+
|
|
12
|
+
## [0.2.36] - 2026-10-25
|
|
13
|
+
|
|
3
14
|
### Added
|
|
4
15
|
- **`gc_pressure` now says whether the window's GC had finished.** `gc_state_at_end` is the GC's phase when a request or job window closes — `"none"`, `"marking"` or `"sweeping"`, from `GC.latest_gc_info(:state)` — sent with the other memory-tracking fields. Ruby marks and sweeps in steps between allocations, so a GC counted in the window is often still running when it closes, and until it finishes `heap_live_slots_growth` still counts garbage it hasn't freed. The dashboard uses it so a sample measured mid-GC isn't flagged as a possible leak. It's a single-key read; no hash is built.
|
|
5
16
|
|
|
@@ -141,6 +141,8 @@ module DeadBro
|
|
|
141
141
|
gc_pressure: gc_pressure,
|
|
142
142
|
ar_instantiation_count: ar_instantiation_count,
|
|
143
143
|
status: has_error ? "failed" : "completed",
|
|
144
|
+
sql_count: DeadBro::Subscriber.sql_count(sql_queries),
|
|
145
|
+
sql_cached_count: DeadBro::Subscriber.sql_cached_count(sql_queries),
|
|
144
146
|
sql_queries: sql_queries,
|
|
145
147
|
transaction_events: transaction_events,
|
|
146
148
|
rails_env: DeadBro.env,
|
data/lib/dead_bro/subscriber.rb
CHANGED
|
@@ -166,7 +166,8 @@ module DeadBro
|
|
|
166
166
|
db_runtime_ms: data[:db_runtime],
|
|
167
167
|
memory_usage: memory_usage_mb,
|
|
168
168
|
gc_stats: end_gc_stats,
|
|
169
|
-
sql_count: sql_count(
|
|
169
|
+
sql_count: sql_count(sql_queries),
|
|
170
|
+
sql_cached_count: sql_cached_count(sql_queries),
|
|
170
171
|
sql_queries: sql_queries,
|
|
171
172
|
transaction_events: transaction_events,
|
|
172
173
|
http_outgoing: Thread.current[:dead_bro_http_events] || [],
|
|
@@ -472,20 +473,24 @@ module DeadBro
|
|
|
472
473
|
{}
|
|
473
474
|
end
|
|
474
475
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
476
|
+
# Number of SQL statements run during the request, query-cache hits included
|
|
477
|
+
# (the same count as Rails' "ActiveRecord: …ms (N queries, M cached)" log
|
|
478
|
+
# line). Summed from SqlSubscriber.stop_request_tracking's per-statement
|
|
479
|
+
# aggregates, which count every query — the raw query list stops at
|
|
480
|
+
# MAX_TRACKED_QUERIES. This used to read
|
|
481
|
+
# ActiveRecord::Base.connection.query_cache.size: the number of distinct
|
|
482
|
+
# cached SELECTs, an LRU capped at 100 since Rails 7.1, so every N+1 page
|
|
483
|
+
# reported "100" — and it leased a DB connection on requests with no SQL.
|
|
484
|
+
def self.sql_count(sql_queries)
|
|
485
|
+
Array(sql_queries).sum { |agg| agg[:count].to_i }
|
|
486
|
+
rescue
|
|
487
|
+
0
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
# How many of sql_count were answered by the query cache, sent separately so
|
|
491
|
+
# the dashboard can tell repeated cache hits from database round trips.
|
|
492
|
+
def self.sql_cached_count(sql_queries)
|
|
493
|
+
Array(sql_queries).sum { |agg| agg[:cached_count].to_i }
|
|
489
494
|
rescue
|
|
490
495
|
0
|
|
491
496
|
end
|
data/lib/dead_bro/version.rb
CHANGED