diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index e71c2450c0..1103152a13 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -38,6 +38,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh - The `UnraisableHookIntegration` is now enabled by default. - We now don't suppress chained exceptions in the ASGI and asyncio integrations by default. The related `suppress_asgi_chained_exceptions` experimental option was removed. - In the AWS Lambda and GCP integrations, the text of the message of the warning the SDK optionally emits if a function is about to time out has changed. +- The AWS Lambda integration no longer sets the `messaging.batch.message_count` attribute on the function span. In 2.x span streaming mode, it was the length of the event if the event was a list, and `1` otherwise, so an SQS or SNS batch was always reported as `1`. The attribute is now only set on messaging spans, such as boto3 SQS and SNS spans. - The `http.request.header.` span attributes set by server integrations are now lists of strings instead of strings. - The HTTP breadcrumbs created by the stdlib (`http.client`) and boto3 integrations now use different keys: `http.method` is now `http.request.method`, `url` (or `aws.request.url` for boto3) is now `url.full`, `http.query` is now `url.query`, and `http.fragment` is now `url.fragment`. The stdlib breadcrumb no longer contains `reason`. The query string is filtered according to `data_collection`'s `url_query_params` setting. - The `url` field of HTTP breadcrumbs created by the HTTPX, httpx2, pyreqwest, and AIOHTTP client integrations now contains the full URL, including the query string and fragment. The query string is filtered according to `data_collection`'s `url_query_params` setting. diff --git a/sentry_sdk/integrations/aws_lambda/_handler.py b/sentry_sdk/integrations/aws_lambda/_handler.py index 89ba0089b7..7a825bed28 100644 --- a/sentry_sdk/integrations/aws_lambda/_handler.py +++ b/sentry_sdk/integrations/aws_lambda/_handler.py @@ -64,10 +64,8 @@ def sentry_handler( if isinstance(aws_event, list) and len(aws_event) >= 1: request_data = aws_event[0] - batch_size = len(aws_event) else: request_data = aws_event - batch_size = 1 if not isinstance(request_data, dict): # If we're not dealing with a dictionary, we won't be able to get @@ -160,7 +158,6 @@ def sentry_handler( SPANDATA.SENTRY_SEGMENT_NAME_SOURCE: SegmentNameSource.COMPONENT, SPANDATA.CLOUD_PROVIDER: CLOUD_PROVIDER, SPANDATA.CLOUD_PLATFORM: CLOUD_PLATFORM, - SPANDATA.MESSAGING_BATCH_MESSAGE_COUNT: batch_size, **header_attributes, **additional_attributes, } diff --git a/tests/integrations/aws_lambda/test_aws_lambda.py b/tests/integrations/aws_lambda/test_aws_lambda.py index 2d7712b2d2..4d0b7bbce5 100644 --- a/tests/integrations/aws_lambda/test_aws_lambda.py +++ b/tests/integrations/aws_lambda/test_aws_lambda.py @@ -159,12 +159,12 @@ def test_timeout_error_scope_modified(lambda_client, test_environment): @pytest.mark.parametrize( - "aws_event, has_request_data, batch_size", + "aws_event, has_request_data", [ - (b"1231", False, 1), - (b"11.21", False, 1), - (b'"Good dog!"', False, 1), - (b"true", False, 1), + (b"1231", False), + (b"11.21", False), + (b'"Good dog!"', False), + (b"true", False), ( b""" [ @@ -175,7 +175,6 @@ def test_timeout_error_scope_modified(lambda_client, test_environment): ] """, False, - 4, ), ( b""" @@ -207,9 +206,8 @@ def test_timeout_error_scope_modified(lambda_client, test_environment): ] """, True, - 2, ), - (b"[]", False, 1), + (b"[]", False), ], ids=[ "event as integer", @@ -221,9 +219,7 @@ def test_timeout_error_scope_modified(lambda_client, test_environment): "event as empty list", ], ) -def test_non_dict_event( - lambda_client, test_environment, aws_event, has_request_data, batch_size -): +def test_non_dict_event(lambda_client, test_environment, aws_event, has_request_data): lambda_client.invoke( FunctionName="BasicException", Payload=aws_event, @@ -756,7 +752,6 @@ def test_no_error(lambda_client, test_environment): assert _get_span_attr(attrs, SPANDATA.AWS_LOG_STREAM_NAMES) == [ LATEST_FUNCTION_VERSION ] - assert _get_span_attr(attrs, SPANDATA.MESSAGING_BATCH_MESSAGE_COUNT) == 1 def test_error(lambda_client, test_environment): @@ -810,7 +805,6 @@ def test_error(lambda_client, test_environment): assert _get_span_attr(attrs, SPANDATA.AWS_LOG_STREAM_NAMES) == [ LATEST_FUNCTION_VERSION ] - assert _get_span_attr(attrs, SPANDATA.MESSAGING_BATCH_MESSAGE_COUNT) == 1 def test_trace_continuation(lambda_client, test_environment):