fluent-plugin-td-monitoring 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: dedbe525edc4681d73f72d20ac3c326e935298a1
4
- data.tar.gz: 01bb7314e6d6246252dcdf118861e46e33eba070
3
+ metadata.gz: 5ed61bb451c1d0809858044aaa984161f11f63d5
4
+ data.tar.gz: 844db9811febcad867500a8db5bd95659426dc74
5
5
  SHA512:
6
- metadata.gz: fe3e49c87aaab1fb782a95134ccbc7eca030e62d72a111a826ebc652536db4009865da991af7597eb5a9806fb76586f85875f4416cedaadb8d57e84221effb17
7
- data.tar.gz: 3754c5dd617a386869a2c8bf12b4092519ac1fb19ea7f7ecd2c451d0a43c4be56830167f216e0ef32bd7603d86425927b20bee2f8b252f7db7474f4017e68dde
6
+ metadata.gz: 15eb5bab5dcd9dde7d8dfd9983b8e23ca18cf58eca5f6a75e3a5d74e9d15b0651392b5454e3d139cd9ba407ab4693b66050130dd89ce6b6400ee60174fa6f110
7
+ data.tar.gz: 4e20e2acca0e8c3435b5072e8b056f5e73b1ddab37f43ca630037b025b7023d796d3f29bcf85fb56cd2074f8a82cd4094e0b14a1fcfb44762c58740935bacab5
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ == 2014-06-06 version 0.1.2
2
+
3
+ - support log_level option
4
+ - disable_node_info is true by default
5
+
1
6
  == 2014-03-09 version 0.1.1
2
7
 
3
8
  - Catch an exception when can't get system metrics
data/README.md CHANGED
@@ -99,7 +99,7 @@ $ git clone git@github.com:treasure-data/fluent-plugin-td-monitoring.git
99
99
  $ cd fluent-plugin-td-monitoring
100
100
  $ bundle install
101
101
  $ bundle exec rake build
102
- $ gem install pkg/fluent-plugin-td-monitoring-0.1.1.gem
102
+ $ gem install pkg/fluent-plugin-td-monitoring-0.1.2.gem
103
103
  $ fluentd -c fluentd.conf
104
104
  ```
105
105
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -3,7 +3,7 @@ module Fluent
3
3
  require_relative 'out_td_counter'
4
4
 
5
5
  class TDMonitorAgentInput < Input
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.2"
7
7
 
8
8
  Plugin.register_input('td_monitor_agent', self)
9
9
 
@@ -17,7 +17,11 @@ module Fluent
17
17
  config_param :read_timeout, :integer, :default => 10
18
18
  config_param :send_timeout, :integer, :default => 10
19
19
 
20
- config_param :disable_node_info, :bool, :default => false
20
+ config_param :disable_node_info, :bool, :default => true
21
+
22
+ unless method_defined?(:log)
23
+ define_method(:log) { $log }
24
+ end
21
25
 
22
26
  def initialize
23
27
  super
@@ -27,11 +31,12 @@ module Fluent
27
31
  end
28
32
 
29
33
  class TimerWatcher < Coolio::TimerWatcher
30
- def initialize(interval, repeat, &callback)
34
+ def initialize(interval, repeat, log, &callback)
31
35
  @callback = callback
32
36
  # Avoid long shutdown time
33
37
  @num_call = 0
34
38
  @call_interval = interval / 10
39
+ @log = log
35
40
  super(10, repeat)
36
41
  end
37
42
 
@@ -42,8 +47,8 @@ module Fluent
42
47
  @callback.call
43
48
  end
44
49
  rescue => e
45
- $log.error e.to_s
46
- $log.error_backtrace
50
+ @log.error e.to_s
51
+ @log.error_backtrace
47
52
  end
48
53
  end
49
54
 
@@ -70,22 +75,22 @@ module Fluent
70
75
  end
71
76
  rescue => e
72
77
  @disable_node_info = true
73
- $log.warn "Failed to get system metrics. Set 'disable_node_info' to true: #{e}"
78
+ log.warn "Failed to get system metrics. Set 'disable_node_info' to true: #{e}"
74
79
  end
75
80
  @counters = collect_counters
76
81
 
77
82
  unless register_instance_info
78
- $log.warn "Can't register instance information at start"
83
+ log.warn "Can't register instance information at start"
79
84
  end
80
85
 
81
86
  @loop = Coolio::Loop.new
82
- @timer = TimerWatcher.new(@emit_interval, true, &method(:on_timer))
87
+ @timer = TimerWatcher.new(@emit_interval, true, log, &method(:on_timer))
83
88
  @loop.attach(@timer)
84
89
  @thread = Thread.new(&method(:run))
85
90
  end
86
91
 
87
92
  def shutdown
88
- $log.info "shutdown td_monitor_agent plugin"
93
+ log.info "shutdown td_monitor_agent plugin"
89
94
 
90
95
  @loop.watchers.each {|w| w.detach }
91
96
  @loop.stop
@@ -95,8 +100,8 @@ module Fluent
95
100
  def run
96
101
  @loop.run
97
102
  rescue => e
98
- $log.error "unexpected error", :error=> e.to_s
99
- $log.error_backtrace
103
+ log.error "unexpected error", :error=> e.to_s
104
+ log.error_backtrace
100
105
  end
101
106
 
102
107
  EVENT_ENDPOINT_PATH = '/v1/monitoring/start'
@@ -108,7 +113,7 @@ module Fluent
108
113
  end
109
114
  sleep 2
110
115
  }
111
- $log.error "Send instance metrics failed. Try next #{@emit_interval} seconds"
116
+ log.error "Send instance metrics failed. Try next #{@emit_interval} seconds"
112
117
  end
113
118
 
114
119
  private
@@ -202,11 +207,11 @@ module Fluent
202
207
  begin
203
208
  res = post(path, info)
204
209
  unless res.code.to_s.start_with?('2')
205
- $log.warn "Get an error response: code = #{res.code}, message = #{res.body}"
210
+ log.warn "Get an error response: code = #{res.code}, message = #{res.body}"
206
211
  return false
207
212
  end
208
213
  rescue => e
209
- $log.warn "Failed to send metrics: error = #{e.to_s}"
214
+ log.warn "Failed to send metrics: error = #{e.to_s}"
210
215
  return false
211
216
  end
212
217
  true
@@ -247,7 +252,7 @@ module Fluent
247
252
  end
248
253
 
249
254
  def new_client(opts = {})
250
- client = HTTPClient.new(@http_proxy, "FMS Agent #{VERSION}")
255
+ client = HTTPClient.new(@http_proxy, "TDMS Agent #{VERSION}")
251
256
  client.connect_timeout = @connect_timeout
252
257
  client.receive_timeout = @read_timeout
253
258
  client.send_timeout = @send_timeout
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-td-monitoring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.2.0
134
+ rubygems_version: 2.2.2
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: ''