fluent-plugin-metricsense 0.2.4 → 0.2.5

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: 6430d058a31cc5069917ff310898b8e8cfc05b6e
4
- data.tar.gz: 312a17043422d6acd5f159b67784a5ab7825d024
3
+ metadata.gz: 87384bad8d55efdb43f5f68b3d66bcfdce31a003
4
+ data.tar.gz: 2efa753e4a092052ff567fd014d8004804cd5b1e
5
5
  SHA512:
6
- metadata.gz: 216fb1a2b7e72ac5236244bbecf7143ffc4ef2151e4796f7f95293de70c8c1476cc52978e31afb560d68b3d706c492a1cb0528c2218fca49344eab5f2ee7619b
7
- data.tar.gz: d90f34a0ff17b574205d81aba56561e1eaac9bb14f4014ed7cfff5d8fea15fc0087d22c7476b620686e1b539fcdc40a02ff5184bd6fc54a7411acb58a966b72f
6
+ metadata.gz: 99f6c382071ca9e4d26fefa8c3227d5558718750b6287c2eed7102e96c53aad1a6367271dc85d21aaf2b8f5b14773f0fbb90ade4eea4e4074d8263f90551e890
7
+ data.tar.gz: 0a42690cde3a828784025d0bbc914a4f23b8ac7ef0ff93bfc3ef4375651a5cac6953d988b0346f4d84360a5e2b0cba1d57eeac1c9c89b932defc10e14c126ffe
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -26,6 +26,7 @@ module Fluent::MetricSenseOutput::Backends
26
26
 
27
27
  config_param :librato_user, :string
28
28
  config_param :librato_token, :string
29
+ config_param :batch_size, :integer, :default => 200
29
30
 
30
31
  def initialize
31
32
  super
@@ -43,7 +44,7 @@ module Fluent::MetricSenseOutput::Backends
43
44
 
44
45
  begin
45
46
  # send upto 50 entries at once
46
- data.each_slice(50) {|slice|
47
+ data.each_slice(@batch_size) {|slice|
47
48
  req = Net::HTTP::Post.new('/v1/metrics', header)
48
49
  req.basic_auth @librato_user, @librato_token
49
50
 
@@ -67,14 +68,14 @@ module Fluent::MetricSenseOutput::Backends
67
68
  }
68
69
  body = {"gauges"=>data}.to_json
69
70
 
70
- $log.trace { "librato metrics: #{data.inspect}" }
71
+ log.trace { "librato metrics: #{data.inspect}" }
71
72
  req.body = body
72
73
  req.set_content_type("application/json")
73
74
  res = http.request(req)
74
75
 
75
76
  # TODO error handling
76
77
  if res.code != "200"
77
- $log.warn "librato_metrics: #{res.code}: #{res.body}"
78
+ log.warn "librato_metrics: #{res.code}: #{res.body}"
78
79
  end
79
80
  }
80
81
 
@@ -117,14 +118,14 @@ module Fluent::MetricSenseOutput::Backends
117
118
  req = Net::HTTP::Put.new("/v1/metrics/#{CGI.escape name}", header)
118
119
  req.basic_auth @librato_user, @librato_token
119
120
 
120
- $log.trace { "librato initialize metric with mode #{mode}: #{name}" }
121
+ log.trace { "librato initialize metric with mode #{mode}: #{name}" }
121
122
  req.body = METRIC_INITIALIZE_REQUEST_PER_MODE[mode]
122
123
  req.set_content_type("application/json")
123
124
  res = http.request(req)
124
125
 
125
126
  # TODO error handling
126
127
  if res.code !~ /20./
127
- $log.warn "librato_metrics: #{res.code}: #{res.body}"
128
+ log.warn "librato_metrics: #{res.code}: #{res.body}"
128
129
  else
129
130
  @initialized_metrics[name] = true
130
131
  end
@@ -36,6 +36,9 @@ module Fluent
36
36
  class Backend
37
37
  UpdateMode = MetricSenseOutput::UpdateMode
38
38
  include Configurable
39
+
40
+ attr_accessor :log
41
+
39
42
  def start
40
43
  end
41
44
  def shutdown
@@ -64,6 +67,10 @@ module Fluent
64
67
 
65
68
  config_param :aggregate_interval, :time, :default => 60
66
69
 
70
+ unless method_defined?(:log)
71
+ define_method(:log) { $log }
72
+ end
73
+
67
74
  def configure(conf)
68
75
  super
69
76
 
@@ -92,6 +99,7 @@ module Fluent
92
99
  @normalize_factor = @aggregate_interval / 60
93
100
 
94
101
  @backend = be.new
102
+ @backend.log = log
95
103
  @backend.configure(conf)
96
104
  end
97
105
 
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-metricsense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-12 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.10.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.10.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.8.7
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.5.4
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.5.4
69
69
  description: MetricSense - application metrics aggregation plugin for Fluentd
@@ -72,7 +72,7 @@ executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
- - .gitignore
75
+ - ".gitignore"
76
76
  - Gemfile
77
77
  - README.rdoc
78
78
  - Rakefile
@@ -91,17 +91,17 @@ require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.0.2
104
+ rubygems_version: 2.2.2
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: MetricSense - application metrics aggregation plugin for Fluentd