Skip to content

Commit e8ded65

Browse files
authored
Change Lambda timeout warning message (#4671)
The timeout in the AWS Lambda (and GCP, by extension) timeout warning is wrong, remove it and slightly rephrase. This is on `potel-base` since it breaks grouping. (Even just removing the number from the original message, without modifying it further, causes regrouping. Since that's the case I took the liberty to update the message a bit more.) Fixes #4629
1 parent 893d9fb commit e8ded65

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

MIGRATION_GUIDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
5858
- `enable_logs` and `before_send_log` are now regular SDK options. Their original versions under `_experiments` have been removed.
5959

6060
#### Integrations
61+
62+
- AWS Lambda, GCP: The message of the warning the SDK optionally emits if a function is about to time out has changed.
6163
- Redis: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).
6264
- clickhouse-driver: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
6365
- Logging: By default, the SDK won't capture Sentry issues anymore when calling `logging.error()`, `logging.critical()` or `logging.exception()`. If you want to preserve the old behavior use `sentry_sdk.init(integrations=[LoggingIntegration(event_level="ERROR")])`.

sentry_sdk/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,11 +1424,7 @@ def run(self) -> None:
14241424
integer_configured_timeout = integer_configured_timeout + 1
14251425

14261426
# Raising Exception after timeout duration is reached
1427-
raise ServerlessTimeoutWarning(
1428-
"WARNING : Function is expected to get timed out. Configured timeout duration = {} seconds.".format(
1429-
integer_configured_timeout
1430-
)
1431-
)
1427+
raise ServerlessTimeoutWarning("WARNING: Function is about to time out.")
14321428

14331429

14341430
def to_base64(original: str) -> Optional[str]:

tests/integrations/aws_lambda/test_aws_lambda.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ def test_timeout_error(lambda_client, test_environment):
216216
(exception,) = error_event["exception"]["values"]
217217
assert not exception["mechanism"]["handled"]
218218
assert exception["type"] == "ServerlessTimeoutWarning"
219-
assert exception["value"].startswith(
220-
"WARNING : Function is expected to get timed out. Configured timeout duration ="
221-
)
219+
assert exception["value"] == "WARNING: Function is about to time out."
222220
assert exception["mechanism"]["type"] == "threading"
223221

224222

tests/integrations/gcp/test_gcp.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ def cloud_function(functionhandler, event):
212212
(exception,) = envelope_items[0]["exception"]["values"]
213213

214214
assert exception["type"] == "ServerlessTimeoutWarning"
215-
assert (
216-
exception["value"]
217-
== "WARNING : Function is expected to get timed out. Configured timeout duration = 3 seconds."
218-
)
215+
assert exception["value"] == "WARNING: Function is about to time out."
219216
assert exception["mechanism"]["type"] == "threading"
220217
assert not exception["mechanism"]["handled"]
221218

0 commit comments

Comments
 (0)