adp-fluent-plugin-graphite 0.0.10 → 0.0.14

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
  SHA256:
3
- metadata.gz: 9b2ff8feec4a9179c48a59aabd67ff2831ed395b94fcd18c82ee763e17cf942c
4
- data.tar.gz: 14b628cb174406a1b1186c6d27380de5a9dafd1657c0e8701c4973bf934848e3
3
+ metadata.gz: 21120861eb51aec332d4284c136334ea9fce73141f40323d1113e0d22f2958f0
4
+ data.tar.gz: a5f0d97c4e056764d8bfd87dd02e4a5b733c9df89558ee3ec1155f307ce89400
5
5
  SHA512:
6
- metadata.gz: 86d6c05025b6566d15d28a38ca588f72a07f7298179d8e0365aaf3c1fc456dbd99661d6ddad2d8942bf1e643eed46656ca71ae6bbd6e8b57f110645e12f09d71
7
- data.tar.gz: 6fe0e193ec64ed235d2b8ca8f1d655214be9090ef126968c8c4f4210e789663a3db4be9c46a8d1a10beda042a788af37473fef42516e4631b6411504a9a28a2b
6
+ metadata.gz: 95d3c4eb3c8527b372cdb151a4da8b067b3a23eda527584789687deb7c0e8135b59c472c28f43585b49e608a4a4f951573ce5dc4174c2ca7f70dea72f485d9dc
7
+ data.tar.gz: dd18d9731cd866f0214f8c0073559b6cfbe95c718801a659a7d228c05a7919174b9e0b14f386c3b2d82bbd75700b84d373e9f94d90cbc016cc369179dd788353
@@ -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.10'
6
+ gem.version = '0.0.14'
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
 
@@ -33,7 +33,7 @@ module Fluent::Plugin
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)
@@ -42,34 +42,15 @@ module Fluent::Plugin
42
42
  end
43
43
 
44
44
  def format_metrics(tag, record)
45
- filtered_record = if @name_keys
46
- record.select { |k, v| @name_keys.include?(k.to_s) }
47
- else
48
- # defined @name_key_pattern
49
- record.select { |k, v| @name_key_pattern.match(k.to_s) }
50
- end
51
-
52
- return nil if filtered_record.empty?
53
-
54
45
  metrics = {}
55
- tag = tag.sub(/\.$/, '') # may include a dot at the end of the emit_tag fluent-mixin-rewrite-tag-name returns. remove it.
56
- filtered_record.each do |k, v|
57
- key = case @tag_for
58
- when 'ignore' then k.to_s
59
- when 'prefix' then "#{tag}.#{k}"
60
- when 'suffix' then "#{k}.#{tag}"
61
- end
62
-
63
- key = key.gsub(/(\s|\/)+/, '_') # cope with in the case of containing symbols or spaces in the key of the record like in_dstat.
64
- metrics[key] = v.to_f
65
- end
46
+ metrics[@monitoring_key + "." + tag] = 1
66
47
  metrics
67
48
  end
68
49
 
69
- def post(metrics, time)
50
+ def post(metric, time)
70
51
  trial ||= 1
71
- @client.metrics(metrics, time)
72
- log.warn("Sending metrics: #{metrics}")
52
+ @client.metrics(metric, time)
53
+ log.warn("Sending metrics: #{metric}")
73
54
  rescue Errno::ETIMEDOUT
74
55
  # after long periods with nothing emitted, the connection will be closed and result in timeout
75
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.10
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi SUZUKI