ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir
https://hex.pm/packages/ex_aws
MIT License
1.26k stars 521 forks source link

Log QueueUrl for failed SQS requests #884

Closed johnnyt closed 1 year ago

johnnyt commented 2 years ago

Currently when SQS requests fail, a warning is logged out which includes a URL.

[warn] ExAws: HTTP ERROR: :request_timeout for URL: "https://sqs.us-west-2.amazonaws.com/" ATTEMPT: 1

This URL does not include the QueueUrl which, when working with multiple SQS queues, makes it impossible to know which SQS queue is having a problem.

This MR updates this log message when working with the :sqs service to include the QueueUrl instead:

[warn] ExAws: HTTP ERROR: :request_timeout for QUEUE: "https://sqs.us-west-2.amazonaws.com/ACCOUNT_NUMBER/QUEUE_NAME" ATTEMPT: 1

bernardd commented 2 years ago

Hi @johnnyt - thanks for the PR! As it happens, I was just thinking about this exact type of problem over in https://github.com/ex-aws/ex_aws/issues/882#issuecomment-1149519665

The issue is that I don't really want to be jamming all the different error handling for every single service into the main ExAws library - kind of defeats the point of having different service libraries in the first place.

I realise it's a bit more of a task than just sticking an if service == :my_service block in here, but really that's not a sustainable way to deal with the problem. If you're keen, though, I'd definitely welcome (and be happy to help with) a PR implementing the solution mentioned in the comment above.

johnnyt commented 2 years ago

@bernardd - thanks for the feedback. I'll look into that other comment in #882 and the proposed solution there.

bernardd commented 1 year ago

The feature discussed in #882 is now available in version 2.4.0 - please check it out.