diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 373881daac..177868ee65 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -23,6 +23,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 message of the warning the SDK optionally emits if a function is about to time out has changed. ## Removed diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index bc1017b7b6..5974266826 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -1427,30 +1427,18 @@ def run(self) -> None: if self._stop_event.is_set(): return - integer_configured_timeout = int(self.configured_timeout) - - # Setting up the exact integer value of configured time(in seconds) - if integer_configured_timeout < self.configured_timeout: - integer_configured_timeout = integer_configured_timeout + 1 - # Raising Exception after timeout duration is reached if self.isolation_scope is not None and self.current_scope is not None: with sentry_sdk.scope.use_isolation_scope(self.isolation_scope): with sentry_sdk.scope.use_scope(self.current_scope): try: raise ServerlessTimeoutWarning( - "WARNING : Function is expected to get timed out. Configured timeout duration = {} seconds.".format( - integer_configured_timeout - ) + "WARNING: Function is about to time out." ) except Exception: reraise(*self._capture_exception()) - raise ServerlessTimeoutWarning( - "WARNING : Function is expected to get timed out. Configured timeout duration = {} seconds.".format( - integer_configured_timeout - ) - ) + raise ServerlessTimeoutWarning("WARNING: Function is about to time out.") def to_base64(original: str) -> "Optional[str]": diff --git a/tests/integrations/aws_lambda/test_aws_lambda.py b/tests/integrations/aws_lambda/test_aws_lambda.py index 02be52e69e..feda53551c 100644 --- a/tests/integrations/aws_lambda/test_aws_lambda.py +++ b/tests/integrations/aws_lambda/test_aws_lambda.py @@ -218,9 +218,7 @@ def test_timeout_error_scope_modified(lambda_client, test_environment): (exception,) = error_event["exception"]["values"] assert not exception["mechanism"]["handled"] assert exception["type"] == "ServerlessTimeoutWarning" - assert exception["value"].startswith( - "WARNING : Function is expected to get timed out. Configured timeout duration =" - ) + assert exception["value"] == "WARNING: Function is about to time out." assert exception["mechanism"]["type"] == "threading" assert error_event["tags"]["custom_tag"] == "custom_value" diff --git a/tests/integrations/gcp/test_gcp.py b/tests/integrations/gcp/test_gcp.py index b02518a413..d18ed02be1 100644 --- a/tests/integrations/gcp/test_gcp.py +++ b/tests/integrations/gcp/test_gcp.py @@ -231,10 +231,7 @@ def cloud_function(functionhandler, event): (exception,) = envelope_items[0]["exception"]["values"] assert exception["type"] == "ServerlessTimeoutWarning" - assert ( - exception["value"] - == "WARNING : Function is expected to get timed out. Configured timeout duration = 3 seconds." - ) + assert exception["value"] == "WARNING: Function is about to time out." assert exception["mechanism"]["type"] == "threading" assert not exception["mechanism"]["handled"]