Skip to content

fix: Use UTC time in AWS Lambda integration #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2020
Merged
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
6 changes: 3 additions & 3 deletions sentry_sdk/integrations/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def inner(*args, **kwargs):

def _make_request_event_processor(aws_event, aws_context, configured_timeout):
# type: (Any, Any, Any) -> EventProcessor
start_time = datetime.now()
start_time = datetime.utcnow()

def event_processor(event, hint, start_time=start_time):
# type: (Event, Hint, datetime) -> Optional[Event]
Expand Down Expand Up @@ -318,7 +318,7 @@ def _get_cloudwatch_logs_url(context, start_time):
Returns:
str -- AWS Console URL to logs.
"""
formatstring = "%Y-%m-%dT%H:%M:%S"
formatstring = "%Y-%m-%dT%H:%M:%SZ"

url = (
"https://console.aws.amazon.com/cloudwatch/home?region={region}"
Expand All @@ -329,7 +329,7 @@ def _get_cloudwatch_logs_url(context, start_time):
log_group=context.log_group_name,
log_stream=context.log_stream_name,
start_time=(start_time - timedelta(seconds=1)).strftime(formatstring),
end_time=(datetime.now() + timedelta(seconds=2)).strftime(formatstring),
end_time=(datetime.utcnow() + timedelta(seconds=2)).strftime(formatstring),
)

return url