puma-newrelic 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +5 -3
- data/config.ru +4 -0
- data/lib/puma/new_relic/sampler.rb +4 -5
- data/lib/puma/new_relic/version.rb +1 -1
- data/puma-newrelic.gemspec +1 -0
- data/puma.rb +3 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b99194e339cf6b42d2caaebbff6c75e08bb7b91fec7c3853cf2072fcaf11339b
|
4
|
+
data.tar.gz: eee5af064f8583e65808b6f07cbb789b5329a904a1910dad6d25e7db4f86db61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fde05215131664dfe852260cb06c85e96e9c8e2b5a27f3b41e9795945ddb49093b75fa5fceff0db7fb11ffe200f0c61f6970797fd0b7fa2185ac5ed24b2c3e9b
|
7
|
+
data.tar.gz: 503f2204ee3545409e39226f2063d4a896c2d19efbe453dd820066a28536eceaf9a374f586d49c7de5f22e1f0ef0a526ebf1d8e81197d1f2aee20ca21a7e7ab7
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.1
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puma-newrelic (0.1.
|
4
|
+
puma-newrelic (0.1.5)
|
5
|
+
newrelic_rpm
|
5
6
|
puma (>= 3.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
diff-lcs (1.4.4)
|
11
|
-
|
12
|
-
|
12
|
+
newrelic_rpm (8.6.0)
|
13
|
+
nio4r (2.5.8)
|
14
|
+
puma (5.6.4)
|
13
15
|
nio4r (~> 2.0)
|
14
16
|
rake (12.3.3)
|
15
17
|
rspec (3.10.0)
|
data/config.ru
ADDED
@@ -2,10 +2,10 @@ module Puma
|
|
2
2
|
module NewRelic
|
3
3
|
class Sampler
|
4
4
|
def initialize(launcher)
|
5
|
-
config = ::NewRelic::Agent.config[:puma]
|
5
|
+
config = ::NewRelic::Agent.config[:puma] || {}
|
6
6
|
@launcher = launcher
|
7
7
|
@sample_rate = config.fetch("sample_rate", 15)
|
8
|
-
@keys = config.fetch("keys", %w(backlog running pool_capacity max_threads)).map(&:
|
8
|
+
@keys = config.fetch("keys", %w(backlog running pool_capacity max_threads)).map(&:to_s)
|
9
9
|
@last_sample_at = Time.now
|
10
10
|
end
|
11
11
|
|
@@ -39,15 +39,14 @@ module Puma
|
|
39
39
|
|
40
40
|
def parse(stats)
|
41
41
|
metrics = Hash.new { |h, k| h[k] = 0 }
|
42
|
-
sum = ->(key, value) { metrics[key] += value if @keys.include?(key) }
|
43
42
|
|
44
43
|
if stats[:workers]
|
45
44
|
metrics[:workers] = stats[:workers]
|
46
45
|
stats[:worker_status].each do |worker|
|
47
|
-
worker[:last_status].each(
|
46
|
+
worker[:last_status].each { |key, value| metrics[key.to_s] += value if @keys.include?(key.to_s) }
|
48
47
|
end
|
49
48
|
else
|
50
|
-
stats.each(
|
49
|
+
stats.each { |key, value| metrics[key.to_s] += value if @keys.include?(key.to_s) }
|
51
50
|
end
|
52
51
|
report_metrics(metrics)
|
53
52
|
end
|
data/puma-newrelic.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.homepage = "https://github.com/benoist/puma-newrelic"
|
12
12
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
13
|
spec.add_runtime_dependency 'puma', '>= 3.0'
|
14
|
+
spec.add_runtime_dependency 'newrelic_rpm'
|
14
15
|
|
15
16
|
# Specify which files should be added to the gem when it is released.
|
16
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/puma.rb
ADDED
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoist Claassen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: newrelic_rpm
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: Samples the puma stats and creates a custom metric for NewRelic
|
28
42
|
email:
|
29
43
|
- benoist.claassen@gmail.com
|
@@ -33,6 +47,7 @@ extra_rdoc_files: []
|
|
33
47
|
files:
|
34
48
|
- ".gitignore"
|
35
49
|
- ".rspec"
|
50
|
+
- ".ruby-version"
|
36
51
|
- ".travis.yml"
|
37
52
|
- CODE_OF_CONDUCT.md
|
38
53
|
- Gemfile
|
@@ -42,10 +57,12 @@ files:
|
|
42
57
|
- Rakefile
|
43
58
|
- bin/console
|
44
59
|
- bin/setup
|
60
|
+
- config.ru
|
45
61
|
- lib/puma/new_relic/sampler.rb
|
46
62
|
- lib/puma/new_relic/version.rb
|
47
63
|
- lib/puma/plugin/new_relic_stats.rb
|
48
64
|
- puma-newrelic.gemspec
|
65
|
+
- puma.rb
|
49
66
|
homepage: https://github.com/benoist/puma-newrelic
|
50
67
|
licenses: []
|
51
68
|
metadata: {}
|
@@ -64,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
81
|
- !ruby/object:Gem::Version
|
65
82
|
version: '0'
|
66
83
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
84
|
+
rubygems_version: 3.3.7
|
68
85
|
signing_key:
|
69
86
|
specification_version: 4
|
70
87
|
summary: New Relic Puma Stats sampler
|