fluent-plugin-latency 0.0.2 → 0.0.3

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: 4b502cce2c35cb814da44e7b2b61d01b98569aa3
4
- data.tar.gz: 0a1352d4b15e9d6aa3dab617b2083f776ad78007
3
+ metadata.gz: 2698d36098fb68c504f5ca49f6bf2937e26dd618
4
+ data.tar.gz: 5cba743fd33eeec4fa9657443babfb64b6606d0b
5
5
  SHA512:
6
- metadata.gz: b29b35635c570151643f6a06c5fb046544878d75d6ce1d59f52da98580a7420d889c7d852955546a892e8ace28a851b282b854033abc0d7bbc1c563c076c0e58
7
- data.tar.gz: 915c01177c7db1e2001ebb8043cef76524070fa9ee060360f35cfe23a9446bc52e29828fc043bf4f4b2b24f72a95b191a7bea616f8e5818977a1d72ed433a1e1
6
+ metadata.gz: 02d84f8dfbe1ff6ddf2df786efd8364e6128c11a94f4486529780e2bd066d4201cda310339668e5516b7ed4390e924b7aa99e2300902c21b8c330c78ceb04ee3
7
+ data.tar.gz: b6f987c88c32deca9333fe8ffd8501fd886a7420411a5f07581a352bc625d6c55cd301cc5a71b45b3f2c8f567b745a23ccdea9156fe99178c32f2f075ddc5b4e
@@ -1,6 +1,10 @@
1
1
  rvm:
2
- - 1.9.2
3
- - 1.9.3
4
- - 2.0.0
2
+ - 2.1.*
3
+ - 2.2.*
4
+ - 2.3.0
5
5
  gemfile:
6
6
  - Gemfile
7
+ - Gemfile.v0.10
8
+ - Gemfile.v0.12
9
+ before_install:
10
+ - gem update bundler
@@ -1,6 +1,16 @@
1
+ ## 0.0.3 (2017/09/15)
2
+
3
+ Enhancements:
4
+
5
+ * Support Fluentd v0.14
6
+
7
+ Changes:
8
+
9
+ * Revert to MultiOutput
10
+
1
11
  ## 0.0.2 (2014/11/26)
2
12
 
3
- Change:
13
+ Changes:
4
14
 
5
15
  * Do not inherit MultiOutput, but Output
6
16
 
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
- gem 'fluent-plugin-flowcounter' # for examples
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem 'fluent-plugin-flowcounter' # for examples
5
+ gem 'fluentd', '~> 0.10.0'
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem 'fluentd', '~> 0.12.0'
data/Rakefile CHANGED
@@ -1,12 +1,13 @@
1
1
  # encoding: utf-8
2
2
  require "bundler/gem_tasks"
3
3
 
4
- require 'rspec/core'
5
- require 'rspec/core/rake_task'
6
- RSpec::Core::RakeTask.new(:spec) do |spec|
7
- spec.pattern = FileList['spec/**/*_spec.rb']
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/test_*.rb'
8
+ test.verbose = true
8
9
  end
9
- task :default => :spec
10
+ task :default => :test
10
11
 
11
12
  desc 'Open an irb session preloaded with the gem library'
12
13
  task :console do
@@ -0,0 +1,22 @@
1
+ <source>
2
+ type dummy
3
+ tag raw
4
+ </source>
5
+
6
+ # Latency plugin output comes here
7
+ <match latency>
8
+ type stdout
9
+ </match>
10
+
11
+ # All messages come here once.
12
+ <match **>
13
+ type copy
14
+ <store>
15
+ type latency
16
+ tag latency
17
+ interval 1
18
+ </store>
19
+ <store>
20
+ type stdout
21
+ </store>
22
+ </match>
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-latency"
6
- gem.version = "0.0.2"
6
+ gem.version = "0.0.3"
7
7
  gem.authors = ["Naotoshi Seo"]
8
8
  gem.email = "sonots@gmail.com"
9
9
  gem.homepage = "https://github.com/sonots/fluent-plugin-latency"
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency "fluentd"
21
21
  gem.add_development_dependency "rake"
22
- gem.add_development_dependency "rspec"
23
22
  gem.add_development_dependency "pry"
24
23
  gem.add_development_dependency "pry-nav"
25
24
  gem.add_development_dependency "timecop"
25
+ gem.add_development_dependency "test-unit"
26
26
  end
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
- class LatencyOutput < Output
2
+ class LatencyOutput < MultiOutput
3
3
  Plugin.register_output('latency', self)
