dial 0.2.4 → 0.2.6
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 +9 -0
- data/README.md +32 -6
- data/dial.gemspec +4 -4
- data/lib/dial/constants.rb +3 -3
- data/lib/dial/engine/routes.rb +1 -1
- data/lib/dial/middleware.rb +7 -13
- data/lib/dial/railtie.rb +1 -14
- data/lib/dial/version.rb +1 -1
- metadata +3 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 298ec02876c962b490d3afaaeb60d38dcd722de4f701e39047d6e7b3a281d83d
|
4
|
+
data.tar.gz: 5e01810cb5251a171f45e6e6dc9620e310ef3af7196554150cbf22b9f80d0690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ad3ccf904ed2446f8119de32a0ed7e2f5ad195dce03d1b6619c00b9e3c2519d7c64cbac7c6ca2dda65615d56e0055581c8dbc8f12c9d5a22a0461f920cfa0ec
|
7
|
+
data.tar.gz: 6dd3d29f2bcbede73ed1e3e4ee175726c12cbd0c364d694cfe79890b970c0ecf82876427b4136bacc8962f1c15a68ce033ee54f885c58ca4c8453fd9d97d55c1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.6] - 2025-04-05
|
4
|
+
|
5
|
+
- Decrease default vernier allocation interval from 20k to 2k
|
6
|
+
|
7
|
+
## [0.2.5] - 2025-04-04
|
8
|
+
|
9
|
+
- Perf: Write prosopite logs to IO stream instead of file
|
10
|
+
- Remove upper bound on rails dependencies
|
11
|
+
|
3
12
|
## [0.2.4] - 2025-03-03
|
4
13
|
|
5
14
|
- Add configuration option for setting script CSP nonce (thanks @matthaigh27)
|
data/README.md
CHANGED
@@ -5,7 +5,14 @@
|
|
5
5
|
|
6
6
|
WIP
|
7
7
|
|
8
|
-
A modern profiler for Rails
|
8
|
+
A modern profiler for your Rails application.
|
9
|
+
|
10
|
+
Utilizes [vernier](https://github.com/jhawthorn/vernier) for profiling and
|
11
|
+
[prosopite](https://github.com/charkost/prosopite) for N+1 query detection.
|
12
|
+
|
13
|
+
> [!NOTE]
|
14
|
+
> Check out the resources in the [Vernier](https://github.com/jhawthorn/vernier) project for more information on how to
|
15
|
+
> interpret the viewer, as well as comparisons with other profilers, including `stackprof`.
|
9
16
|
|
10
17
|
Check out the demo:
|
11
18
|
[](https://youtu.be/LPXtfJ0c284)
|
@@ -45,14 +52,33 @@ Dial.configure do |config|
|
|
45
52
|
end
|
46
53
|
```
|
47
54
|
|
48
|
-
|
55
|
+
## Options
|
49
56
|
|
50
57
|
Option | Description | Default
|
51
|
-
|
58
|
+
:- | :- | :-
|
52
59
|
`vernier_interval` | Sets the `interval` option for vernier. | `200`
|
53
60
|
`vernier_allocation_interval` | Sets the `allocation_interval` option for vernier. | `20_000`
|
54
61
|
`prosopite_ignore_queries` | Sets the `ignore_queries` option for prosopite. | `[/schema_migrations/i]`
|
55
|
-
`content_security_policy_nonce` | Sets the content security policy nonce to use when inserting Dial's script. Can be a string, or a Proc which receives `env` and response `headers` as arguments and returns the nonce. | Rails generated nonce or `nil`
|
62
|
+
`content_security_policy_nonce` | Sets the content security policy nonce to use when inserting Dial's script. Can be a string, or a Proc which receives `env` and response `headers` as arguments and returns the nonce string. | Rails generated nonce or `nil`
|
63
|
+
|
64
|
+
## Comparison with [rack-mini-profiler](https://github.com/MiniProfiler/rack-mini-profiler)
|
65
|
+
|
66
|
+
| | rack-mini-profiler | Dial |
|
67
|
+
| :------------------------ | :--------------------------------- | :------------------------------------------------------ |
|
68
|
+
| Compatibility | Any Rack application | Only Rails applications |
|
69
|
+
| Database Profiling | Yes | Yes (via vernier hook - marker table, chart) |
|
70
|
+
| N+1 Query Detection | Yes (*needs to be inferred) | Yes (via prosopite) |
|
71
|
+
| Ruby Profiling | Yes (with stackprof - flame graph) | Yes (via vernier - flame graph, stack chart, call tree) |
|
72
|
+
| Ruby Allocation Profiling | Yes (with stackprof - flame graph) | Yes (via vernier - flame graph, stack chart, call tree) |
|
73
|
+
| Memory Profiling | Yes (with memory_profiler) | Yes (*overall usage only) (via vernier hook - graph) |
|
74
|
+
| View Profiling | Yes | Yes (via vernier hook - marker table, chart) |
|
75
|
+
| Snapshot Sampling | Yes | No |
|
76
|
+
| Production Support | Yes | No (WIP) |
|
77
|
+
|
78
|
+
> [!NOTE]
|
79
|
+
> SQL queries displayed in the profile are not annotated with the caller location by default. If you're not using the
|
80
|
+
> [marginalia](https://github.com/basecamp/marginalia) gem to annotate your queries, you will need to extend your
|
81
|
+
> application's [ActiveRecord QueryLogs](https://edgeapi.rubyonrails.org/classes/ActiveRecord/QueryLogs.html) yourself.
|
56
82
|
|
57
83
|
## Development
|
58
84
|
|
@@ -69,5 +95,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
69
95
|
|
70
96
|
## Code of Conduct
|
71
97
|
|
72
|
-
Everyone interacting in the Dial project's
|
73
|
-
|
98
|
+
Everyone interacting in the Dial project's codebase and issue tracker is expected to follow the
|
99
|
+
[code of conduct](https://github.com/joshuay03/dial/blob/main/CODE_OF_CONDUCT.md).
|
data/dial.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Joshua Young"]
|
9
9
|
spec.email = ["djry1999@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "A modern Rails
|
11
|
+
spec.summary = "A modern profiler for your Rails application"
|
12
12
|
spec.homepage = "https://github.com/joshuay03/dial"
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.required_ruby_version = ">= 3.3.0"
|
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.files = Dir["{lib}/**/*", "**/*.{gemspec,md,txt}"]
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "railties", ">= 7"
|
23
|
-
spec.add_dependency "activerecord", ">= 7"
|
24
|
-
spec.add_dependency "actionpack", ">= 7"
|
22
|
+
spec.add_dependency "railties", ">= 7"
|
23
|
+
spec.add_dependency "activerecord", ">= 7"
|
24
|
+
spec.add_dependency "actionpack", ">= 7"
|
25
25
|
spec.add_dependency "vernier"
|
26
26
|
spec.add_dependency "prosopite"
|
27
27
|
spec.add_dependency "pg_query"
|
data/lib/dial/constants.rb
CHANGED
@@ -17,10 +17,10 @@ module Dial
|
|
17
17
|
FILE_STALE_SECONDS = 60 * 60
|
18
18
|
|
19
19
|
VERNIER_INTERVAL = 200
|
20
|
-
VERNIER_ALLOCATION_INTERVAL =
|
20
|
+
VERNIER_ALLOCATION_INTERVAL = 2_000
|
21
21
|
VERNIER_PROFILE_OUT_RELATIVE_DIRNAME = "tmp/dial/profiles"
|
22
|
+
VERNIER_VIEWER_URL = "https://vernier.prof"
|
22
23
|
|
23
24
|
PROSOPITE_IGNORE_QUERIES = [/schema_migrations/i].freeze
|
24
|
-
|
25
|
-
PROSOPITE_LOG_FILENAME = "#{Util.uuid}_prosopite_#{PROGRAM_ID}.log".freeze
|
25
|
+
PROSOPITE_LOG_IO = StringIO.new
|
26
26
|
end
|
data/lib/dial/engine/routes.rb
CHANGED
@@ -9,7 +9,7 @@ Dial::Engine.routes.draw do
|
|
9
9
|
if File.exist? path
|
10
10
|
[
|
11
11
|
200,
|
12
|
-
{ "Content-Type" => "application/json", "Access-Control-Allow-Origin" =>
|
12
|
+
{ "Content-Type" => "application/json", "Access-Control-Allow-Origin" => Dial::VERNIER_VIEWER_URL },
|
13
13
|
[File.read(path)]
|
14
14
|
]
|
15
15
|
else
|
data/lib/dial/middleware.rb
CHANGED
@@ -88,16 +88,14 @@ module Dial
|
|
88
88
|
|
89
89
|
def clear_query_logs!
|
90
90
|
[].tap do |query_logs|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
query_logs << entry if entry && section.nil?
|
96
|
-
end
|
97
|
-
|
98
|
-
file.truncate 0
|
99
|
-
file.rewind
|
91
|
+
entry = section = count = nil
|
92
|
+
PROSOPITE_LOG_IO.string.lines.each do |line|
|
93
|
+
entry, section, count = process_query_log_line line, entry, section, count
|
94
|
+
query_logs << entry if entry && section.nil?
|
100
95
|
end
|
96
|
+
|
97
|
+
PROSOPITE_LOG_IO.truncate 0
|
98
|
+
PROSOPITE_LOG_IO.rewind
|
101
99
|
end
|
102
100
|
end
|
103
101
|
|
@@ -128,9 +126,5 @@ module Dial
|
|
128
126
|
def profile_out_dir_pathname
|
129
127
|
::Rails.root.join VERNIER_PROFILE_OUT_RELATIVE_DIRNAME
|
130
128
|
end
|
131
|
-
|
132
|
-
def query_log_dir_pathname
|
133
|
-
::Rails.root.join PROSOPITE_LOG_RELATIVE_DIRNAME
|
134
|
-
end
|
135
129
|
end
|
136
130
|
end
|
data/lib/dial/railtie.rb
CHANGED
@@ -31,16 +31,7 @@ module Dial
|
|
31
31
|
require "pg_query"
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
FileUtils.mkdir_p File.dirname prosopite_log_pathname
|
36
|
-
FileUtils.touch prosopite_log_pathname
|
37
|
-
::Prosopite.custom_logger = ProsopiteLogger.new prosopite_log_pathname
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
initializer "dial.clean_up_prosopite_log_files", after: :load_config_initializers do |app|
|
42
|
-
stale_files("#{query_log_dir_pathname}/*.log").each do |query_log_file|
|
43
|
-
File.delete query_log_file rescue nil
|
34
|
+
::Prosopite.custom_logger = ProsopiteLogger.new PROSOPITE_LOG_IO
|
44
35
|
end
|
45
36
|
end
|
46
37
|
|
@@ -64,9 +55,5 @@ module Dial
|
|
64
55
|
def profile_out_dir_pathname
|
65
56
|
::Rails.root.join VERNIER_PROFILE_OUT_RELATIVE_DIRNAME
|
66
57
|
end
|
67
|
-
|
68
|
-
def query_log_dir_pathname
|
69
|
-
::Rails.root.join PROSOPITE_LOG_RELATIVE_DIRNAME
|
70
|
-
end
|
71
58
|
end
|
72
59
|
end
|
data/lib/dial/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Young
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-05 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: railties
|
@@ -16,9 +16,6 @@ dependencies:
|
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: '7'
|
19
|
-
- - "<"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '8.2'
|
22
19
|
type: :runtime
|
23
20
|
prerelease: false
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,9 +23,6 @@ dependencies:
|
|
26
23
|
- - ">="
|
27
24
|
- !ruby/object:Gem::Version
|
28
25
|
version: '7'
|
29
|
-
- - "<"
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: '8.2'
|
32
26
|
- !ruby/object:Gem::Dependency
|
33
27
|
name: activerecord
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -36,9 +30,6 @@ dependencies:
|
|
36
30
|
- - ">="
|
37
31
|
- !ruby/object:Gem::Version
|
38
32
|
version: '7'
|
39
|
-
- - "<"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '8.2'
|
42
33
|
type: :runtime
|
43
34
|
prerelease: false
|
44
35
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -46,9 +37,6 @@ dependencies:
|
|
46
37
|
- - ">="
|
47
38
|
- !ruby/object:Gem::Version
|
48
39
|
version: '7'
|
49
|
-
- - "<"
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: '8.2'
|
52
40
|
- !ruby/object:Gem::Dependency
|
53
41
|
name: actionpack
|
54
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,9 +44,6 @@ dependencies:
|
|
56
44
|
- - ">="
|
57
45
|
- !ruby/object:Gem::Version
|
58
46
|
version: '7'
|
59
|
-
- - "<"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '8.2'
|
62
47
|
type: :runtime
|
63
48
|
prerelease: false
|
64
49
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -66,9 +51,6 @@ dependencies:
|
|
66
51
|
- - ">="
|
67
52
|
- !ruby/object:Gem::Version
|
68
53
|
version: '7'
|
69
|
-
- - "<"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '8.2'
|
72
54
|
- !ruby/object:Gem::Dependency
|
73
55
|
name: vernier
|
74
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,5 +139,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
139
|
requirements: []
|
158
140
|
rubygems_version: 3.6.2
|
159
141
|
specification_version: 4
|
160
|
-
summary: A modern Rails
|
142
|
+
summary: A modern profiler for your Rails application
|
161
143
|
test_files: []
|