From 957cb0a6be1042afd13aea48b944e265e9492d73 Mon Sep 17 00:00:00 2001 From: David Dowie Date: Mon, 6 Nov 2023 16:33:26 -0700 Subject: [PATCH] Add resource name to log --- spec/push/cloudwatch/event_spec.rb | 2 +- spec/subscribe/lambda/function_spec.rb | 4 ++-- subscribe/lambda/function.rb | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/push/cloudwatch/event_spec.rb b/spec/push/cloudwatch/event_spec.rb index 6b67987..cbe8cf7 100644 --- a/spec/push/cloudwatch/event_spec.rb +++ b/spec/push/cloudwatch/event_spec.rb @@ -44,7 +44,7 @@ ) end - it 'raises exception when retry limit exceeded' do + it 'retries method 3 times' do subject.to_loggly! expect(Aws::Lambda::Client).to have_received(:new).exactly(3).times end diff --git a/spec/subscribe/lambda/function_spec.rb b/spec/subscribe/lambda/function_spec.rb index 049945d..0dbafbb 100644 --- a/spec/subscribe/lambda/function_spec.rb +++ b/spec/subscribe/lambda/function_spec.rb @@ -51,7 +51,7 @@ ) end - it 'raises exception when retry limit exceeded' do + it 'retries method 3 times for each function' do described_class.new( arn: 'test', name: 'test', @@ -260,7 +260,7 @@ ) end - it 'raises exception when retry limit exceeded' do + it 'retries method 3 times for each function' do described_class.subscribe_all!(lambda, cloudwatch) expect(cloudwatch).to have_received(:describe_subscription_filters).exactly(6).times end diff --git a/subscribe/lambda/function.rb b/subscribe/lambda/function.rb index e01c19f..5bbf35b 100644 --- a/subscribe/lambda/function.rb +++ b/subscribe/lambda/function.rb @@ -103,10 +103,10 @@ def fetch_tags! retries ||= 0 lambda.list_tags(resource: arn).tags rescue Aws::Lambda::Errors::ThrottlingException => e - puts "ThrottlingExceptionFetchTags (retry attempt: #{retries}): #{e.inspect}" + puts "ThrottlingExceptionFetchTags (Resource: #{name}): #{e.inspect}" retry if (retries += 1) < 3 - puts 'ThrottlingExceptionFetchTagsRetryLimitExceeded' + puts "ThrottlingExceptionFetchTagsRetryLimitExceeded (Resource: #{name})" [] end @@ -126,10 +126,10 @@ def subscriptions ).subscription_filters end rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e - puts "ThrottlingExceptionSubscriptions (retry attempt: #{retries}): #{e.inspect}" + puts "ThrottlingExceptionSubscriptions (Resource: #{name}): #{e.inspect}" retry if (retries += 1) < 3 - puts 'ThrottlingExceptionSubscriptionsRetryLimitExceeded' + puts "ThrottlingExceptionSubscriptionsRetryLimitExceeded (Resource: #{name})" [] end