adp-fluent-plugin-graphite 0.0.8 → 0.0.12

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: 19ff6c9fe8ebd12c1ce1d653f41bcd3319924fb6b6b24063d0c76fca1b8154d6
4
- data.tar.gz: 0a1ff14f292042a5d91abe72d7558a5c6abef14b292f90ed4780990aa728f574
3
+ metadata.gz: c3c6bf04e2986897933cc69157dd99b04ab407487de4c21d4199a3497dc6afe4
4
+ data.tar.gz: 269daf2a466386e8b12b022e69661d97d092d8260ccd301911482df80fd0ae7d
5
5
  SHA512:
6
- metadata.gz: 6538e229464e19fa0bf31f6a0a18c9dcc433fb5cec6cb27907c2ac72a1b28a1b3cf4ccecdba7bce17f55225ab743f674e9e4e384536d8a609ad1326a0e8df3eb
7
- data.tar.gz: b090f1e79f6b28d73d6e89c6fd6775c7bcbc694c6752e7e4d11f04b76d273d9c114b49bca4c674b85bfeb8970e823bd10ad173418bf592385980edc553c0bd8f
6
+ metadata.gz: 5c900a4339ba745ac7971a683d520f505c8ed4957775df8c2bbfd5b54226b3dd0c84483450f19306be0e169e90db60f22d3f23425a2255418083085ee3c947c2
7
+ data.tar.gz: b785046cabb45dedee8ba4c791c0324e0484b6d1c289b207635e203a7775d140294e683edf59c0596549cc4c616e59f975df7ace61181100422fb9297599de66
@@ -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.8'
6
+ gem.version = '0.0.12'
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'
@@ -1,5 +1,4 @@
1
1
  require 'fluent/plugin/output'
2
- require 'fluent/mixin/rewrite_tag_name'
3
2
 
4
3
  module Fluent::Plugin
5
4
  class GraphiteOutput < Fluent::Plugin::Output
@@ -30,48 +29,28 @@ module Fluent::Plugin
30
29
  end
31
30
  end
32
31
 
33
- def emit(tag, es, chain)
32
+ def process(tag, es)
34
33
  es.each do |time, record|
35
34
  emit_tag = tag.dup
36
35
  log.info("Emit graphite plugin: #{record}")
37
- next unless metrics = format_metrics(emit_tag, record)
36
+ metrics = format_metrics(emit_tag, record)
38
37
 
39
38
  # implemented to immediate call post method in this loop, because graphite-api.gem has the buffers.
40
39
  post(metrics, time)
41
40
  end
42
41
 
43
- chain.next
44
42
  end
45
43
 
46
44
  def format_metrics(tag, record)
47
- filtered_record = if @name_keys
48
- record.select { |k, v| @name_keys.include?(k.to_s) }
49
- else
50
- # defined @name_key_pattern
51
- record.select { |k, v| @name_key_pattern.match(k.to_s) }
52
- end
53
-
54
- return nil if filtered_record.empty?
55
-
56
45
  metrics = {}
57
- tag = tag.sub(/\.$/, '') # may include a dot at the end of the emit_tag fluent-mixin-rewrite-tag-name returns. remove it.
58
- filtered_record.each do |k, v|
59
- key = case @tag_for
60
- when 'ignore' then k.to_s
61
- when 'prefix' then "#{tag}.#{k}"
62
- when 'suffix' then "#{k}.#{tag}"
63
- end
64
-
65
- key = key.gsub(/(\s|\/)+/, '_') # cope with in the case of containing symbols or spaces in the key of the record like in_dstat.
66
- metrics[key] = v.to_f
67
- end
46
+ metrics[tag] = 1
68
47
  metrics
69
48
  end
70
49
 
71
- def post(metrics, time)
50
+ def post(metric, time)
72
51
  trial ||= 1
73
- @client.metrics(metrics, time)
74
- log.warn("Sending metrics: #{metrics}")
52
+ @client.metrics(metric, time)
53
+ log.warn("Sending metrics: #{metric}")
75
54
  rescue Errno::ETIMEDOUT
76
55
  # after long periods with nothing emitted, the connection will be closed and result in timeout
77
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.8
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi SUZUKI