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 @@ -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

Expand Down
16 changes: 2 additions & 14 deletions sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Comment thread
cursor[bot] marked this conversation as resolved.
)
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]":
Expand Down
4 changes: 1 addition & 3 deletions tests/integrations/aws_lambda/test_aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 1 addition & 4 deletions tests/integrations/gcp/test_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
Loading