appsignal 2.9.3-java → 2.9.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +543 -535
- data/lib/appsignal/event_formatter/action_view/render_formatter.rb +10 -8
- data/lib/appsignal/hooks/puma.rb +2 -0
- data/lib/appsignal/hooks/sidekiq.rb +2 -1
- data/lib/appsignal/minutely.rb +2 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +38 -28
- data/spec/lib/appsignal/hooks/puma_spec.rb +35 -17
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +2 -2
- data/spec/lib/appsignal/minutely_spec.rb +16 -17
- metadata +2 -2
@@ -22,11 +22,13 @@ module Appsignal
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
if defined?(Rails)
|
26
|
+
Appsignal::EventFormatter.register(
|
27
|
+
"render_partial.action_view",
|
28
|
+
Appsignal::EventFormatter::ActionView::RenderFormatter
|
29
|
+
)
|
30
|
+
Appsignal::EventFormatter.register(
|
31
|
+
"render_template.action_view",
|
32
|
+
Appsignal::EventFormatter::ActionView::RenderFormatter
|
33
|
+
)
|
34
|
+
end
|
data/lib/appsignal/hooks/puma.rb
CHANGED
@@ -49,7 +49,8 @@ module Appsignal
|
|
49
49
|
|
50
50
|
::Sidekiq::Queue.all.each do |queue|
|
51
51
|
gauge "queue_length", queue.size, :queue => queue.name
|
52
|
-
|
52
|
+
# Convert latency from seconds to milliseconds
|
53
|
+
gauge "queue_latency", queue.latency * 1_000.0, :queue => queue.name
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
data/lib/appsignal/minutely.rb
CHANGED
@@ -145,7 +145,8 @@ module Appsignal
|
|
145
145
|
logger.debug("Gathering minutely metrics with '#{name}' probe")
|
146
146
|
probe.call
|
147
147
|
rescue => ex
|
148
|
-
logger.error
|
148
|
+
logger.error "Error in minutely probe '#{name}': #{ex}\n"
|
149
|
+
logger.debug ex.backtrace.join("\n")
|
149
150
|
end
|
150
151
|
end
|
151
152
|
sleep(Appsignal::Minutely.wait_time)
|
data/lib/appsignal/version.rb
CHANGED
@@ -1,43 +1,53 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
describe Appsignal::EventFormatter::ActionView::RenderFormatter do
|
2
|
+
let(:klass) { Appsignal::EventFormatter::ActionView::RenderFormatter }
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
let(:klass) { Appsignal::EventFormatter::ActionView::RenderFormatter }
|
7
|
-
let(:formatter) { klass.new }
|
4
|
+
if DependencyHelper.rails_present?
|
5
|
+
require "action_view"
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
context "when in a Rails app" do
|
8
|
+
let(:formatter) { klass.new }
|
9
|
+
before { allow(Rails.root).to receive(:to_s).and_return("/var/www/app/20130101") }
|
10
|
+
|
11
|
+
it "registers render_partial.action_view and render_template.action_view" do
|
12
|
+
expect(Appsignal::EventFormatter.registered?("render_partial.action_view", klass)).to be_truthy
|
13
|
+
expect(Appsignal::EventFormatter.registered?("render_template.action_view", klass)).to be_truthy
|
14
|
+
end
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
describe "#root_path" do
|
17
|
+
subject { formatter.root_path }
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
it "returns Rails root path" do
|
20
|
+
is_expected.to eq "/var/www/app/20130101/"
|
21
|
+
end
|
19
22
|
end
|
20
|
-
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
+
describe "#format" do
|
25
|
+
subject { formatter.format(payload) }
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
context "with an identifier" do
|
28
|
+
let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb" } }
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
+
it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
|
31
|
+
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
+
context "with a frozen identifier" do
|
34
|
+
let(:payload) { { :identifier => "/var/www/app/20130101/app/views/home/index/html.erb".freeze } }
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
+
it { is_expected.to eq ["app/views/home/index/html.erb", nil] }
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
+
context "without an identifier" do
|
40
|
+
let(:payload) { {} }
|
39
41
|
|
40
|
-
|
42
|
+
it { is_expected.to be_nil }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
else
|
47
|
+
context "when not in a Rails app" do
|
48
|
+
it "does not register the event formatter" do
|
49
|
+
expect(Appsignal::EventFormatter.registered?("render_partial.action_view", klass)).to be_falsy
|
50
|
+
expect(Appsignal::EventFormatter.registered?("render_template.action_view", klass)).to be_falsy
|
41
51
|
end
|
42
52
|
end
|
43
53
|
end
|
@@ -8,11 +8,6 @@ describe Appsignal::Hooks::PumaHook do
|
|
8
8
|
def self.cli_config
|
9
9
|
@cli_config ||= CliConfig.new
|
10
10
|
end
|
11
|
-
|
12
|
-
class Cluster
|
13
|
-
def stop_workers
|
14
|
-
end
|
15
|
-
end
|
16
11
|
end
|
17
12
|
|
18
13
|
class CliConfig
|
@@ -31,23 +26,46 @@ describe Appsignal::Hooks::PumaHook do
|
|
31
26
|
it { is_expected.to be_truthy }
|
32
27
|
end
|
33
28
|
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
describe "installation" do
|
30
|
+
context "when not clustered mode" do
|
31
|
+
it "does not add AppSignal stop behavior Puma::Cluster" do
|
32
|
+
expect(defined?(::Puma::Cluster)).to be_falsy
|
33
|
+
# Does not error on call
|
34
|
+
Appsignal::Hooks::PumaHook.new.install
|
35
|
+
end
|
36
|
+
|
37
|
+
it "adds the Puma minutely probe" do
|
38
|
+
probe = Appsignal::Minutely.probes[:puma]
|
39
|
+
expect(probe).to eql(Appsignal::Hooks::PumaProbe)
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
|
-
|
40
|
-
|
43
|
+
context "when in clustered mode" do
|
44
|
+
before do
|
45
|
+
class Puma
|
46
|
+
class Cluster
|
47
|
+
def stop_workers
|
48
|
+
@called = true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
Appsignal::Hooks::PumaHook.new.install
|
53
|
+
end
|
54
|
+
after { Puma.send(:remove_const, :Cluster) }
|
41
55
|
|
42
|
-
|
43
|
-
|
56
|
+
it "adds behavior to Puma::Cluster.stop_workers" do
|
57
|
+
cluster = Puma::Cluster.new
|
44
58
|
|
45
|
-
|
46
|
-
|
59
|
+
expect(cluster.instance_variable_defined?(:@called)).to be_falsy
|
60
|
+
expect(Appsignal).to receive(:stop).and_call_original
|
61
|
+
cluster.stop_workers
|
62
|
+
expect(cluster.instance_variable_get(:@called)).to be(true)
|
63
|
+
end
|
47
64
|
|
48
|
-
|
49
|
-
|
50
|
-
|
65
|
+
it "adds the Puma minutely probe" do
|
66
|
+
probe = Appsignal::Minutely.probes[:puma]
|
67
|
+
expect(probe).to eql(Appsignal::Hooks::PumaProbe)
|
68
|
+
end
|
51
69
|
end
|
52
70
|
end
|
53
71
|
|
@@ -684,9 +684,9 @@ describe Appsignal::Hooks::SidekiqProbe do
|
|
684
684
|
expect_gauge("job_count", 14, :status => :scheduled).twice
|
685
685
|
expect_gauge("job_count", 15, :status => :enqueued).twice
|
686
686
|
expect_gauge("queue_length", 10, :queue => "default").twice
|
687
|
-
expect_gauge("queue_latency",
|
687
|
+
expect_gauge("queue_latency", 12_000, :queue => "default").twice
|
688
688
|
expect_gauge("queue_length", 1, :queue => "critical").twice
|
689
|
-
expect_gauge("queue_latency",
|
689
|
+
expect_gauge("queue_latency", 2_000, :queue => "critical").twice
|
690
690
|
# Call probe twice so we can calculate the delta for some gauge values
|
691
691
|
probe.call
|
692
692
|
probe.call
|
@@ -27,12 +27,9 @@ describe Appsignal::Minutely do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
let(:log_stream) { StringIO.new }
|
30
|
-
let(:log)
|
31
|
-
log_stream.rewind
|
32
|
-
log_stream.read
|
33
|
-
end
|
30
|
+
let(:log) { log_contents(log_stream) }
|
34
31
|
before do
|
35
|
-
Appsignal.logger =
|
32
|
+
Appsignal.logger = test_logger(log_stream)
|
36
33
|
# Speed up test time
|
37
34
|
allow(Appsignal::Minutely).to receive(:wait_time).and_return(0.001)
|
38
35
|
end
|
@@ -44,8 +41,8 @@ describe Appsignal::Minutely do
|
|
44
41
|
Appsignal::Minutely.start
|
45
42
|
|
46
43
|
wait_for("enough probe calls") { probe.calls >= 2 }
|
47
|
-
expect(log).to
|
48
|
-
expect(log).to
|
44
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 1 probe")
|
45
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 'my_probe' probe")
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
@@ -58,8 +55,8 @@ describe Appsignal::Minutely do
|
|
58
55
|
Appsignal::Minutely.start
|
59
56
|
|
60
57
|
wait_for("enough probe calls") { probe_instance.calls >= 2 }
|
61
|
-
expect(log).to
|
62
|
-
expect(log).to
|
58
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 1 probe")
|
59
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 'my_probe' probe")
|
63
60
|
end
|
64
61
|
end
|
65
62
|
|
@@ -71,8 +68,8 @@ describe Appsignal::Minutely do
|
|
71
68
|
Appsignal::Minutely.start
|
72
69
|
|
73
70
|
wait_for("enough probe calls") { calls >= 2 }
|
74
|
-
expect(log).to
|
75
|
-
expect(log).to
|
71
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 1 probe")
|
72
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 'my_probe' probe")
|
76
73
|
end
|
77
74
|
end
|
78
75
|
|
@@ -87,10 +84,12 @@ describe Appsignal::Minutely do
|
|
87
84
|
wait_for("enough probe calls") { probe.calls >= 2 }
|
88
85
|
wait_for("enough broken_probe calls") { broken_probe.calls >= 2 }
|
89
86
|
|
90
|
-
expect(log).to
|
91
|
-
expect(log).to
|
92
|
-
expect(log).to
|
93
|
-
expect(log).to
|
87
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 2 probes")
|
88
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 'my_probe' probe")
|
89
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 'broken_probe' probe")
|
90
|
+
expect(log).to contains_log(:error, "Error in minutely probe 'broken_probe': oh no!")
|
91
|
+
gem_path = File.expand_path("../../../../", __FILE__) # Start of backtrace
|
92
|
+
expect(log).to contains_log(:debug, gem_path)
|
94
93
|
end
|
95
94
|
end
|
96
95
|
|
@@ -103,8 +102,8 @@ describe Appsignal::Minutely do
|
|
103
102
|
end.to change { alive_thread_counter.call }.by(1)
|
104
103
|
|
105
104
|
wait_for("enough probe calls") { probe.calls >= 2 }
|
106
|
-
expect(log).to
|
107
|
-
expect(log).to
|
105
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 1 probe")
|
106
|
+
expect(log).to contains_log(:debug, "Gathering minutely metrics with 'my_probe' probe")
|
108
107
|
expect do
|
109
108
|
# Fetch old thread
|
110
109
|
thread = Appsignal::Minutely.class_variable_get(:@@thread)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|