-
Notifications
You must be signed in to change notification settings - Fork 420
Streamline integration of SQS Batch Processing with Sentry #293
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
Comments
I was actually pretty simple, although it would still be nice to have a no-code integration: from aws_lambda_powertools.utilities.batch import PartialSQSProcessor
from sentry_sdk import capture_exception
class SQSProcessor(PartialSQSProcessor):
def failure_handler(self, record: Event, exception: Tuple) -> Tuple: # type: ignore
capture_exception()
logger.exception("got exception while processing SQS message")
return super().failure_handler(record, exception) # type: ignore Btw: I took the existing types, |
Hi @charlax, thanks for raising an issue! The functionality surrounding the
I think the solution you've found is a good one, arguably cleaner than passing hooks/callbacks around. We could always add something to the docs for folks wanting to implement similar logic, do you think that would help? |
Yes, this was actually very simple with the |
Yes, this is great! Thanks a lot! |
This is now available in 1.11.0 - Literally just launched ;) 🎉 |
Is your feature request related to a problem? Please describe.
The current behavior reraises exception as
SQSBatchProcessingError
, which hides the original exception and prevents it from showing up correctly in Sentry:Describe the solution you'd like
The best solution would be to be compatible by default with Sentry if it's there (I presume this is one of the most used exception reporting solutions for Python).
Another solution would be to provide a hook into the exception handler, to give us the opportunity to call Sentry.
Describe alternatives you've considered
I looked into subclassing
PartialSQSProcessor
and overriding_process_record
, which is what I might do if you don't think that's worth looking into.The text was updated successfully, but these errors were encountered: