fluent-plugin-flowcounter 0.3.1 → 0.3.2
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/.travis.yml +3 -1
- data/README.md +1 -1
- data/fluent-plugin-flowcounter.gemspec +3 -2
- data/lib/fluent/plugin/out_flowcounter.rb +3 -1
- data/test/plugin/test_out_flowcounter.rb +27 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 373e8131d63b116d0e7bb4364fd93a19356bb141
|
4
|
+
data.tar.gz: 2000acaab8a219b70da435c4f77469155cbdd300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 715cd4f1dfeb133f64f334608df853f8efc2cf0debd31a87f63642dd0b82cf4c774126935e821a345bce8f348e8aea71a56409646b93c35f6cf51edb72df4a8a
|
7
|
+
data.tar.gz: 96e775ec5a88dc718a21676fe630236b50b7eba183a3bfeac47a0e66883292dd3b29b9ca16a261673eaf14340db56fd5ec48aa1f36341e1f3851568b8d0c5339
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "fluent-plugin-flowcounter"
|
4
|
-
gem.version = "0.3.
|
4
|
+
gem.version = "0.3.2"
|
5
5
|
gem.authors = ["TAGOMORI Satoshi"]
|
6
6
|
gem.email = ["tagomoris@gmail.com"]
|
7
7
|
gem.summary = %q{Fluent plugin to count message flow}
|
8
8
|
gem.description = %q{Plugin to counts messages/bytes that matches, per minutes/hours/days}
|
9
9
|
gem.homepage = "https://github.com/tagomoris/fluent-plugin-flowcounter"
|
10
|
-
gem.license = "
|
10
|
+
gem.license = "Apache-2.0"
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split($\)
|
13
13
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
|
17
17
|
gem.add_development_dependency "rake"
|
18
|
+
gem.add_development_dependency "test-unit"
|
18
19
|
gem.add_runtime_dependency "fluentd"
|
19
20
|
gem.add_runtime_dependency "fluent-mixin-config-placeholders", ">= 0.3.0"
|
20
21
|
end
|
@@ -163,6 +163,8 @@ class Fluent::FlowCounterOutput < Fluent::Output
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
FOR_MISSING = ''
|
167
|
+
|
166
168
|
def emit(tag, es, chain)
|
167
169
|
name = tag
|
168
170
|
if @input_tag_remove_prefix and
|
@@ -178,7 +180,7 @@ class Fluent::FlowCounterOutput < Fluent::Output
|
|
178
180
|
else
|
179
181
|
es.each {|time,record|
|
180
182
|
c += 1
|
181
|
-
b += @count_keys.inject(0){|s,k| s + record[k].bytesize}
|
183
|
+
b += @count_keys.inject(0){|s,k| s + (record[k] || FOR_MISSING).bytesize}
|
182
184
|
}
|
183
185
|
end
|
184
186
|
countup(name, c, b)
|
@@ -303,4 +303,31 @@ count_keys message
|
|
303
303
|
assert_equal 1.0, r1[0]['count_rate']
|
304
304
|
assert_equal 15.0, r1[0]['bytes_rate']
|
305
305
|
end
|
306
|
+
|
307
|
+
def test_emit_records_without_specified_field
|
308
|
+
d3 = create_driver( %[
|
309
|
+
unit minute
|
310
|
+
aggregate all
|
311
|
+
tag flowcount
|
312
|
+
input_tag_remove_prefix test
|
313
|
+
count_keys f4
|
314
|
+
], 'test.tag4')
|
315
|
+
time = Time.now.to_i
|
316
|
+
d3.run do
|
317
|
+
60.times do
|
318
|
+
d3.emit({'f1' => 'abcde', 'f2' => 'vwxyz', 'f3' => '0123456789'})
|
319
|
+
d3.emit({'f1' => 'abcde', 'f2' => 'vwxyz', 'f3' => '0123456789'})
|
320
|
+
d3.emit({'f1' => 'abcde', 'f2' => 'vwxyz', 'f3' => '0123456789'})
|
321
|
+
d3.emit({'f1' => 'abcde', 'f2' => 'vwxyz', 'f3' => '0123456789'})
|
322
|
+
d3.emit({'f1' => 'abcde', 'f2' => 'vwxyz', 'f3' => '0123456789'})
|
323
|
+
end
|
324
|
+
end
|
325
|
+
d3.instance.flush_emit(60)
|
326
|
+
emits = d3.emits
|
327
|
+
assert_equal 1, emits.length
|
328
|
+
data = emits[0]
|
329
|
+
assert_equal 'flowcount', data[0]
|
330
|
+
assert_equal 60*5, data[2]['count']
|
331
|
+
assert_equal 0, data[2]['bytes']
|
332
|
+
end
|
306
333
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-flowcounter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: test-unit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: fluentd
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +87,7 @@ files:
|
|
73
87
|
- test/plugin/test_out_flowcounter.rb
|
74
88
|
homepage: https://github.com/tagomoris/fluent-plugin-flowcounter
|
75
89
|
licenses:
|
76
|
-
-
|
90
|
+
- Apache-2.0
|
77
91
|
metadata: {}
|
78
92
|
post_install_message:
|
79
93
|
rdoc_options: []
|