fluent-plugin-azurestorage-gen2 0.2.0 → 0.2.1
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/README.md +1 -1
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_azurestorage_gen2.rb +21 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 830b58ff51c9166a04c91f7e4994cc5c867c86e1
|
4
|
+
data.tar.gz: b257f9c0684a7797266920775cea076d9c6f67dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2512d0e061e46d7820dc6405ea2530eeceb1f65483eb9d31789df8956c4fb1469a43d20a2ebee3b0e496a73143f406331c17aabe812d9a65dae4828729d8c6aa
|
7
|
+
data.tar.gz: 185079c3757ccdbaf51d205984f57791b5d3e20566c65ec8adea0b94f7db6667a56074a34234543afe29e429fb205f7bc2cf681b70e8e803d0992b1db772e65d
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -34,6 +34,7 @@ module Fluent::Plugin
|
|
34
34
|
config_param :store_as, :string, :default => "none"
|
35
35
|
config_param :auto_create_container, :bool, :default => false
|
36
36
|
config_param :skip_container_check, :bool, :default => false
|
37
|
+
config_param :enable_retry, :bool, :default => false
|
37
38
|
config_param :format, :string, :default => "out_file"
|
38
39
|
config_param :time_slice_format, :string, :default => '%Y%m%d'
|
39
40
|
config_param :command_parameter, :string, :default => nil
|
@@ -138,7 +139,7 @@ module Fluent::Plugin
|
|
138
139
|
@current_index = 0
|
139
140
|
generate_log_name(metadata, @current_index)
|
140
141
|
end
|
141
|
-
log.debug "Start uploading temp file: #{tmp.path}"
|
142
|
+
log.debug "azurestorage_gen2: Start uploading temp file: #{tmp.path}"
|
142
143
|
content = File.open(tmp.path, 'rb') { |file| file.read }
|
143
144
|
upload_blob(content, metadata)
|
144
145
|
@last_azure_storage_path = @azure_storage_path
|
@@ -151,7 +152,7 @@ module Fluent::Plugin
|
|
151
152
|
|
152
153
|
private
|
153
154
|
def upload_blob(content, metadata)
|
154
|
-
log.debug "azurestorage_gen2:
|
155
|
+
log.debug "azurestorage_gen2: Uploading blob: #{@azure_storage_path}"
|
155
156
|
existing_content_length = get_blob_properties(@azure_storage_path)
|
156
157
|
if existing_content_length == 0
|
157
158
|
create_blob(@azure_storage_path)
|
@@ -298,7 +299,7 @@ module Fluent::Plugin
|
|
298
299
|
if response.success?
|
299
300
|
log.debug "azurestorage_gen2: Container '#{@azure_container}' created, response code: #{response.code}"
|
300
301
|
elsif response.timed_out?
|
301
|
-
raise Fluent::UnrecoverableError,
|
302
|
+
raise Fluent::UnrecoverableError, "Creating container '#{@azure_container}' request timed out."
|
302
303
|
else
|
303
304
|
raise Fluent::UnrecoverableError, "Creating container request failed - code: #{response.code}, body: #{response.body}, headers: #{response.headers}"
|
304
305
|
end
|
@@ -330,7 +331,7 @@ module Fluent::Plugin
|
|
330
331
|
|
331
332
|
private
|
332
333
|
def append_blob_block(blob_path, content, position)
|
333
|
-
log.debug "azurestorage_gen2: append_blob_block.start: Append blob ('#{blob_path}') called with position #{position}"
|
334
|
+
log.debug "azurestorage_gen2: append_blob_block.start: Append blob ('#{blob_path}') called with position #{position} (content length: #{content.length}, end position: #{position + content.length})"
|
334
335
|
datestamp = create_request_date
|
335
336
|
headers = {:"x-ms-version" => ABFS_API_VERSION, :"x-ms-date" => datestamp, :"Content-Length" => content.length}
|
336
337
|
params = {:action => "append", :position => "#{position}"}
|
@@ -368,7 +369,7 @@ module Fluent::Plugin
|
|
368
369
|
elsif response.timed_out?
|
369
370
|
raise Fluent::UnrecoverableError, "Bloub '#{blob_path}' flush request timed out."
|
370
371
|
else
|
371
|
-
|
372
|
+
raise_error "Blob flush request failed - code: #{response.code}, body: #{response.body}, headers: #{response.headers}"
|
372
373
|
end
|
373
374
|
end
|
374
375
|
request.run
|
@@ -506,6 +507,15 @@ module Fluent::Plugin
|
|
506
507
|
Time.now.strftime('%a, %e %b %y %H:%M:%S %Z')
|
507
508
|
end
|
508
509
|
|
510
|
+
private
|
511
|
+
def raise_error(error_message)
|
512
|
+
if @enable_retry
|
513
|
+
raise BlobOperationError, error_message
|
514
|
+
else
|
515
|
+
raise Fluent::UnrecoverableError, error_message
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
509
519
|
def uuid_random
|
510
520
|
require 'uuidtools'
|
511
521
|
::UUIDTools::UUID.random_create.to_s
|
@@ -622,4 +632,10 @@ module Fluent::Plugin
|
|
622
632
|
super(message)
|
623
633
|
end
|
624
634
|
end
|
635
|
+
|
636
|
+
class BlobOperationError < StandardError
|
637
|
+
def initialize(message="Default message")
|
638
|
+
super(message)
|
639
|
+
end
|
640
|
+
end
|
625
641
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-azurestorage-gen2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Szabo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|