Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<name>` 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.
Expand Down
3 changes: 0 additions & 3 deletions sentry_sdk/integrations/aws_lambda/_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
Expand Down
20 changes: 7 additions & 13 deletions tests/integrations/aws_lambda/test_aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
[
Expand All @@ -175,7 +175,6 @@ def test_timeout_error_scope_modified(lambda_client, test_environment):
]
""",
False,
4,
),
(
b"""
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
Loading