You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/utilities/batch.md
+30-26Lines changed: 30 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -769,8 +769,33 @@ Use the context manager to access a list of all returned values from your `recor
769
769
770
770
Use context manager when you want access to the processed messages or handle `BatchProcessingError` exception when all records within the batch fail to be processed.
771
771
772
+
### Integrating exception handling with Sentry.io
773
+
774
+
When using Sentry.io for error monitoring, you can override `failure_handler` to capture each processing exception with Sentry SDK:
775
+
776
+
> Credits to [Charles-Axel Dein](https://github.com/awslabs/aws-lambda-powertools-python/issues/293#issuecomment-781961732)
777
+
778
+
=== "sentry_integration.py"
779
+
780
+
```python hl_lines="4 7-8"
781
+
from typing import Tuple
782
+
783
+
from aws_lambda_powertools.utilities.batch import BatchProcessor, FailureResponse
!!! tip "This is kept for historical purposes. Use the new [BatchProcessor](#processing-messages-from-sqs) instead. "
772
797
773
-
<!--### Customizing boto configuration
798
+
### Customizing boto configuration
774
799
775
800
The **`config`** and **`boto3_session`** parameters enable you to pass in a custom [botocore config object](https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html)
776
801
or a custom [boto3 session](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html) when using the `sqs_batch_processor`
@@ -868,9 +893,9 @@ decorator or `PartialSQSProcessor` class.
868
893
result = processor.process()
869
894
870
895
return result
871
-
```-->
896
+
```
872
897
873
-
<!--### Suppressing exceptions
898
+
### Suppressing exceptions
874
899
875
900
If you want to disable the default behavior where `SQSBatchProcessingError` is raised if there are any errors, you can pass the `suppress_exception` boolean argument.
876
901
@@ -893,9 +918,9 @@ If you want to disable the default behavior where `SQSBatchProcessingError` is r
893
918
894
919
with processor(records, record_handler):
895
920
result = processor.process()
896
-
```-->
921
+
```
897
922
898
-
<!--### Create your own partial processor
923
+
### Create your own partial processor
899
924
900
925
You can create your own partial batch processor by inheriting the `BasePartialProcessor` class, and implementing `_prepare()`, `_clean()` and `_process_record()`.
901
926
@@ -968,24 +993,3 @@ You can then use this class as a context manager, or pass it to `batch_processor
968
993
def lambda_handler(event, context):
969
994
return {"statusCode": 200}
970
995
```
971
-
972
-
### Integrating exception handling with Sentry.io
973
-
974
-
When using Sentry.io for error monitoring, you can override `failure_handler` to include to capture each processing exception:
975
-
976
-
> Credits to [Charles-Axel Dein](https://github.com/awslabs/aws-lambda-powertools-python/issues/293#issuecomment-781961732)
977
-
978
-
=== "sentry_integration.py"
979
-
980
-
```python hl_lines="4 7-8"
981
-
from typing import Tuple
982
-
983
-
from aws_lambda_powertools.utilities.batch import PartialSQSProcessor
0 commit comments