dial 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dial/constants.rb +5 -2
- data/lib/dial/engine/routes.rb +1 -1
- data/lib/dial/middleware.rb +2 -2
- data/lib/dial/railtie.rb +3 -3
- data/lib/dial/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: 31949e2dbaf8b3ca4f422ae02115747913ce3bd704b0aaf8d45d5956d0ba2ac5
|
4
|
+
data.tar.gz: aecdd78df3d7e50c0dd9b98c67c0f7633d6cc2fa43ea33d01987a148dff53cf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21ed80548f3559308cfdc13ff69df8168ef87ffa6268faea8d5901e2209cbd1e9f775bcbd48db355e83c1d3e48cb59f285af0c0271fc1fa14442852c84dab521
|
7
|
+
data.tar.gz: 202f8d84d6ce0520b7bf53df0cac7545a85f1c6f723c845158c9161cf52f1a1a6fbe55e70671a70c9bf1ca43aad052d28d2f10b3a7572ea34c5747090121ab98
|
data/CHANGELOG.md
CHANGED
data/lib/dial/constants.rb
CHANGED
@@ -7,8 +7,11 @@ module Dial
|
|
7
7
|
|
8
8
|
REQUEST_TIMING_HEADER = "dial_request_timing"
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
FILE_STALE_SECONDS = 60 * 60
|
11
|
+
|
12
|
+
VERNIER_INTERVAL = 500
|
13
|
+
VERNIER_ALLOCATION_INTERVAL = 100_000
|
14
|
+
VERNIER_PROFILE_OUT_RELATIVE_DIRNAME = "tmp/dial/profiles"
|
12
15
|
|
13
16
|
PROSOPITE_IGNORE_QUERIES = [/schema_migrations/].freeze
|
14
17
|
PROSOPITE_LOG_RELATIVE_DIRNAME = "log/dial"
|
data/lib/dial/engine/routes.rb
CHANGED
@@ -4,7 +4,7 @@ Dial::Engine.routes.draw do
|
|
4
4
|
scope path: "/dial", as: "dial" do
|
5
5
|
get "profile", to: lambda { |env|
|
6
6
|
uuid = env[::Rack::QUERY_STRING].sub "uuid=", ""
|
7
|
-
path = String ::Rails.root.join Dial::
|
7
|
+
path = String ::Rails.root.join Dial::VERNIER_PROFILE_OUT_RELATIVE_DIRNAME, "#{uuid}.json"
|
8
8
|
|
9
9
|
if File.exist? path
|
10
10
|
[
|
data/lib/dial/middleware.rb
CHANGED
@@ -25,7 +25,7 @@ module Dial
|
|
25
25
|
status, headers, rack_body = nil
|
26
26
|
ruby_vm_stat, gc_stat, gc_stat_heap = nil
|
27
27
|
::Prosopite.scan do
|
28
|
-
::Vernier.profile out: profile_out_pathname, interval:
|
28
|
+
::Vernier.profile out: profile_out_pathname, interval: VERNIER_INTERVAL, allocation_interval: VERNIER_ALLOCATION_INTERVAL, hooks: [:memory_usage, :rails] do
|
29
29
|
ruby_vm_stat, gc_stat, gc_stat_heap = with_diffed_ruby_stats do
|
30
30
|
status, headers, rack_body = @app.call env
|
31
31
|
end
|
@@ -109,7 +109,7 @@ module Dial
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def profile_out_dir_pathname
|
112
|
-
::Rails.root.join
|
112
|
+
::Rails.root.join VERNIER_PROFILE_OUT_RELATIVE_DIRNAME
|
113
113
|
end
|
114
114
|
|
115
115
|
def query_log_dir_pathname
|
data/lib/dial/railtie.rb
CHANGED
@@ -14,7 +14,7 @@ module Dial
|
|
14
14
|
|
15
15
|
initializer "dial.set_up_vernier" do |app|
|
16
16
|
app.config.after_initialize do
|
17
|
-
FileUtils.mkdir_p ::Rails.root.join
|
17
|
+
FileUtils.mkdir_p ::Rails.root.join VERNIER_PROFILE_OUT_RELATIVE_DIRNAME
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -50,12 +50,12 @@ module Dial
|
|
50
50
|
def stale_files glob_pattern
|
51
51
|
Dir.glob(glob_pattern).select do |file|
|
52
52
|
timestamp = Util.uuid_timestamp Util.file_name_uuid File.basename file
|
53
|
-
timestamp < Time.now -
|
53
|
+
timestamp < Time.now - FILE_STALE_SECONDS
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
def profile_out_dir_pathname
|
58
|
-
::Rails.root.join
|
58
|
+
::Rails.root.join VERNIER_PROFILE_OUT_RELATIVE_DIRNAME
|
59
59
|
end
|
60
60
|
|
61
61
|
def query_log_dir_pathname
|
data/lib/dial/version.rb
CHANGED