appsignal 2.11.7 → 2.11.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/appsignal/minutely.rb +6 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/puma/appsignal_spec.rb +28 -0
- 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: 8cb57893fb10d1d54593fcf13b4d2b13ac728e9d0c5c16f046580b1befb6048d
|
4
|
+
data.tar.gz: ef465afb88df2f8f53015e84192159d464c4827e66a1ee19bed38b73712e810c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 663ba5e66fd1bad997a27c164d7e9845effb7d419b6b23a3b33a1f0f71f50d18071194f75216e347956f11e3ad2730f82e7c24fb4029b2c9daf4bd597c289450
|
7
|
+
data.tar.gz: e7a8ba54779115a77703090837a9814e017884607d3b059b620a875cba9c52bc449fa56006ad443ecc076d1bf8bfc7b8c109bd7d61c811c8f5748e683b94f3d4
|
data/CHANGELOG.md
CHANGED
data/lib/appsignal/minutely.rb
CHANGED
@@ -135,6 +135,12 @@ module Appsignal
|
|
135
135
|
def start
|
136
136
|
stop
|
137
137
|
@thread = Thread.new do
|
138
|
+
# Advise multi-threaded app servers to ignore this thread
|
139
|
+
# for the purposes of fork safety warnings
|
140
|
+
if Thread.current.respond_to?(:thread_variable_set)
|
141
|
+
Thread.current.thread_variable_set(:fork_safe, true)
|
142
|
+
end
|
143
|
+
|
138
144
|
sleep initial_wait_time
|
139
145
|
initialize_probes
|
140
146
|
loop do
|
data/lib/appsignal/version.rb
CHANGED
@@ -23,6 +23,27 @@ RSpec.describe "Puma plugin" do
|
|
23
23
|
def self.stats
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.run
|
27
|
+
# Capture threads running before application is preloaded
|
28
|
+
before = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
|
29
|
+
|
30
|
+
# An abbreviated version of what happens in Puma::Cluster#run
|
31
|
+
launcher = MockPumaLauncher.new
|
32
|
+
plugin = Plugin.plugin.new
|
33
|
+
plugin.start(launcher)
|
34
|
+
launcher.events.on_booted.call
|
35
|
+
|
36
|
+
# Wait for minutely probe thread to finish starting
|
37
|
+
sleep 0.005
|
38
|
+
|
39
|
+
# Capture any new threads running after application is preloaded.
|
40
|
+
# Any threads created during the preloading phase will not be
|
41
|
+
# carried over into the forked workers. Puma warns about these
|
42
|
+
# but the minutely probe thread should only exist in the main process.
|
43
|
+
after = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
|
44
|
+
$stdout.puts "! WARNING: Detected #{after.size - before.size} Thread(s) started in app boot" if after.size > before.size
|
45
|
+
end
|
46
|
+
|
26
47
|
class Plugin
|
27
48
|
class << self
|
28
49
|
attr_reader :plugin
|
@@ -68,6 +89,13 @@ RSpec.describe "Puma plugin" do
|
|
68
89
|
wait_for("enough probe calls") { probe.calls >= 2 }
|
69
90
|
end
|
70
91
|
|
92
|
+
it "marks the PumaProbe thread as fork-safe", :not_ruby19 do
|
93
|
+
out_stream = std_stream
|
94
|
+
capture_stdout(out_stream) { Puma.run }
|
95
|
+
|
96
|
+
expect(out_stream.read).not_to include("WARNING: Detected 1 Thread")
|
97
|
+
end
|
98
|
+
|
71
99
|
context "without Puma.stats" do
|
72
100
|
before { Puma.singleton_class.send(:remove_method, :stats) }
|
73
101
|
|