fluent-plugin-calc 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/CHANGELOG.md +6 -0
- data/fluent-plugin-calc.gemspec +1 -1
- data/lib/fluent/plugin/out_calc.rb +5 -6
- data/spec/out_calc_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 509139d04a8c636beb1a9da08e6ee48df90b3a35
|
4
|
+
data.tar.gz: 47bb1eb2987b1fe83c9bac58709eaffcd19fc28f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d4c04775644c8fe7d383e1b85ed803313d9f7e6ef6df4ba2d1f2b8421f8a79287bac9098d370fb8b8a9e78302ab5ec601b9135e16f09ff6e979064ebc7cc709
|
7
|
+
data.tar.gz: 40e571e79841859b9ca6d09b128f58ddc15f148974b59f9b448278647620bf1dd8bc439675bf8faddd9daf6824cedd27b573bf45566cb6b84672666d4313e261
|
data/CHANGELOG.md
CHANGED
data/fluent-plugin-calc.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-calc"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.1"
|
7
7
|
s.authors = ["Naotoshi SEO"]
|
8
8
|
s.email = ["sonots@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/sonots/fluent-plugin-calc"
|
@@ -74,25 +74,24 @@ class Fluent::CalcOutput < Fluent::Output
|
|
74
74
|
# Called when new line comes. This method actually does not emit
|
75
75
|
def emit(tag, es, chain)
|
76
76
|
tag = 'all' if @aggregate == 'all'
|
77
|
-
|
78
77
|
# calc
|
79
78
|
count = 0; matches = { :sum => {}, :max => {}, :min => {}, :avg => {} }
|
80
79
|
es.each do |time, record|
|
81
80
|
@sum_keys.each do |key|
|
82
|
-
|
81
|
+
next unless record[key] and value = record[key].to_f
|
83
82
|
matches[:sum][key] = sum(matches[:sum][key], value)
|
84
83
|
end
|
85
84
|
@max_keys.each do |key|
|
86
|
-
|
85
|
+
next unless record[key] and value = record[key].to_f
|
87
86
|
matches[:max][key] = max(matches[:max][key], value)
|
88
87
|
end
|
89
88
|
@min_keys.each do |key|
|
90
|
-
|
89
|
+
next unless record[key] and value = record[key].to_f
|
91
90
|
matches[:min][key] = min(matches[:min][key], value)
|
92
91
|
end
|
93
92
|
@avg_keys.each do |key|
|
94
|
-
|
95
|
-
matches[:avg][key] =
|
93
|
+
next unless record[key] and value = record[key].to_f
|
94
|
+
matches[:avg][key] = sum(matches[:avg][key], value)
|
96
95
|
end
|
97
96
|
record.keys.each do |key|
|
98
97
|
value = record[key].to_f
|
data/spec/out_calc_spec.rb
CHANGED
@@ -38,7 +38,7 @@ describe Fluent::CalcOutput do
|
|
38
38
|
describe 'good configuration' do
|
39
39
|
context "nothing" do
|
40
40
|
let(:config) { '' }
|
41
|
-
it { expect { driver }.to_not raise_error
|
41
|
+
it { expect { driver }.to_not raise_error }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'sum/max/min/avg' do
|
@@ -50,7 +50,7 @@ describe Fluent::CalcOutput do
|
|
50
50
|
avg _avg$
|
51
51
|
]
|
52
52
|
end
|
53
|
-
it { expect { driver }.to_not raise_error
|
53
|
+
it { expect { driver }.to_not raise_error }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "check default" do
|
@@ -100,9 +100,9 @@ describe Fluent::CalcOutput do
|
|
100
100
|
let(:config) do
|
101
101
|
CONFIG + %[
|
102
102
|
sum_keys 4xx_count,5xx_count
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
max_keys reqtime_max
|
104
|
+
min_keys reqtime_min
|
105
|
+
avg_keys reqtime_avg,not_found
|
106
106
|
]
|
107
107
|
end
|
108
108
|
before do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-calc
|
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
|
- Naotoshi SEO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|