Skip to content

Commit

Permalink
Merge pull request #1 from brewkode/fix/on-start-error-handling
Browse files Browse the repository at this point in the history
fix: handle error and return gracefully during failures
  • Loading branch information
pepov authored Jan 5, 2024
2 parents 76a1920 + 89fa7e9 commit 6e88fd7
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions lib/fluent/plugin/out_gcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,21 @@ def configure(conf)
end

def start
@gcs = Google::Cloud::Storage.new(
project: @project,
keyfile: @credentials,
retries: @client_retries,
timeout: @client_timeout
)
@gcs_bucket = @gcs.bucket(@bucket)

ensure_bucket
super
begin
@gcs = Google::Cloud::Storage.new(
project: @project,
keyfile: @credentials,
retries: @client_retries,
timeout: @client_timeout
)
@gcs_bucket = @gcs.bucket(@bucket)

ensure_bucket
super
rescue => e
log.warn "GCS output plugin initialization error: #{e.message}"
log.warn "#{e.full_message()}"
end
end

def format(tag, time, record)
Expand Down

0 comments on commit 6e88fd7

Please # to comment.