adp-fluent-plugin-graphite 0.0.9 → 0.0.13

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
  SHA256:
3
- metadata.gz: baa50ec531a9210bc6db8fb503f22735efdd04b2d771a552a646342d5752c974
4
- data.tar.gz: 1f31d7142c2d56f976f151bffb29dbd04dca62dcc2ebd43a49893189bbbe3190
3
+ metadata.gz: 2132e7a1254a424751d140529b61db59d0fb83b1a3f7832e3c1298274fca6d48
4
+ data.tar.gz: 22a3e8ca7de5f2b9c1b8e0ed765256b96955d3e6a9f28abb02a6e4fcf7223727
5
5
  SHA512:
6
- metadata.gz: 217a1405017590697c07b1c0988f4577d46ec4b3d460c54aea1e78b8832778b106f16740bad61b356c21fcf808bfa771e1d5f2037123ca8579e6b7c51b91c547
7
- data.tar.gz: 353e10ed2768774ec4b227bf28db70eb56e4c629bd311a3326f43d8875756ed0d5f430a58284007fab3eca94cb301575140cbef9be71b5f365147b734c8b67dc
6
+ metadata.gz: f87b59623230b6d2ac2b7d50cb3f2ef812fd8c0482697d3aa9484bfd673f1ee1e9d36d07415c64c4aa1f082b3559b85fe06866977c7c5cd757fd552e7174abe7
7
+ data.tar.gz: 5e39bee75a4c1d486be3fab422f92a0c71f7758c6ffd9ff4fde0b6a203c387a32bdbc5020681f89fb019c3f6cd5946122ba5573ba98c9cabcf41602198614518
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'adp-fluent-plugin-graphite'
6
- gem.version = '0.0.9'
6
+ gem.version = '0.0.13'
7
7
  gem.authors = ['Satoshi SUZUKI']
8
8
  gem.email = 'studio3104.com@gmail.com'
9
9
  gem.homepage = 'https://github.com/studio3104/fluent-plugin-graphite'
@@ -7,7 +7,7 @@ module Fluent::Plugin
7
7
  config_param :host, :string
8
8
  config_param :port, :integer, default: 2003
9
9
  config_param :tag_for, :string, default: 'prefix'
10
- config_param :name_keys, :string, default: nil
10
+ config_param :monitoring_key, :string
11
11
  config_param :name_key_pattern, :string, default: nil
12
12
  config_param :max_retries, :integer, default: 3
13
13
 
@@ -29,48 +29,28 @@ module Fluent::Plugin
29
29
  end
30
30
  end
31
31
 
32
- def emit(tag, es, chain)
32
+ def process(tag, es)
33
33
  es.each do |time, record|
34
34
  emit_tag = tag.dup
35
35
  log.info("Emit graphite plugin: #{record}")
36
- next unless metrics = format_metrics(emit_tag, record)
36
+ metrics = format_metrics(emit_tag, record)
37
37
 
38
38
  # implemented to immediate call post method in this loop, because graphite-api.gem has the buffers.
39
39
  post(metrics, time)
40
40
  end
41
41
 
42
- chain.next
43
42
  end
44
43
 
45
44
  def format_metrics(tag, record)
46
- filtered_record = if @name_keys
47
- record.select { |k, v| @name_keys.include?(k.to_s) }
48
- else
49
- # defined @name_key_pattern
50
- record.select { |k, v| @name_key_pattern.match(k.to_s) }
51
- end
52
-
53
- return nil if filtered_record.empty?
54
-
55
45
  metrics = {}
56
- tag = tag.sub(/\.$/, '') # may include a dot at the end of the emit_tag fluent-mixin-rewrite-tag-name returns. remove it.
57
- filtered_record.each do |k, v|
58
- key = case @tag_for
59
- when 'ignore' then k.to_s
60
- when 'prefix' then "#{tag}.#{k}"
61
- when 'suffix' then "#{k}.#{tag}"
62
- end
63
-
64
- key = key.gsub(/(\s|\/)+/, '_') # cope with in the case of containing symbols or spaces in the key of the record like in_dstat.
65
- metrics[key] = v.to_f
66
- end
46
+ metrics[@monitoring_key + tag] = 1
67
47
  metrics
68
48
  end
69
49
 
70
- def post(metrics, time)
50
+ def post(metric, time)
71
51
  trial ||= 1
72
- @client.metrics(metrics, time)
73
- log.warn("Sending metrics: #{metrics}")
52
+ @client.metrics(metric, time)
53
+ log.warn("Sending metrics: #{metric}")
74
54
  rescue Errno::ETIMEDOUT
75
55
  # after long periods with nothing emitted, the connection will be closed and result in timeout
76
56
  if trial <= @max_retries
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adp-fluent-plugin-graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi SUZUKI