fluent-plugin-stats 0.3.6 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11b934f53568a8eee91bce6436279e8b6503057b
4
- data.tar.gz: fea48bdcd8022fedee054ec732333a38eaa75714
3
+ metadata.gz: 338c33bd6209c4f53fcab5de8cb1dfa6cc2369cd
4
+ data.tar.gz: 4ac24eb91942943e0052c82d6c93608b7022f6a3
5
5
  SHA512:
6
- metadata.gz: 94019310b7906f9638feef6d27614921c390298b4406df88663e95d70419ccd1fd5d2b75fc203989b835606f0d084e29e27fdf27fc8f0a0ccad32f10a705afd4
7
- data.tar.gz: 9408530d2b650a126a19ca125883876da8f490be347073808f574b6b3d69126315325c0f6443439fe2cb3b3937d874b77511107266192d814882aaf61c99e9bd
6
+ metadata.gz: 7f8019b96572c180192c5a5328c78654d2a2fe2f8de0c1c7ebb9608c190cc0f7f62ceea8b7e79397ab75fbaea649b29fe22806374a58f96786117bcbbea16827
7
+ data.tar.gz: 108927961b6cd33f144807db267700c3225a50ec2e775e522c507d82a13a2f04060c488d75aa98e1e4b39f78d62018a6bd970267f5597ef39ca25c507bb964a5
data/.gitignore CHANGED
@@ -11,3 +11,4 @@ tmp/*
11
11
  coverage
12
12
  .yardoc
13
13
  pkg/*
14
+ .ruby-version
@@ -1,6 +1,10 @@
1
1
  rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- - 2.1
2
+ - 2.1.*
3
+ - 2.2.*
4
+ - 2.3.0
5
5
  gemfile:
6
6
  - Gemfile
7
+ - Gemfile.v0.12
8
+ - Gemfile.v0.10
9
+ before_install:
10
+ - gem update bundler
@@ -1,3 +1,9 @@
1
+ ## 0.4.0 (2017/09/15)
2
+
3
+ Enhancements:
4
+
5
+ * Support v0.14
6
+
1
7
  ## 0.3.6 (2014/12/3)
2
8
 
3
9
  Enhancements:
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem 'fluentd', '~> 0.10.0'
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+ gem 'fluentd', '~> 0.12.0'
@@ -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-stats"
6
- s.version = "0.3.6"
6
+ s.version = "0.4.0"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-stats"
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency "rspec-its"
25
25
  s.add_development_dependency "pry"
26
26
  s.add_development_dependency "pry-nav"
27
+ s.add_development_dependency "test-unit"
27
28
  end
@@ -7,6 +7,11 @@ class Fluent::StatsOutput < Fluent::Output
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
  def initialize
11
16
  super
12
17
  require 'pathname'
@@ -221,7 +226,7 @@ class Fluent::StatsOutput < Fluent::Output
221
226
  end
222
227
  report_time(" emit_tag:#{emit_tag} matches:#{matches}") do
223
228
  output = generate_output(matches)
224
- Fluent::Engine.emit(emit_tag, time, output) if output and !output.empty?
229
+ router.emit(emit_tag, time, output) if output and !output.empty?
225
230
  end
226
231
  end
227
232
  end
@@ -92,7 +92,7 @@ describe Fluent::StatsOutput do
92
92
  end
93
93
  before do
94
94
  allow(Fluent::Engine).to receive(:now).and_return(time)
95
- expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, {
95
+ expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, {
96
96
  "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
97
97
  })
98
98
  end
@@ -111,10 +111,10 @@ describe Fluent::StatsOutput do
111
111
  end
112
112
  before do
113
113
  allow(Fluent::Engine).to receive(:now).and_return(time)
114
- expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, {
114
+ expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, {
115
115
  "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
116
116
  })
117
- expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, {
117
+ expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, {
118
118
  "4xx_count"=>0,"5xx_count"=>0,"reqtime_max"=>0,"reqtime_min"=>0,"reqtime_avg"=>0.0
119
119
  })
120
120
  end
@@ -132,7 +132,7 @@ describe Fluent::StatsOutput do
132
132
  end
133
133
  before do
134
134
  allow(Fluent::Engine).to receive(:now).and_return(time)
135
- expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, {
135
+ expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, {
136
136
  "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
137
137
  })
138
138
  end
@@ -160,7 +160,7 @@ describe Fluent::StatsOutput do
160
160
  end
161
161
  before do
162
162
  allow(Fluent::Engine).to receive(:now).and_return(time)
163
- expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, {
163
+ expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, {
164
164
  "reqtime_sum"=>3.000,"reqtime_max"=>2.000,"reqtime_min"=>1.000,"reqtime_avg"=>1.500,"reqsize_sum"=>30
165
165
  })
166
166
  end
@@ -176,7 +176,7 @@ describe Fluent::StatsOutput do
176
176
  end
177
177
  before do
178
178
  allow(Fluent::Engine).to receive(:now).and_return(time)
179
- expect(Fluent::Engine).to receive(:emit).with("foo", time, {
179
+ expect(driver.instance.router).to receive(:emit).with("foo", time, {
180
180
  "4xx_count"=>6,"5xx_count"=>6
181
181
  })
182
182
  end
@@ -193,7 +193,7 @@ describe Fluent::StatsOutput do
193
193
  let(:tag) { 'foo.bar' }
194
194
  before do
195
195
  allow(Fluent::Engine).to receive(:now).and_return(time)
196
- expect(Fluent::Engine).to receive(:emit).with("foo.#{tag}", time, {
196
+ expect(driver.instance.router).to receive(:emit).with("foo.#{tag}", time, {
197
197
  "4xx_count"=>6,"5xx_count"=>6
198
198
  })
199
199
  end
@@ -210,7 +210,7 @@ describe Fluent::StatsOutput do
210
210
  let(:tag) { 'foo.bar' }
211
211
  before do
212
212
  allow(Fluent::Engine).to receive(:now).and_return(time)
213
- expect(Fluent::Engine).to receive(:emit).with("bar", time, {
213
+ expect(driver.instance.router).to receive(:emit).with("bar", time, {
214
214
  "4xx_count"=>6,"5xx_count"=>6
215
215
  })
216
216
  end
@@ -227,7 +227,7 @@ describe Fluent::StatsOutput do
227
227
  let(:tag) { 'foo.bar' }
228
228
  before do
229
229
  allow(Fluent::Engine).to receive(:now).and_return(time)
230
- expect(Fluent::Engine).to receive(:emit).with("#{tag}.foo", time, {
230
+ expect(driver.instance.router).to receive(:emit).with("#{tag}.foo", time, {
231
231
  "4xx_count"=>6,"5xx_count"=>6
232
232
  })
233
233
  end
@@ -244,7 +244,7 @@ describe Fluent::StatsOutput do
244
244
  let(:tag) { 'foo.bar' }
245
245
  before do
246
246
  allow(Fluent::Engine).to receive(:now).and_return(time)
247
- expect(Fluent::Engine).to receive(:emit).with("foo", time, {
247
+ expect(driver.instance.router).to receive(:emit).with("foo", time, {
248
248
  "4xx_count"=>6,"5xx_count"=>6
249
249
  })
250
250
  end
@@ -261,7 +261,7 @@ describe Fluent::StatsOutput do
261
261
  let(:tag) { 'foo.bar' }
262
262
  before do
263
263
  allow(Fluent::Engine).to receive(:now).and_return(time)
264
- expect(Fluent::Engine).to receive(:emit).with("foo", time, {
264
+ expect(driver.instance.router).to receive(:emit).with("foo", time, {
265
265
  "4xx_count"=>6,"5xx_count"=>6
266
266
  })
267
267
  end
@@ -288,7 +288,7 @@ describe Fluent::StatsOutput do
288
288
  end
289
289
  before do
290
290
  allow(Fluent::Engine).to receive(:now).and_return(time)
291
- expect(Fluent::Engine).to receive(:emit).with("foo", time, {
291
+ expect(driver.instance.router).to receive(:emit).with("foo", time, {
292
292
  "4xx_count"=>12,"5xx_count"=>12,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
293
293
  })
294
294
  end
@@ -308,10 +308,10 @@ describe Fluent::StatsOutput do
308
308
  end
309
309
  before do
310
310
  allow(Fluent::Engine).to receive(:now).and_return(time)
311
- expect(Fluent::Engine).to receive(:emit).with("stats.foo.bar", time, {
311
+ expect(driver.instance.router).to receive(:emit).with("stats.foo.bar", time, {
312
312
  "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
313
313
  })
314
- expect(Fluent::Engine).to receive(:emit).with("stats.foo.bar2", time, {
314
+ expect(driver.instance.router).to receive(:emit).with("stats.foo.bar2", time, {
315
315
  "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
316
316
  })
317
317
  end
@@ -332,7 +332,7 @@ describe Fluent::StatsOutput do
332
332
  end
333
333
  before do
334
334
  allow(Fluent::Engine).to receive(:now).and_return(time)
335
- expect(Fluent::Engine).to receive(:emit).with("stats.foo", time, {
335
+ expect(driver.instance.router).to receive(:emit).with("stats.foo", time, {
336
336
  "4xx_count"=>12,"5xx_count"=>12,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0
337
337
  })
338
338
  end
@@ -372,10 +372,9 @@ describe Fluent::StatsOutput do
372
372
  loaded_saved_duration = driver.instance.saved_duration
373
373
 
374
374
  expect(loaded_matches).to eql(stored_matches)
375
- expect(loaded_saved_at).to eql(stored_saved_at)
375
+ expect(loaded_saved_at.to_i).to eql(stored_saved_at.to_i)
376
376
  expect(loaded_saved_duration).to eql(stored_saved_duration)
377
377
  end
378
378
  end
379
379
  end
380
380
  end
381
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
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-12-03 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: test-unit
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Fluentd plugin to calculate statistics such as sum, max, min, avg
98
112
  email:
99
113
  - sonots@gmail.com
@@ -108,6 +122,8 @@ files:
108
122
  - ".travis.yml"
109
123
  - CHANGELOG.md
110
124
  - Gemfile
125
+ - Gemfile.v0.10
126
+ - Gemfile.v0.12
111
127
  - LICENSE
112
128
  - README.md
113
129
  - Rakefile
@@ -135,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
151
  version: '0'
136
152
  requirements: []
137
153
  rubyforge_project: fluent-plugin-stats
138
- rubygems_version: 2.2.2
154
+ rubygems_version: 2.5.1
139
155
  signing_key:
140
156
  specification_version: 4
141
157
  summary: Fluentd plugin to calculate statistics such as sum, max, min, avg