Skip to content

Commit e204e1a

Browse files
Support China domain in lambda cloudwatch logs url (#1051)
* Support china domain in lambda cloudwatch logs url * Make tests pass * trigger GitHub actions Co-authored-by: Ahmed Etefy <[email protected]>
1 parent e33cf05 commit e204e1a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sentry_sdk/integrations/aws_lambda.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,15 @@ def _get_cloudwatch_logs_url(aws_context, start_time):
400400
str -- AWS Console URL to logs.
401401
"""
402402
formatstring = "%Y-%m-%dT%H:%M:%SZ"
403+
region = environ.get("AWS_REGION", "")
403404

404405
url = (
405-
"https://console.aws.amazon.com/cloudwatch/home?region={region}"
406+
"https://console.{domain}/cloudwatch/home?region={region}"
406407
"#logEventViewer:group={log_group};stream={log_stream}"
407408
";start={start_time};end={end_time}"
408409
).format(
409-
region=environ.get("AWS_REGION"),
410+
domain="amazonaws.cn" if region.startswith("cn-") else "aws.amazon.com",
411+
region=region,
410412
log_group=aws_context.log_group_name,
411413
log_stream=aws_context.log_stream_name,
412414
start_time=(start_time - timedelta(seconds=1)).strftime(formatstring),

0 commit comments

Comments
 (0)