fluent-plugin-numeric-monitor 1.0.3 → 1.0.4

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
- SHA1:
3
- metadata.gz: c9831a3f87af2ed7d4b78f5cf93bfd429f3866c3
4
- data.tar.gz: 5c637ba413c9fb8264eac755962f0cc6761c0b2e
2
+ SHA256:
3
+ metadata.gz: 54803060ecc2a6fcc3217daba6cf4ac224d608d68764d873b7dfc3be036f147f
4
+ data.tar.gz: 280b8354d829caeb582c6903e98f2ac3844f8dbf6ceeef4a280ddb924d5cecda
5
5
  SHA512:
6
- metadata.gz: 24735621dfc86fe3a6a4beeef498f65718e24b970bad4e2f0f37f25e8ba8163de1f5398b57c66861c61f5686c0c0eea881c00865b78a2590809b63bfdf346eb2
7
- data.tar.gz: 8e9ed9e70c95ed96db6623ad564b997c713cb6e9603f433084bc51866cda4924aec7275869fd62b110d36caf246b1d85d834b6cba0e7a78bef1d9da0969567fc
6
+ metadata.gz: 2277984aec060fa38d43f1f65634e5248ca40c5843de63868badf1928c1c1329638cb23a18ebd83dfe501df45005588163f707ef8bc5c9531b93cf059dea8e41
7
+ data.tar.gz: f4c278865a4ebf22d5da37b42b9552415a0cf637bff49db1ce61e167053521557faef8426871dca1b643c290c94ffb27bdc7a6a40de81bce29194b21fb646597
data/README.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  [Fluentd](http://fluentd.org) plugin to calculate min/max/avg/sum and specified percentile values (and 'num' of matched messages), which used in notifications (such as fluent-plugin-notifier)
4
4
 
5
+ ## Requirements
6
+
7
+ | fluent-plugin-numeric-monitor | fluentd | ruby |
8
+ |-------------------------------|------------|--------|
9
+ | >= 1.0.0 | >= v0.14.0 | >= 2.1 |
10
+ | < 1.0.0 | < v0.14.0 | >= 1.9 |
11
+
5
12
  ## Configuration
6
13
 
7
14
  ### NumericMonitorOutput
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-numeric-monitor"
4
- gem.version = "1.0.3"
4
+ gem.version = "1.0.4"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.description = %q{Fluentd plugin to calculate min/max/avg/Xpercentile values, and emit these data as message}
@@ -192,10 +192,10 @@ class Fluent::Plugin::NumericMonitorOutput < Fluent::Plugin::Output
192
192
  @mutex.synchronize do
193
193
  c = (@count[tag] ||= {min: nil, max: nil, sum: nil, num: 0})
194
194
 
195
- if c[:min].nil? or c[:min] > min
195
+ if c[:min].nil? or (min and c[:min] > min)
196
196
  c[:min] = min
197
197
  end
198
- if c[:max].nil? or c[:max] < max
198
+ if c[:max].nil? or (max and c[:max] < max)
199
199
  c[:max] = max
200
200
  end
201
201
  c[:sum] = (c[:sum] || 0) + sum
@@ -404,4 +404,28 @@ class NumericMonitorOutputTest < Test::Unit::TestCase
404
404
  assert_equal 12, r['key_prefix_sum']
405
405
  assert_equal 6, r['key_prefix_num']
406
406
  end
407
+
408
+ def test_emit_with_nil_values
409
+ d = create_driver(CONFIG)
410
+ d.run(default_tag: 'test.tag1') do
411
+ d.feed({'field1' => 1})
412
+ d.feed({'field1' => nil})
413
+ d.feed({'field1' => 2})
414
+ d.feed({'field1' => 3})
415
+ d.feed({'field1' => 4})
416
+ d.feed({'field1' => 5})
417
+ d.feed({'field1' => 6})
418
+ d.feed({'field1' => 7})
419
+ d.feed({'field1' => 8})
420
+ d.feed({'field1' => 9})
421
+ end
422
+ r1 = d.instance.flush
423
+ assert_equal 1, r1['tag1_min']
424
+ assert_equal 9, r1['tag1_max']
425
+ assert_equal 5, r1['tag1_avg']
426
+ assert_equal 45, r1['tag1_sum']
427
+ assert_equal 7, r1['tag1_percentile_80']
428
+ assert_equal 8, r1['tag1_percentile_90']
429
+ assert_equal 9, r1['tag1_num']
430
+ end
407
431
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-numeric-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-01 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -76,7 +76,7 @@ homepage: https://github.com/tagomoris/fluent-plugin-numeric-monitor
76
76
  licenses:
77
77
  - Apache-2.0
78
78
  metadata: {}
79
- post_install_message:
79
+ post_install_message:
80
80
  rdoc_options: []
81
81
  require_paths:
82
82
  - lib
@@ -91,9 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.6.8
96
- signing_key:
94
+ rubygems_version: 3.5.3
95
+ signing_key:
97
96
  specification_version: 4
98
97
  summary: Fluentd plugin to calculate min/max/avg/Xpercentile values
99
98
  test_files: