fluent-plugin-festival 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/fluent-plugin-festival.gemspec +1 -1
- data/lib/fluent/plugin/festival_proxy.rb +14 -14
- data/lib/fluent/plugin/in_festival.rb +6 -6
- data/test/helper.rb +3 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b45d490133de5d8ac156916e2c6a7c0942af062e
|
4
|
+
data.tar.gz: 997f3fae94b7d9f02b97a340a88c847428012c1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 153b78c3058879c365c403d3dc21ff4b5e929a3c32618fb6e78978bb812e6965cc4f041af539896a0f9ac18cd9527d276618bb0a5a4a91e9e6557b17a96c04e8
|
7
|
+
data.tar.gz: 600b3fafe658a662731fdf10f33bbd58d03293592204c98eb950ddc6ac31130e1d8628cab93894cafb0bd5f5b83fff89026061282d86cca9dc1e449064c3e72a
|
@@ -10,7 +10,7 @@ module Fluent::Plugin
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def start_proxy
|
13
|
-
|
13
|
+
log.debug "start festival proxy #{@api_uri}"
|
14
14
|
|
15
15
|
@uri = URI.parse(@api_uri)
|
16
16
|
@https = Net::HTTP.new(@uri.host, @uri.port)
|
@@ -19,17 +19,17 @@ module Fluent::Plugin
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def shutdown_proxy
|
22
|
-
|
22
|
+
log.debug "shutdown_proxy #{@session.inspect}"
|
23
23
|
delete_session
|
24
24
|
@https.finish() if @https.active?
|
25
25
|
end
|
26
26
|
|
27
27
|
def error_handler(response, message)
|
28
28
|
if response.code != "200"
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
log.error :error => message
|
30
|
+
log.debug "code: #{response.code}"
|
31
|
+
log.debug "message: #{response.message}"
|
32
|
+
log.debug "body: #{response.body}"
|
33
33
|
return false
|
34
34
|
end
|
35
35
|
return true
|
@@ -90,7 +90,7 @@ module Fluent::Plugin
|
|
90
90
|
|
91
91
|
get_data_req = @uri + Pathname("/festival/eaas/experimentation/#{path}").cleanpath.to_s
|
92
92
|
#get_data_req.query = URI.encode_www_form(get_data_params)
|
93
|
-
|
93
|
+
log.debug "#{get_data_req}"
|
94
94
|
# currently time window is automatically updated
|
95
95
|
#@from = Time.now.iso8601
|
96
96
|
get_data_req
|
@@ -111,28 +111,28 @@ module Fluent::Plugin
|
|
111
111
|
def get_data
|
112
112
|
if !valid_session?
|
113
113
|
return nil if create_session.nil?
|
114
|
-
|
114
|
+
log.debug "session #{@session} created."
|
115
115
|
end
|
116
116
|
data = []
|
117
117
|
#require 'pry-byebug'
|
118
|
-
|
118
|
+
log.debug "@resources: #{@resources.inspect}"
|
119
119
|
@resources.each do |resource|
|
120
120
|
case resource_type(resource.path)
|
121
121
|
when "current_data" then
|
122
|
-
|
122
|
+
log.debug "get_data: request #{get_data_request(resource.path)}, #{get_data_header.inspect}"
|
123
123
|
get_data_res = @https.get(get_data_request(resource.path), get_data_header)
|
124
124
|
return nil if !error_handler(get_data_res,"get_data failed.")
|
125
|
-
|
125
|
+
log.debug "get_data: #{get_data_res.body}"
|
126
126
|
data << {
|
127
127
|
"resourceName": resource.path,
|
128
128
|
"dataValue": JSON.parse(get_data_res.body)["dataValue"]
|
129
129
|
}
|
130
130
|
when "historical_data" then
|
131
|
-
|
131
|
+
log.error "historical_data is not supported yet"
|
132
132
|
return nil
|
133
133
|
else
|
134
|
-
|
135
|
-
|
134
|
+
log.error "The other resource type is not supported yet"
|
135
|
+
log.error "resource_type: #{resource_type(resource.path)}"
|
136
136
|
return nil
|
137
137
|
end
|
138
138
|
end
|
@@ -16,7 +16,7 @@ module Fluent::Plugin
|
|
16
16
|
desc 'email (login_name) for FESTIVAL EaaS API'
|
17
17
|
config_param :email, :string
|
18
18
|
desc 'password for FESTIVAL EaaS API'
|
19
|
-
config_param :password, :string
|
19
|
+
config_param :password, :string, secret: true
|
20
20
|
#base.config_param :keep_alive, :integer, :default => 2
|
21
21
|
#base.desc 'Start date of historical data'
|
22
22
|
#base.config_param :start_date, :string, :default => Time.now.iso8601
|
@@ -77,9 +77,9 @@ module Fluent::Plugin
|
|
77
77
|
emit(data) if !(data.nil? || data.empty?)
|
78
78
|
sleep @polling_interval
|
79
79
|
rescue Exception => e
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
log.error :error => e.to_s
|
81
|
+
log.debug(e.backtrace.join("\n"))
|
82
|
+
#log.debug_backtrace(e.backtrace)
|
83
83
|
sleep @polling_interval
|
84
84
|
end
|
85
85
|
end
|
@@ -103,8 +103,8 @@ module Fluent::Plugin
|
|
103
103
|
router.emit(@tag, time, record)
|
104
104
|
end
|
105
105
|
rescue Exception => e
|
106
|
-
|
107
|
-
|
106
|
+
log.error :error => e.to_s
|
107
|
+
log.debug_backtrace(e.backtrace)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
data/test/helper.rb
CHANGED
@@ -1,26 +1,6 @@
|
|
1
|
-
require '
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
1
|
+
require 'bundler/setup'
|
10
2
|
require 'test/unit'
|
11
3
|
|
12
|
-
$LOAD_PATH.unshift(File.join(
|
13
|
-
$LOAD_PATH.unshift(
|
4
|
+
$LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
|
5
|
+
$LOAD_PATH.unshift(__dir__)
|
14
6
|
require 'fluent/test'
|
15
|
-
unless ENV.has_key?('VERBOSE')
|
16
|
-
nulllogger = Object.new
|
17
|
-
nulllogger.instance_eval {|obj|
|
18
|
-
def method_missing(method, *args)
|
19
|
-
# pass
|
20
|
-
end
|
21
|
-
}
|
22
|
-
$log = nulllogger
|
23
|
-
end
|
24
|
-
|
25
|
-
class Test::Unit::TestCase
|
26
|
-
end
|