puma-newrelic 0.1.0 → 0.1.1
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/README.md +10 -1
- data/RELEASE_NOTES.md +5 -0
- data/lib/puma/new_relic/sampler.rb +11 -7
- data/lib/puma/new_relic/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03def45aa3c9dcd80d0084498954127447772e76848ed7069ce5f5bb034caa10
|
4
|
+
data.tar.gz: f8752c312a107918d970db818baad203a47882112812c8d4d1dd290e36880ea8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0069e3777a22a0c48271db618043153532997624688dd737496656d152866afb25591cdd7909a046b25e4f68a8a3601d18c6b43d41349f5ea753ec1b255bf139'
|
7
|
+
data.tar.gz: f70bf7889c60c3edfe4e9a1ce0ad4cabd8f073a0438b8d3cd66c58bcc097b9116f93329ee8face0854d4bfc663ccc7fba0ab2150363a0caf84c9ce5ef55d1a6c
|
data/README.md
CHANGED
@@ -24,9 +24,18 @@ Or install it yourself as:
|
|
24
24
|
## Usage
|
25
25
|
|
26
26
|
* Install the gem
|
27
|
-
* Add `plugin '
|
27
|
+
* Add `plugin 'new_relic_stats'` to your puma.rb
|
28
28
|
* Create a dashboard on the NewRelic insights or NewRelic One
|
29
29
|
|
30
|
+
NQRL example:
|
31
|
+
```
|
32
|
+
SELECT rate(average(newrelic.timeslice.value), 1 minute)
|
33
|
+
FROM Metric
|
34
|
+
WHERE appName ='My App Name'
|
35
|
+
WITH METRIC_FORMAT 'Custom/Puma/pool_capacity'
|
36
|
+
TIMESERIES FACET `host` LIMIT 10 SINCE 1800 seconds ago
|
37
|
+
```
|
38
|
+
|
30
39
|
## Development
|
31
40
|
|
32
41
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/RELEASE_NOTES.md
ADDED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Puma
|
2
2
|
module NewRelic
|
3
3
|
class Sampler
|
4
|
-
KEYS = %
|
4
|
+
KEYS = %i(backlog running pool_capacity max_threads)
|
5
5
|
|
6
6
|
def initialize(launcher, sample_rate)
|
7
7
|
@launcher = launcher
|
@@ -16,8 +16,12 @@ module Puma
|
|
16
16
|
begin
|
17
17
|
if should_sample?
|
18
18
|
@last_sample_at = Time.now
|
19
|
-
|
20
|
-
|
19
|
+
puma_stats = @launcher.stats
|
20
|
+
if puma_stats.is_a?(Hash)
|
21
|
+
parse puma_stats
|
22
|
+
else
|
23
|
+
parse JSON.parse(puma_stats, symbolize_names: true)
|
24
|
+
end
|
21
25
|
end
|
22
26
|
rescue Exception => e
|
23
27
|
::NewRelic::Agent.logger.error(e.message)
|
@@ -37,10 +41,10 @@ module Puma
|
|
37
41
|
metrics = Hash.new { |h, k| h[k] = 0 }
|
38
42
|
sum = ->(key, value) { metrics[key] += value if KEYS.include?(key) }
|
39
43
|
|
40
|
-
if stats[
|
41
|
-
metrics[
|
42
|
-
stats[
|
43
|
-
worker[
|
44
|
+
if stats[:workers]
|
45
|
+
metrics[:workers] = stats[:workers]
|
46
|
+
stats[:worker_status].each do |worker|
|
47
|
+
worker[:last_status].each(&sum)
|
44
48
|
end
|
45
49
|
else
|
46
50
|
stats.each(&sum)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma-newrelic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoist Claassen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- CODE_OF_CONDUCT.md
|
38
38
|
- Gemfile
|
39
39
|
- README.md
|
40
|
+
- RELEASE_NOTES.md
|
40
41
|
- Rakefile
|
41
42
|
- bin/console
|
42
43
|
- bin/setup
|
@@ -47,7 +48,7 @@ files:
|
|
47
48
|
homepage: https://github.com/benoist/puma-newrelic
|
48
49
|
licenses: []
|
49
50
|
metadata: {}
|
50
|
-
post_install_message:
|
51
|
+
post_install_message:
|
51
52
|
rdoc_options: []
|
52
53
|
require_paths:
|
53
54
|
- lib
|
@@ -63,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
64
|
version: '0'
|
64
65
|
requirements: []
|
65
66
|
rubygems_version: 3.0.3
|
66
|
-
signing_key:
|
67
|
+
signing_key:
|
67
68
|
specification_version: 4
|
68
69
|
summary: New Relic Puma Stats sampler
|
69
70
|
test_files: []
|