fluent-plugin-calc 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14fc42370c6cdcf0ffd500ca287940035e54151e
4
- data.tar.gz: 28b511128dd7c1b714c7e76fdf19c949314e2af3
3
+ metadata.gz: 509139d04a8c636beb1a9da08e6ee48df90b3a35
4
+ data.tar.gz: 47bb1eb2987b1fe83c9bac58709eaffcd19fc28f
5
5
  SHA512:
6
- metadata.gz: c02f0ae43c7cd297e243c5d6b97f5a5d9cb693d4197591a97d58878e9bbb397c8bf66e4530038fc71a948c9e0cffd2204d9b27c595714246a30f45fed8843a6b
7
- data.tar.gz: 52f8f3511d14422be46c3e5de7ddcb00e30d88910f6a4185c2c594e2713f1075bc26fa8a24306e3f9a7e2c46736f034b98b9534c515deb9aa7bae8223c2fd94e
6
+ metadata.gz: 7d4c04775644c8fe7d383e1b85ed803313d9f7e6ef6df4ba2d1f2b8421f8a79287bac9098d370fb8b8a9e78302ab5ec601b9135e16f09ff6e979064ebc7cc709
7
+ data.tar.gz: 40e571e79841859b9ca6d09b128f58ddc15f148974b59f9b448278647620bf1dd8bc439675bf8faddd9daf6824cedd27b573bf45566cb6b84672666d4313e261
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.1 (2013/09/02)
2
+
3
+ Fixes
4
+
5
+ - Fix the case when not record is found.
6
+
1
7
  ## 0.1.0 (2013/09/02)
2
8
 
3
9
  Changes
@@ -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.0"
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
- value = record[key].to_f if record[key]
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
- value = record[key].to_f if record[key]
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
- value = record[key].to_f if record[key]
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
- value = record[key].to_f if record[key]
95
- matches[:avg][key] = avg(matches[:avg][key], value)
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
@@ -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(Fluent::ConfigError) }
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(Fluent::ConfigError) }
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
- max reqtime_max
104
- min reqtime_min
105
- avg reqtime_avg
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.0
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-02 00:00:00.000000000 Z
11
+ date: 2013-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd