Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CF] improve logging and error handling #434

Open
wants to merge 4 commits into
base: fog-arm-cf
Choose a base branch
from

Conversation

MSSedusch
Copy link

Improvements:

  • add another rescue case to catch all errors and log them
  • add correlation id to logs to be able to map put_block, create_block and delete_block operations

raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

@@ -6,26 +6,36 @@ class Real
def put_blob_block(container_name, blob_name, block_id, data, options = {})
my_options = options.clone
my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

my_options = options.clone

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

msg = "Deleting blob: #{blob_name} in container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

@@ -6,17 +6,23 @@ class Real
def create_block_blob(container_name, blob_name, body, options = {})
my_options = options.clone
my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

raise_azure_exception(ex, msg)
rescue => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if my_options[:fog_correlation_id] != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

@@ -6,16 +6,26 @@ class Real
def commit_blob_blocks(container_name, blob_name, blocks, options = {})
my_options = options.clone
my_options[:request_id] = SecureRandom.uuid
msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{my_options}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@@ -6,26 +6,36 @@ class Real
def put_blob_block(container_name, blob_name, block_id, data, options = {})
my_options = options.clone
my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

msg = "Deleting blob: #{blob_name} in container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

@@ -6,17 +6,23 @@ class Real
def create_block_blob(container_name, blob_name, body, options = {})
my_options = options.clone
my_options[:request_id] = SecureRandom.uuid

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{my_options}"

correlation_id = SecureRandom.uuid
if !my_options[:fog_correlation_id].nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NegatedIf: Favor unless over if for negative conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants