Skip to content
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

Add aws.requestId to Log Message if the lambda_request_id is found #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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 src/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ def _package_log_payload(data):
log_message["attributes"]["aws"][
"lambda_request_id"
] = lambda_request_id
log_message["attributes"]["aws"]["requestId"] = lambda_request_id

log_messages.append(log_message)

Expand Down
5 changes: 5 additions & 0 deletions test/log_ingestion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,19 @@ def test_lambda_request_ids_are_extracted(mock_aio_post):
assert len(messages) == 5
assert messages[0]["timestamp"] == timestamp
assert messages[0]["attributes"]["aws"]["lambda_request_id"] == expected_request_id
assert messages[0]["attributes"]["aws"]["requestId"] == expected_request_id
assert messages[1]["timestamp"] == timestamp
assert messages[1]["attributes"]["aws"]["lambda_request_id"] == expected_request_id
assert messages[1]["attributes"]["aws"]["requestId"] == expected_request_id
assert messages[2]["timestamp"] == timestamp
assert messages[2]["attributes"]["aws"]["lambda_request_id"] == expected_request_id
assert messages[2]["attributes"]["aws"]["requestId"] == expected_request_id
assert messages[3]["timestamp"] == timestamp
assert messages[3]["attributes"]["aws"]["lambda_request_id"] == expected_request_id
assert messages[3]["attributes"]["aws"]["requestId"] == expected_request_id
assert messages[4]["timestamp"] == timestamp
assert messages[4]["attributes"]["aws"]["lambda_request_id"] == expected_request_id2
assert messages[4]["attributes"]["aws"]["requestId"] == expected_request_id2


def aio_post_response():
Expand Down
Loading