fluent-plugin-growthforecast 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fluent-plugin-growthforecast.gemspec +2 -2
- data/lib/fluent/plugin/out_growthforecast.rb +22 -4
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fluent-plugin-growthforecast"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["TAGOMORI Satoshi"]
|
12
|
-
s.date = "2012-04
|
12
|
+
s.date = "2012-12-04"
|
13
13
|
s.description = "Plugin to post numbers to GrowthForecast (by kazeburo)"
|
14
14
|
s.email = "tagomoris@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -11,6 +11,10 @@ class Fluent::GrowthForecastOutput < Fluent::Output
|
|
11
11
|
config_param :service, :string
|
12
12
|
config_param :section, :string, :default => nil
|
13
13
|
|
14
|
+
config_param :authentication, :string, :default => nil # nil or 'none' or 'basic'
|
15
|
+
config_param :username, :string, :default => ''
|
16
|
+
config_param :password, :string, :default => ''
|
17
|
+
|
14
18
|
config_param :name_keys, :string, :default => nil
|
15
19
|
config_param :name_key_pattern, :string, :default => nil
|
16
20
|
|
@@ -40,6 +44,8 @@ class Fluent::GrowthForecastOutput < Fluent::Output
|
|
40
44
|
@name_key_pattern = Regexp.new(@name_key_pattern)
|
41
45
|
end
|
42
46
|
|
47
|
+
@authentication ||= 'none'
|
48
|
+
|
43
49
|
@mode = case @mode
|
44
50
|
when 'count' then :count
|
45
51
|
when 'modified' then :modified
|
@@ -71,20 +77,32 @@ class Fluent::GrowthForecastOutput < Fluent::Output
|
|
71
77
|
end
|
72
78
|
|
73
79
|
def format_url(tag, name)
|
80
|
+
name_esc = URI.escape(name)
|
74
81
|
case @tag_for
|
75
82
|
when :ignore
|
76
|
-
@gfurl + @section + '/' +
|
83
|
+
@gfurl + @section + '/' + name_esc
|
77
84
|
when :section
|
78
|
-
@gfurl + tag + '/' +
|
85
|
+
@gfurl + tag + '/' + name_esc
|
79
86
|
when :name_prefix
|
80
|
-
@gfurl + @section + '/' + tag + '_' +
|
87
|
+
@gfurl + @section + '/' + tag + '_' + name_esc
|
81
88
|
end
|
82
89
|
end
|
83
90
|
|
84
91
|
def post(tag, name, value)
|
85
92
|
url = format_url(tag,name)
|
93
|
+
|
94
|
+
uri = URI.parse(url)
|
95
|
+
req = Net::HTTP::Post(uri.path)
|
96
|
+
req.set_form_data({'number' => value.to_i.to_s, 'mode' => @mode.to_s})
|
97
|
+
case @authentication
|
98
|
+
when 'basic'
|
99
|
+
req.basic_auth(@username, @password)
|
100
|
+
end
|
101
|
+
|
86
102
|
begin
|
87
|
-
res = Net::HTTP.
|
103
|
+
res = Net::HTTP.start(uri.host, uri.port) do |http|
|
104
|
+
http.request(req)
|
105
|
+
end
|
88
106
|
rescue IOError, EOFError, SystemCallError
|
89
107
|
# server didn't respond
|
90
108
|
$log.warn "Net::HTTP.post_form raises exception: #{$!.class}, '#{$!.message}'"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-growthforecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
@@ -189,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: '0'
|
190
190
|
segments:
|
191
191
|
- 0
|
192
|
-
hash: -
|
192
|
+
hash: -3904779649461648706
|
193
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
194
|
none: false
|
195
195
|
requirements:
|