appsignal 2.9.1-java → 2.9.2.alpha.1-java
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 +5 -0
- data/ext/agent.yml +37 -37
- data/lib/appsignal/hooks/puma.rb +27 -22
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/hooks/puma_spec.rb +62 -4
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4da7f89bb19ab5f01f12806e105618450dcac76e6538b2c5b564460057efaeb2
|
|
4
|
+
data.tar.gz: ddff64093d33d54fad4474b06239ec78482f6976ee801bc09c51cb9d9806570a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ebf1629b16f7310f861c56f922e4963a46ec811d9f58ce4314bdda67bf52be3a7a0ad7a45ef621b205b7cecaaa58d3abaf95d6173f9e7e5c6160d1f4ab13b09
|
|
7
|
+
data.tar.gz: 70a7705b24c12690975fd044fedf5208f45a743f62ded83867d928fb01d1cdab79f7739cc2f93da56ae5e47c60bf4f822054e94465637e3fdd86b04d9a3cc2ea
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# 2.9.2 Alpha 1
|
|
2
|
+
- Fix Puma.stats calls. PR #496
|
|
3
|
+
- Only send Puma metrics if available. PR #497
|
|
4
|
+
- Track memory metrics of the current process. PR #499
|
|
5
|
+
|
|
1
6
|
# 2.9.1
|
|
2
7
|
- Fix memory leak in custom metrics key names.
|
|
3
8
|
Commit 9064e2ccfd19ee05c333d0ecda4deafdd743629e
|
data/ext/agent.yml
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
---
|
|
2
|
-
version:
|
|
2
|
+
version: 4019bf9
|
|
3
3
|
triples:
|
|
4
4
|
x86_64-darwin:
|
|
5
5
|
static:
|
|
6
|
-
checksum:
|
|
7
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
6
|
+
checksum: ab5d75d7d1554b53d83b9181fc1b3d05220d5bd86cd6d5a0b91ef4a262e1c571
|
|
7
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-static.tar.gz
|
|
8
8
|
dynamic:
|
|
9
|
-
checksum:
|
|
10
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
9
|
+
checksum: 19fb47d063aa02f665868220568095996c6616b61d58f9a86980a7ace60ed7f9
|
|
10
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-dynamic.tar.gz
|
|
11
11
|
universal-darwin:
|
|
12
12
|
static:
|
|
13
|
-
checksum:
|
|
14
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
13
|
+
checksum: ab5d75d7d1554b53d83b9181fc1b3d05220d5bd86cd6d5a0b91ef4a262e1c571
|
|
14
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-static.tar.gz
|
|
15
15
|
dynamic:
|
|
16
|
-
checksum:
|
|
17
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
16
|
+
checksum: 19fb47d063aa02f665868220568095996c6616b61d58f9a86980a7ace60ed7f9
|
|
17
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-dynamic.tar.gz
|
|
18
18
|
i686-linux:
|
|
19
19
|
static:
|
|
20
|
-
checksum:
|
|
21
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
20
|
+
checksum: 6ab48834486b380edf22aa85ea858763046e98952ff3afcad8cb61589be802ff
|
|
21
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-static.tar.gz
|
|
22
22
|
dynamic:
|
|
23
|
-
checksum:
|
|
24
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
23
|
+
checksum: 6e4c3b0f62ee688938ad35842452ff9ac54f35da07959d90f6aa43269effdbe9
|
|
24
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-dynamic.tar.gz
|
|
25
25
|
x86-linux:
|
|
26
26
|
static:
|
|
27
|
-
checksum:
|
|
28
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
27
|
+
checksum: 6ab48834486b380edf22aa85ea858763046e98952ff3afcad8cb61589be802ff
|
|
28
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-static.tar.gz
|
|
29
29
|
dynamic:
|
|
30
|
-
checksum:
|
|
31
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
30
|
+
checksum: 6e4c3b0f62ee688938ad35842452ff9ac54f35da07959d90f6aa43269effdbe9
|
|
31
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-dynamic.tar.gz
|
|
32
32
|
i686-linux-musl:
|
|
33
33
|
static:
|
|
34
|
-
checksum:
|
|
35
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
34
|
+
checksum: cf6e2d45978d32ad0330bdad035f536df931a9e5e647cc4eadfb5982dfb76818
|
|
35
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-musl-all-static.tar.gz
|
|
36
36
|
x86-linux-musl:
|
|
37
37
|
static:
|
|
38
|
-
checksum:
|
|
39
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
38
|
+
checksum: cf6e2d45978d32ad0330bdad035f536df931a9e5e647cc4eadfb5982dfb76818
|
|
39
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-musl-all-static.tar.gz
|
|
40
40
|
x86_64-linux:
|
|
41
41
|
static:
|
|
42
|
-
checksum:
|
|
43
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
42
|
+
checksum: c7f4383ec3a896fe8652d28a96f272763e9a7c81372520bf082eabd0ed34bdbd
|
|
43
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-all-static.tar.gz
|
|
44
44
|
dynamic:
|
|
45
|
-
checksum:
|
|
46
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
45
|
+
checksum: fe0f3a0fcfe48aa29a88fa8fe97c9c3f16210e53ea1fc741845bf2addab5fce5
|
|
46
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-all-dynamic.tar.gz
|
|
47
47
|
x86_64-linux-musl:
|
|
48
48
|
static:
|
|
49
|
-
checksum:
|
|
50
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
49
|
+
checksum: d110e32589041d03f2787982591557aa934172392a4ff9d63b5823fc624232c7
|
|
50
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-musl-all-static.tar.gz
|
|
51
51
|
dynamic:
|
|
52
|
-
checksum:
|
|
53
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
52
|
+
checksum: 7230a12b448cdec33a72ad4abfb405ade8a02e0c47a7302a40267b87039533d2
|
|
53
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
|
54
54
|
x86_64-freebsd:
|
|
55
55
|
static:
|
|
56
|
-
checksum:
|
|
57
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
56
|
+
checksum: 203c49fabed6a375d691e8d62c2b3f0e82bef806765fa1cd718bd5c04658c629
|
|
57
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-static.tar.gz
|
|
58
58
|
dynamic:
|
|
59
|
-
checksum:
|
|
60
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
59
|
+
checksum: 4d5df3da68e7961f5b6a779f63db5d8a458472700ae8cc729932c606dea84b71
|
|
60
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
|
61
61
|
amd64-freebsd:
|
|
62
62
|
static:
|
|
63
|
-
checksum:
|
|
64
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
63
|
+
checksum: 203c49fabed6a375d691e8d62c2b3f0e82bef806765fa1cd718bd5c04658c629
|
|
64
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-static.tar.gz
|
|
65
65
|
dynamic:
|
|
66
|
-
checksum:
|
|
67
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
|
66
|
+
checksum: 4d5df3da68e7961f5b6a779f63db5d8a458472700ae8cc729932c606dea84b71
|
|
67
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/lib/appsignal/hooks/puma.rb
CHANGED
|
@@ -44,41 +44,34 @@ module Appsignal
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def call
|
|
47
|
-
|
|
47
|
+
puma_stats = fetch_puma_stats
|
|
48
|
+
return unless puma_stats
|
|
48
49
|
|
|
49
|
-
stats = JSON.parse
|
|
50
|
-
counts = {
|
|
51
|
-
|
|
52
|
-
:running => 0,
|
|
53
|
-
:pool_capacity => 0,
|
|
54
|
-
:max_threads => 0
|
|
55
|
-
}
|
|
50
|
+
stats = JSON.parse puma_stats, :symbolize_names => true
|
|
51
|
+
counts = {}
|
|
52
|
+
count_keys = [:backlog, :running, :pool_capacity, :max_threads]
|
|
56
53
|
|
|
57
54
|
if stats[:worker_status] # Multiple workers
|
|
58
55
|
stats[:worker_status].each do |worker|
|
|
59
56
|
stat = worker[:last_status]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
counts[:pool_capacity] += stat[:pool_capacity]
|
|
64
|
-
counts[:max_threads] += stat[:max_threads]
|
|
57
|
+
count_keys.each do |key|
|
|
58
|
+
count_if_present counts, key, stat
|
|
59
|
+
end
|
|
65
60
|
end
|
|
66
61
|
|
|
67
62
|
gauge(:workers, stats[:workers], :type => :count)
|
|
68
63
|
gauge(:workers, stats[:booted_workers], :type => :booted)
|
|
69
64
|
gauge(:workers, stats[:old_workers], :type => :old)
|
|
70
|
-
|
|
71
65
|
else # Single worker
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
counts[:max_threads] += stats[:max_threads]
|
|
66
|
+
count_keys.each do |key|
|
|
67
|
+
count_if_present counts, key, stats
|
|
68
|
+
end
|
|
76
69
|
end
|
|
77
70
|
|
|
78
|
-
gauge(:connection_backlog, counts[:backlog])
|
|
79
|
-
gauge(:pool_capacity, counts[:pool_capacity])
|
|
80
|
-
gauge(:threads, counts[:running], :type => :running)
|
|
81
|
-
gauge(:threads, counts[:max_threads], :type => :max)
|
|
71
|
+
gauge(:connection_backlog, counts[:backlog]) if counts[:backlog]
|
|
72
|
+
gauge(:pool_capacity, counts[:pool_capacity]) if counts[:pool_capacity]
|
|
73
|
+
gauge(:threads, counts[:running], :type => :running) if counts[:running]
|
|
74
|
+
gauge(:threads, counts[:max_threads], :type => :max) if counts[:max_threads]
|
|
82
75
|
end
|
|
83
76
|
|
|
84
77
|
private
|
|
@@ -88,6 +81,18 @@ module Appsignal
|
|
|
88
81
|
def gauge(field, count, tags = {})
|
|
89
82
|
Appsignal.set_gauge("puma_#{field}", count, tags.merge(:hostname => hostname))
|
|
90
83
|
end
|
|
84
|
+
|
|
85
|
+
def count_if_present(counts, key, stats)
|
|
86
|
+
stat_value = stats[key]
|
|
87
|
+
return unless stat_value
|
|
88
|
+
counts[key] ||= 0
|
|
89
|
+
counts[key] += stat_value
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def fetch_puma_stats
|
|
93
|
+
::Puma.stats
|
|
94
|
+
rescue NoMethodError # rubocop:disable Lint/HandleExceptions
|
|
95
|
+
end
|
|
91
96
|
end
|
|
92
97
|
end
|
|
93
98
|
end
|
data/lib/appsignal/version.rb
CHANGED
|
@@ -158,6 +158,8 @@ describe Appsignal::Hooks::PumaProbe do
|
|
|
158
158
|
expect_gauge(:pool_capacity, 10)
|
|
159
159
|
expect_gauge(:threads, 10, :type => :running)
|
|
160
160
|
expect_gauge(:threads, 10, :type => :max)
|
|
161
|
+
|
|
162
|
+
probe.call
|
|
161
163
|
end
|
|
162
164
|
end
|
|
163
165
|
|
|
@@ -181,6 +183,7 @@ describe Appsignal::Hooks::PumaProbe do
|
|
|
181
183
|
expect_gauge(:pool_capacity, 5)
|
|
182
184
|
expect_gauge(:threads, 5, :type => :running)
|
|
183
185
|
expect_gauge(:threads, 5, :type => :max)
|
|
186
|
+
probe.call
|
|
184
187
|
end
|
|
185
188
|
end
|
|
186
189
|
|
|
@@ -193,17 +196,72 @@ describe Appsignal::Hooks::PumaProbe do
|
|
|
193
196
|
end
|
|
194
197
|
after(:context) { Object.send(:remove_const, :Puma) }
|
|
195
198
|
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
context "when it returns nil" do
|
|
200
|
+
it "does not track metrics" do
|
|
201
|
+
expect(probe).to_not receive(:puma_gauge)
|
|
202
|
+
probe.call
|
|
203
|
+
end
|
|
198
204
|
end
|
|
199
|
-
end
|
|
200
205
|
|
|
201
|
-
|
|
206
|
+
# Puma.stats raises a NoMethodError on a nil object on the first call.
|
|
207
|
+
context "when it returns a NoMethodError on the first call" do
|
|
208
|
+
let(:log) { StringIO.new }
|
|
209
|
+
|
|
210
|
+
it "ignores the first call and tracks the second call" do
|
|
211
|
+
use_logger_with log do
|
|
212
|
+
expect(Puma).to receive(:stats)
|
|
213
|
+
.and_raise(NoMethodError.new("undefined method `stats' for nil:NilClass"))
|
|
214
|
+
probe.call
|
|
215
|
+
|
|
216
|
+
expect(Puma).to receive(:stats).and_return({
|
|
217
|
+
"backlog" => 1,
|
|
218
|
+
"running" => 5,
|
|
219
|
+
"pool_capacity" => 4,
|
|
220
|
+
"max_threads" => 6
|
|
221
|
+
}.to_json)
|
|
222
|
+
|
|
223
|
+
expect_gauge(:connection_backlog, 1)
|
|
224
|
+
expect_gauge(:pool_capacity, 4)
|
|
225
|
+
expect_gauge(:threads, 5, :type => :running)
|
|
226
|
+
expect_gauge(:threads, 6, :type => :max)
|
|
227
|
+
probe.call
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
expect(log_contents(log)).to_not contains_log(:error, "Error in minutely probe 'puma'")
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
context "when it does not have a complete stats payload" do
|
|
235
|
+
let(:log) { StringIO.new }
|
|
236
|
+
|
|
237
|
+
it "tracks whatever metrics we do have" do
|
|
238
|
+
use_logger_with log do
|
|
239
|
+
expect(Puma).to receive(:stats).and_return({
|
|
240
|
+
"backlog" => 1,
|
|
241
|
+
"running" => 5
|
|
242
|
+
}.to_json)
|
|
243
|
+
|
|
244
|
+
expect_gauge(:connection_backlog, 1)
|
|
245
|
+
expect_no_gauge(:pool_capacity)
|
|
246
|
+
expect_gauge(:threads, 5, :type => :running)
|
|
247
|
+
expect_no_gauge(:threads, :type => :max)
|
|
248
|
+
probe.call
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
expect(log_contents(log)).to_not contains_log(:error, "Error in minutely probe 'puma'")
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
202
255
|
|
|
203
256
|
def expect_gauge(key, value, tags = {})
|
|
204
257
|
expect(Appsignal).to receive(:set_gauge)
|
|
205
258
|
.with("puma_#{key}", value, expected_default_tags.merge(tags))
|
|
206
259
|
.and_call_original
|
|
207
260
|
end
|
|
261
|
+
|
|
262
|
+
def expect_no_gauge(key, tags = {})
|
|
263
|
+
expect(Appsignal).to_not receive(:set_gauge)
|
|
264
|
+
.with("puma_#{key}", anything, tags)
|
|
265
|
+
end
|
|
208
266
|
end
|
|
209
267
|
end
|
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.1
|
|
4
|
+
version: 2.9.2.alpha.1
|
|
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-03-
|
|
12
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rack
|
|
@@ -389,9 +389,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
389
389
|
version: '1.9'
|
|
390
390
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
391
|
requirements:
|
|
392
|
-
- - "
|
|
392
|
+
- - ">"
|
|
393
393
|
- !ruby/object:Gem::Version
|
|
394
|
-
version:
|
|
394
|
+
version: 1.3.1
|
|
395
395
|
requirements: []
|
|
396
396
|
rubygems_version: 3.0.2
|
|
397
397
|
signing_key:
|