4
4
 
5
5
  # To support log_level option implemented by Fluentd v0.10.43
@@ -7,6 +7,11 @@ module Fluent
7
7
  define_method("log") { $log }
8
8
  end
9
9
 
10
+ # Define `router` method of v0.12 to support v0.10 or earlier
11
+ unless method_defined?(:router)
12
+ define_method("router") { Fluent::Engine }
13
+ end
14
+
10
15
  config_param :tag, :string, :default => 'latency'
11
16
  config_param :interval, :time, :default => 60
12
17
 
@@ -57,7 +62,7 @@ module Fluent
57
62
  max = num == 0 ? 0 : latency.max
58
63
  avg = num == 0 ? 0 : latency.map(&:to_f).inject(:+) / num.to_f
59
64
  message = {"max" => max, "avg" => avg, "num" => num}
60
- Engine.emit(@tag, Engine.now, message)
65
+ router.emit(@tag, Engine.now, message)
61
66
  end
62
67
  end
63
68
  end
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
14
+ require 'fluent/test'
15
+ require 'fluent/plugin/in_gc'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-latency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-26 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
56
+ name: pry-nav
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry-nav
70
+ name: timecop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: timecop
84
+ name: test-unit
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -105,13 +105,15 @@ files:
105
105
  - ".travis.yml"
106
106
  - CHANGELOG.md
107
107
  - Gemfile
108
+ - Gemfile.v0.10
109
+ - Gemfile.v0.12
108
110
  - LICENSE
109
111
  - README.md
110
112
  - Rakefile
113
+ - example.conf
111
114
  - fluent-plugin-latency.gemspec
112
115
  - lib/fluent/plugin/out_latency.rb
113
- - spec/out_latency_spec.rb
114
- - spec/spec_helper.rb
116
+ - test/helper.rb
115
117
  homepage: https://github.com/sonots/fluent-plugin-latency
116
118
  licenses:
117
119
  - MIT
@@ -132,10 +134,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  version: '0'
133
135
  requirements: []
134
136
  rubyforge_project:
135
- rubygems_version: 2.2.2
137
+ rubygems_version: 2.5.2
136
138
  signing_key:
137
139
  specification_version: 4
138
140
  summary: Fluentd plugin to measure latency until receiving the messages
139
141
  test_files:
140
- - spec/out_latency_spec.rb
141
- - spec/spec_helper.rb
142
+ - test/helper.rb
@@ -1,41 +0,0 @@
1
- # encoding: UTF-8
2
- require_relative 'spec_helper'
3
-
4
- describe Fluent::LatencyOutput do
5
- before { Fluent::Test.setup }
6
- let(:config) { %[] }
7
- let(:tag) { 'tag' }
8
- let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::LatencyOutput, tag).configure(config) }
9
-
10
- describe 'test configure' do
11
- subject { driver.instance }
12
-
13
- context "check default" do
14
- let(:config) { %[] }
15
- its(:tag) { should == 'latency' }
16
- its(:interval) { should == 60 }
17
- end
18
-
19
- context "check config" do
20
- let(:config) { %[tag tag\ninterval 120]}
21
- its(:tag) { should == 'tag' }
22
- its(:interval) { should == 120 }
23
- end
24
- end
25
-
26
- describe 'test emit' do
27
- let(:emit_time) { Time.utc(1,1,1,1,1,2010,nil,nil,nil,nil).to_i }
28
- let(:current_time) { Time.utc(2,1,1,1,1,2010,nil,nil,nil,nil).to_i }
29
- let(:message) { "INFO GET /ping" }
30
- let(:expected) { {"max" => 1.0, "avg" => 1.0, "num" => 1} }
31
- before {
32
- Timecop.freeze(Time.at(current_time))
33
- Fluent::Engine.should_receive(:emit).with("latency", current_time, expected)
34
- }
35
- after { Timecop.return }
36
- it {
37
- driver.run { driver.emit({'message' => message}, emit_time) }
38
- driver.instance.flush_emit
39
- }
40
- end
41
- end
@@ -1,14 +0,0 @@
1
- # encoding: UTF-8
2
- require 'rubygems'
3
- require 'bundler'
4
- Bundler.setup(:default, :test)
5
- Bundler.require(:default, :test)
6
-
7
- require 'fluent/test'
8
- require 'rspec'
9
- require 'pry'
10
- require 'timecop'
11
-
12
- $TESTING=true
13
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
14
- require 'fluent/plugin/out_latency'