fluent-plugin-numeric-monitor 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ vendor/
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### NumericMonitorOutput
6
6
 
7
- Plugin to calculate min/max/avg and specified percentile values, which used in notifications (such as fluent-plugin-notifier)
7
+ Plugin to calculate min/max/avg and specified percentile values (and 'num' of matched messages), which used in notifications (such as fluent-plugin-notifier)
8
8
 
9
9
  ## Configuration
10
10
 
@@ -24,7 +24,7 @@ To calculate about HTTP requests duration (microseconds) in 'duraion', with 90 a
24
24
 
25
25
  Output messages like:
26
26
 
27
- {"min":3012,"max":913243,"avg":100123.51,"percentile_90":154390,"percentile_95":223110}
27
+ {"min":3012,"max":913243,"avg":100123.51,"percentile_90":154390,"percentile_95":223110,"num":50012}
28
28
 
29
29
  ## TODO
30
30
 
@@ -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 = "0.0.2"
4
+ gem.version = "0.1.0"
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}
@@ -14,5 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.require_paths = ["lib"]
15
15
 
16
16
  gem.add_development_dependency "fluentd"
17
+ gem.add_development_dependency "rake"
17
18
  gem.add_runtime_dependency "fluentd"
18
19
  end
@@ -110,6 +110,7 @@ class Fluent::NumericMonitorOutput < Fluent::Output
110
110
  output = {}
111
111
  if @aggregate == :all
112
112
  c = count['all']
113
+ if c[:num] then output['num'] = c[:num] end
113
114
  if c[:min] then output['min'] = c[:min] end
114
115
  if c[:max] then output['max'] = c[:max] end
115
116
  if c[:num] > 0 then output['avg'] = (c[:sum] * 100.0 / (c[:num] * 1.0)).round / 100 end
@@ -126,6 +127,7 @@ class Fluent::NumericMonitorOutput < Fluent::Output
126
127
  count.keys.each do |tag|
127
128
  t = stripped_tag(tag)
128
129
  c = count[tag]
130
+ if c[:num] then output[t + '_num'] = c[:num] end
129
131
  if c[:min] then output[t + '_min'] = c[:min] end
130
132
  if c[:max] then output[t + '_max'] = c[:max] end
131
133
  if c[:num] > 0 then output[t + '_avg'] = (c[:sum] * 100.0 / (c[:num] * 1.0)).round / 100.0 end
@@ -62,5 +62,6 @@ class NumericMonitorOutputTest < Test::Unit::TestCase
62
62
  assert_equal 4.5, r1['tag1_avg']
63
63
  assert_equal 7, r1['tag1_percentile_80']
64
64
  assert_equal 8, r1['tag1_percentile_90']
65
+ assert_equal 100, r1['tag1_num']
65
66
  end
66
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-numeric-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-28 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: fluentd
32
48
  requirement: !ruby/object:Gem::Requirement