adp-fluent-plugin-graphite 0.0.15 → 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: 3d7ea3516d03ae9df0d626c97453daa20ca97c86491e4ebbeb47bdf8bb0a95e3
4
- data.tar.gz: f306f5437dd3fbff7394985cf3ad4618bcecde930d24d74be8529918ad5a2b62
3
+ metadata.gz: 4ec7994190ada35fdac587e172689dbf5dbac317a81908e9c887ef5b9bcff086
4
+ data.tar.gz: a7d66b34f986653f8746d27bb6f5831f53ff9c3e4c486a4d55af041421b14b7b
5
5
  SHA512:
6
- metadata.gz: 5ebe013292fc99265b692e060b5a3041f2b2ef770becb3f53f20eb372ecb7a4f594e51bfa8ee607fcb7c059918f52bca0d334f876a119dbd9d51031aa2eebc63
7
- data.tar.gz: f902ca5c94366c979a009bbbfe39cbc3951c06ee18ff27b7ec2c2d177423c07d593e98cc16184e43cef81770cc37398ee96c574226f06cc9019d8061812747ae
6
+ metadata.gz: 510c48db7df2865b141198ad3f0eb0f14a4a9994e197673b55659558a1b10442cc1d70e159d8a2a49b3ae878c2d6081f99f82182ebca51cea0418bb2c6b988fc
7
+ data.tar.gz: 0b6b35d3afba2374aa90e204c88cbb2ec850ad3d90169030d48464e7a19f9eece20a678df9ad1a9c1de4107aeba81f0bd1869228a56d840752c1ef4960b9e000
@@ -3,10 +3,10 @@ $:.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.15'
7
- gem.authors = ['Satoshi SUZUKI']
8
- gem.email = 'studio3104.com@gmail.com'
9
- gem.homepage = 'https://github.com/studio3104/fluent-plugin-graphite'
6
+ gem.version = '0.0.19'
7
+ gem.authors = ['Aleksander Dudek']
8
+ gem.email = 'adudek4@gmail.com'
9
+ gem.homepage = ''
10
10
  gem.description = 'fluentd output plugin to send metrics to graphite'
11
11
  gem.summary = gem.description
12
12
  gem.licenses = ['MIT']
@@ -6,10 +6,10 @@ module Fluent::Plugin
6
6
 
7
7
  config_param :host, :string
8
8
  config_param :port, :integer, default: 2003
9
- config_param :tag_for, :string, default: 'prefix'
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.
@@ -43,14 +39,14 @@ module Fluent::Plugin
43
39
 
44
40
  def format_metrics(tag, record)
45
41
  metrics = {}
46
- metrics[@monitoring_key + "." + tag] = 1
42
+ key = @monitoring_key + "." + @prefix + "." + tag
43
+ metrics[key] = 1
47
44
  metrics
48
45
  end
49
46
 
50
47
  def post(metric, time)
51
48
  trial ||= 1
52
49
  @client.metrics(metric, time)
53
- log.warn("Sending metrics: #{metric}")
54
50
  rescue Errno::ETIMEDOUT
55
51
  # after long periods with nothing emitted, the connection will be closed and result in timeout
56
52
  if trial <= @max_retries
@@ -69,27 +65,38 @@ module Fluent::Plugin
69
65
  log.error "out_graphite: ERROR: #{e}"
70
66
  end
71
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
+
72
83
  def connect_client!
73
84
  options = {
74
85
  # Required: valid URI {udp,tcp}://host:port/?timeout=seconds
75
- graphite: "udp://#{@host}:#{@port}",
86
+ graphite: "tcp://#{@host}:#{@port}",
76
87
 
77
88
  # Optional: results are aggregated in 60 seconds slices ( default is 60 )
78
- slice: 60,
89
+ slice: 30,
79
90
 
80
91
  # Optional: send to graphite every 60 seconds ( default is 0 - direct send )
81
92
  interval: 30,
82
93
 
83
94
  # Optional: set the max age in seconds for records reanimation ( default is 12 hours )
84
95
  cache: 4 * 60 * 60,
85
-
86
- # Optional: The default aggregation method for multiple reports in the same slice (default is :sum).
87
- # Possible options: :sum, :avg, :replace
88
- default_aggregation_method: :avg
89
96
  }
90
97
  @client = GraphiteAPI.new options
91
- GraphiteAPI::Logger.init level: :debug
92
- log.info("starting client")
98
+ init_logger
99
+ log.info("Starting graphite client")
93
100
  end
94
101
  end
95
102
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adp-fluent-plugin-graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
- - Satoshi SUZUKI
7
+ - Aleksander Dudek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.2.0
69
69
  description: fluentd output plugin to send metrics to graphite
70
- email: studio3104.com@gmail.com
70
+ email: adudek4@gmail.com
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
@@ -82,7 +82,7 @@ files:
82
82
  - lib/fluent/plugin/out_graphite.rb
83
83
  - test/helper.rb
84
84
  - test/plugin/test_out_graphite.rb
85
- homepage: https://github.com/studio3104/fluent-plugin-graphite
85
+ homepage: ''
86
86
  licenses:
87
87
  - MIT
88
88
  metadata: {}