adp-fluent-plugin-graphite 0.0.18 → 0.0.19

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: c696abc25c0b8423a39559a766b709b461c53383fe664d317065683db4b8e61c
4
- data.tar.gz: 65dc4925391a451d7c33dd1e57814c2abc471ab80f646991d8aa668bfc858b67
3
+ metadata.gz: 4ec7994190ada35fdac587e172689dbf5dbac317a81908e9c887ef5b9bcff086
4
+ data.tar.gz: a7d66b34f986653f8746d27bb6f5831f53ff9c3e4c486a4d55af041421b14b7b
5
5
  SHA512:
6
- metadata.gz: 18c4f641033cff5dee5e3841284a14a6eb66859fd307ff9bf7b2ffebaa584c67bdbe38eb18cea2ac76b3b12cfa54acd0d6ffdf9e49d897ba56f8199975df4840
7
- data.tar.gz: 630da8b77e2fea85bc014f7f260d51906596e7de95568a74cb7a23dcf6b92512b57ce3743cd52126d2ee570338fac6e26ff8ccc78c7e7cf776a06988029591f3
6
+ metadata.gz: 510c48db7df2865b141198ad3f0eb0f14a4a9994e197673b55659558a1b10442cc1d70e159d8a2a49b3ae878c2d6081f99f82182ebca51cea0418bb2c6b988fc
7
+ data.tar.gz: 0b6b35d3afba2374aa90e204c88cbb2ec850ad3d90169030d48464e7a19f9eece20a678df9ad1a9c1de4107aeba81f0bd1869228a56d840752c1ef4960b9e000
@@ -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.18'
6
+ gem.version = '0.0.19'
7
7
  gem.authors = ['Aleksander Dudek']
8
8
  gem.email = 'adudek4@gmail.com'
9
9
  gem.homepage = ''
@@ -8,8 +8,8 @@ module Fluent::Plugin
8
8
  config_param :port, :integer, default: 2003
9
9
  config_param :prefix, :string, default: 'adp-fluentd-agent'
10
10
  config_param :monitoring_key, :string
11
- config_param :name_key_pattern, :string, default: nil
12
11
  config_param :max_retries, :integer, default: 3
12
+ config_param :log_level, :string, default: 'info'
13
13
 
14
14
  def initialize
15
15
  super
@@ -24,15 +24,11 @@ module Fluent::Plugin
24
24
 
25
25
  def configure(conf)
26
26
  super
27
- if @name_keys
28
- @name_keys = @name_keys.split(',')
29
- end
30
27
  end
31
28
 
32
29
  def process(tag, es)
33
30
  es.each do |time, record|
34
31
  emit_tag = tag.dup
35
- log.info("Emit graphite plugin: #{record}")
36
32
  metrics = format_metrics(emit_tag, record)
37
33
 
38
34
  # implemented to immediate call post method in this loop, because graphite-api.gem has the buffers.
@@ -51,7 +47,6 @@ module Fluent::Plugin
51
47
  def post(metric, time)
52
48
  trial ||= 1
53
49
  @client.metrics(metric, time)
54
- log.warn("Sending metrics: #{metric}")
55
50
  rescue Errno::ETIMEDOUT
56
51
  # after long periods with nothing emitted, the connection will be closed and result in timeout
57
52
  if trial <= @max_retries
@@ -70,6 +65,21 @@ module Fluent::Plugin
70
65
  log.error "out_graphite: ERROR: #{e}"
71
66
  end
72
67
 
68
+ def init_logger
69
+ if @log_level == 'debug'
70
+ GraphiteAPI::Logger.init level: :debug
71
+ end
72
+ if @log_level == 'warn'
73
+ GraphiteAPI::Logger.init level: :warn
74
+ end
75
+ if @log_level == 'info'
76
+ GraphiteAPI::Logger.init level: :info
77
+ end
78
+ if @log_level == 'error'
79
+ GraphiteAPI::Logger.init level: :error
80
+ end
81
+ end
82
+
73
83
  def connect_client!
74
84
  options = {
75
85
  # Required: valid URI {udp,tcp}://host:port/?timeout=seconds
@@ -85,8 +95,8 @@ module Fluent::Plugin
85
95
  cache: 4 * 60 * 60,
86
96
  }
87
97
  @client = GraphiteAPI.new options
88
- GraphiteAPI::Logger.init level: :debug
89
- log.info("starting client")
98
+ init_logger
99
+ log.info("Starting graphite client")
90
100
  end
91
101
  end
92
102
  end
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.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksander Dudek