prosopite 2.2.0 → 2.5.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 +169 -0
- data/README.md +404 -183
- data/lib/generators/prosopite/install_generator.rb +53 -0
- data/lib/generators/prosopite/templates/prosopite.rb.tt +18 -0
- data/lib/prosopite/fixes.rb +181 -0
- data/lib/prosopite/middleware/rack.rb +212 -2
- data/lib/prosopite/middleware/sidekiq.rb +2 -2
- data/lib/prosopite/minitest.rb +23 -0
- data/lib/prosopite/rspec.rb +20 -0
- data/lib/prosopite/version.rb +1 -1
- data/lib/prosopite.rb +476 -101
- metadata +22 -24
- data/.github/workflows/ci.yml +0 -15
- data/.gitignore +0 -9
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -152
- data/Rakefile +0 -9
- data/prosopite.gemspec +0 -34
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a99d3bc95d070ef26189ade52959f5216d5bbbb277f76ecadefa1b740454066
|
|
4
|
+
data.tar.gz: fd9fe0bf1bdc839662b7ca6396fd1c1071fc2a59d37ccc352ed06618e07b872f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06ef88f8810a9214aa0c14eb73fc124ed384607b605c331fc6e3af3c8ffec08e430fd7969e240ef4b8cfb8a7b41154944569fb6c4abdf46b7a0f362b1b3b3bea
|
|
7
|
+
data.tar.gz: 5402c17feb8ebbcd24be991e5619944985ce8cc53f5f92ae2fa11aa57ae9ba5cd789f9d77f13164b73e4ae24540b1f7e8d998c2e3fc489a6bf6d85c9fd1908ba
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.5.0 (2026-10-26)
|
|
4
|
+
|
|
5
|
+
- Suggest fixes in notifications, e.g. `Chair.includes(:legs) where the chairs are loaded, at app/views/chairs/index.html.erb:2`, which `Prosopite.suggest_fixes = false` turns off
|
|
6
|
+
- Add an RSpec matcher and Minitest assertions, `have_n_plus_one_queries`, `assert_no_n_plus_one_queries` and `assert_n_plus_one_queries`, and `Prosopite.n_plus_one_queries`
|
|
7
|
+
- Add a todo file of known N+1 queries to ignore, to adopt Prosopite gradually, with `Prosopite.todo_file` and `Prosopite.record_todo`
|
|
8
|
+
- Show the N+1 queries of Turbo frames and streams, and of fetch and XHR requests, in the footer and the browser console
|
|
9
|
+
- Add `Prosopite.github_annotations` and `Prosopite.json_report`, for CI
|
|
10
|
+
- Add `Prosopite.sample_rate` and `Prosopite.min_duration_ms`, for production
|
|
11
|
+
- Add `Prosopite.pause_during(event)`, e.g. to leave out the N+1 queries of FactoryBot factories
|
|
12
|
+
- Add a `rails generate prosopite:install` generator
|
|
13
|
+
- pg_query is optional with PostgreSQL, which gets the built-in fingerprint without it instead of a LoadError
|
|
14
|
+
- N+1 queries go to the Rails log when no logger is set, unless `Prosopite.rails_logger = false`
|
|
15
|
+
- `Prosopite.prosopite_logger` takes a path or a logger too, and creates the directory of its file
|
|
16
|
+
- Notifications show the call stack last, after the fix suggestions and the context
|
|
17
|
+
- `Prosopite.scan` while a scan of the same fiber is paused doesn't replace it anymore, so the pause applies, and assertions keep their scan
|
|
18
|
+
- The footer and the console follow the Content Security Policy of Rails too, leaving out a style or a script that it would block
|
|
19
|
+
- Pages with the footer or the console keep their encoding, e.g. UTF-8, instead of becoming binary, for middleware that add to them after Prosopite
|
|
20
|
+
- `Prosopite.allow_list=`, deprecated since 1.0.6, will be removed in 3.0
|
|
21
|
+
|
|
22
|
+
## 2.4.0 (2026-10-26)
|
|
23
|
+
|
|
24
|
+
- Detect N+1 queries in fibers spawned during a scan, e.g. Async tasks, on Ruby 3.2+, unless they start a scan of their own (#105)
|
|
25
|
+
- Pauses apply to the whole scan, including those fibers and ActionController::Live actions, and pause blocks can overlap
|
|
26
|
+
- `Prosopite.finish` ends a scan even while it's paused, and reports the N+1 queries found before the pause
|
|
27
|
+
- Fix N+1 queries that weren't reported when another N+1, elsewhere, had the same query strings, as happens with bind parameters
|
|
28
|
+
- Fix a crash when an ActionController::Live action runs queries while its request finishes the scan
|
|
29
|
+
- Fix extensions that override `Prosopite.fingerprint(query)`, broken in 2.3.0
|
|
30
|
+
- Load `Prosopite::VERSION` with the library
|
|
31
|
+
- Faster `ignore_location_paths`, which cost several times the usual overhead per query, and `allow_stack_paths`
|
|
32
|
+
- Faster `finish` for N+1 queries with bind parameters, fingerprinting each distinct query once
|
|
33
|
+
- The gem contains only the library and its docs
|
|
34
|
+
- The state of a scan isn't kept in `Thread.current[:prosopite_query_*]` anymore. `Thread.current[:prosopite_notifications]` still holds the N+1 queries of the last scan.
|
|
35
|
+
|
|
36
|
+
## 2.3.0 (2026-10-26)
|
|
37
|
+
|
|
38
|
+
- Show the N+1 queries of a page in a footer and/or the browser console, with `Prosopite.add_footer` and `Prosopite.browser_console` and the Rack middleware, on Rails 7.1+ (#10, #20)
|
|
39
|
+
- `Prosopite.finish` returns the N+1 queries, and each one is published as an `n_plus_one_queries.prosopite` event, e.g. for JSON logs (#102, #46)
|
|
40
|
+
- `Prosopite.scan` takes a context for the notifications, which the Rack and Sidekiq middlewares set to the request and the job (#103)
|
|
41
|
+
- Add `Prosopite.focus_stack_paths` to report only the N+1 queries whose call stack matches, e.g. the app directory (#88)
|
|
42
|
+
- Add `Prosopite.ignore_location_paths` to skip stack frames that differ between calls, e.g. sorbet-runtime (#101)
|
|
43
|
+
- Add `Prosopite.display_query_count` and `Prosopite.display_max_n_queries` (#74)
|
|
44
|
+
- Fingerprint queries with the adapter of the connection that ran them, fixing SQLite (#89), Oracle (#94) and apps with databases of different adapters (#48). `pg_query` is now needed only for PostgreSQL.
|
|
45
|
+
- Don't group queries that ran on different databases, e.g. on shards (#96)
|
|
46
|
+
- Declare the actual minimum requirements in the gemspec: Ruby 2.7, Active Record and Railties 6.1 (#98, #99)
|
|
47
|
+
|
|
48
|
+
## 2.2.0 (2026-04-16)
|
|
49
|
+
|
|
50
|
+
- Add total query time to N+1 notifications
|
|
51
|
+
|
|
52
|
+
## 2.1.2 (2025-09-19)
|
|
53
|
+
|
|
54
|
+
- Avoid using `lease_connection`
|
|
55
|
+
- Optimise `Prosopite.subscribe` further
|
|
56
|
+
|
|
57
|
+
## 2.1.1 (2025-07-04)
|
|
58
|
+
|
|
59
|
+
- Optimise `location_key` computation in `Prosopite.subscribe`
|
|
60
|
+
|
|
61
|
+
## 2.1.0 (2025-03-03)
|
|
62
|
+
|
|
63
|
+
- Add `Prosopite.start_raise` / `Prosopite.stop_raise` to raise even when `Prosopite.raise` is off
|
|
64
|
+
|
|
65
|
+
## 2.0.0 (2025-02-20)
|
|
66
|
+
|
|
67
|
+
- Fix the connection deprecation warning of newer Rails
|
|
68
|
+
- Fix a Ruby 3.4 string warning
|
|
69
|
+
- Test on Ruby 3.2 to 3.4
|
|
70
|
+
|
|
71
|
+
## 1.4.2 (2023-12-14)
|
|
72
|
+
|
|
73
|
+
- Rack middleware: don't use the block form of scan
|
|
74
|
+
|
|
75
|
+
## 1.4.1 (2023-09-28)
|
|
76
|
+
|
|
77
|
+
- Fix the Sidekiq middleware
|
|
78
|
+
|
|
79
|
+
## 1.4.0 (2023-09-26)
|
|
80
|
+
|
|
81
|
+
- Add Rack and Sidekiq middlewares
|
|
82
|
+
- Add `Prosopite.enabled`
|
|
83
|
+
- Support the Trilogy adapter
|
|
84
|
+
|
|
85
|
+
## 1.3.3 (2023-08-09)
|
|
86
|
+
|
|
87
|
+
- Speed up the `sql.active_record` subscription
|
|
88
|
+
|
|
89
|
+
## 1.3.2 (2023-06-09)
|
|
90
|
+
|
|
91
|
+
- Fix the MySQL fingerprint for `ORDER BY FIELD()`
|
|
92
|
+
|
|
93
|
+
## 1.3.1 (2023-05-10)
|
|
94
|
+
|
|
95
|
+
- Fix a false negative when calling the preloader in a loop
|
|
96
|
+
|
|
97
|
+
## 1.3.0 (2023-02-07)
|
|
98
|
+
|
|
99
|
+
- Clean call stacks with `Rails.backtrace_cleaner`
|
|
100
|
+
|
|
101
|
+
## 1.2.2 (2022-11-02)
|
|
102
|
+
|
|
103
|
+
- Clear thread variables upon finishing
|
|
104
|
+
|
|
105
|
+
## 1.2.1 (2022-11-01)
|
|
106
|
+
|
|
107
|
+
- Handle multiple fingerprints from the same location
|
|
108
|
+
|
|
109
|
+
## 1.2.0 (2022-10-27)
|
|
110
|
+
|
|
111
|
+
- Add `Prosopite.min_n_queries` and `Prosopite.ignore_pauses`
|
|
112
|
+
|
|
113
|
+
## 1.1.4 (2022-10-18)
|
|
114
|
+
|
|
115
|
+
- Make sure a scan has properly started in `scan?`
|
|
116
|
+
|
|
117
|
+
## 1.1.3 (2022-09-29)
|
|
118
|
+
|
|
119
|
+
- Revert making `Prosopite.resume` an alias of `Prosopite.scan`
|
|
120
|
+
|
|
121
|
+
## 1.1.2 (2022-07-14)
|
|
122
|
+
|
|
123
|
+
- Allow nested `pause` blocks
|
|
124
|
+
|
|
125
|
+
## 1.1.1 (2022-07-10)
|
|
126
|
+
|
|
127
|
+
- `Prosopite.scan` returns the result of its block
|
|
128
|
+
- `Prosopite.pause` accepts a block
|
|
129
|
+
|
|
130
|
+
## 1.0.9 (2022-05-16)
|
|
131
|
+
|
|
132
|
+
- Add `Prosopite.custom_logger`
|
|
133
|
+
|
|
134
|
+
## 1.0.8 (2022-02-25)
|
|
135
|
+
|
|
136
|
+
- Allow regexes in `Prosopite.allow_stack_paths`
|
|
137
|
+
|
|
138
|
+
## 1.0.7 (2022-01-20)
|
|
139
|
+
|
|
140
|
+
- Make `Prosopite.resume` an alias of `Prosopite.scan`
|
|
141
|
+
|
|
142
|
+
## 1.0.6 (2021-12-19)
|
|
143
|
+
|
|
144
|
+
- Add `Prosopite.ignore_queries`
|
|
145
|
+
- Rename `allow_list` to `allow_stack_paths`
|
|
146
|
+
|
|
147
|
+
## 1.0.5 (2021-12-11)
|
|
148
|
+
|
|
149
|
+
- Fix the allow list growing indefinitely
|
|
150
|
+
|
|
151
|
+
## 1.0.4 (2021-12-11)
|
|
152
|
+
|
|
153
|
+
- Add `Prosopite.pause` and `Prosopite.resume`
|
|
154
|
+
|
|
155
|
+
## 1.0.3 (2021-09-25)
|
|
156
|
+
|
|
157
|
+
- Allow preloading multiple associations from the same table
|
|
158
|
+
|
|
159
|
+
## 1.0.2 (2021-09-25)
|
|
160
|
+
|
|
161
|
+
- Skip Active Record `SCHEMA` queries
|
|
162
|
+
|
|
163
|
+
## 1.0.1 (2021-04-07)
|
|
164
|
+
|
|
165
|
+
- Allow `Prosopite.scan` with a block
|
|
166
|
+
|
|
167
|
+
## 1.0.0 (2021-03-17)
|
|
168
|
+
|
|
169
|
+
- Require `pg_query` only for non-MySQL databases
|