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 support for collecting and sending function logs to APM Server #303

Merged
merged 11 commits into from
Sep 19, 2022

Conversation

lahsivjar
Copy link
Contributor

Adds support for collecting function logs using AWS Logs API and shipping it to APM-Server with collected agent metadata.

Closes: #256

@github-actions github-actions bot added the aws-λ-extension AWS Lambda Extension label Sep 13, 2022
@lahsivjar lahsivjar marked this pull request as draft September 13, 2022 04:16
@apmmachine
Copy link

apmmachine commented Sep 13, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-09-19T03:26:40.652+0000

  • Duration: 5 min 14 sec

Test stats 🧪

Test Results
Failed 0
Passed 164
Skipped 2
Total 166

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@lahsivjar
Copy link
Contributor Author

/test

logsapi/functionlogs.go Outdated Show resolved Hide resolved
@lahsivjar lahsivjar marked this pull request as ready for review September 14, 2022 02:07
logsapi/event.go Show resolved Hide resolved
logsapi/event.go Outdated Show resolved Hide resolved
@lahsivjar lahsivjar requested review from axw and a team and removed request for axw September 14, 2022 05:59
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few nitpicks. Nice work!

main.go Outdated Show resolved Hide resolved
logsapi/option.go Outdated Show resolved Hide resolved
logsapi/event.go Outdated Show resolved Hide resolved
logsapi/event.go Outdated Show resolved Hide resolved
logsapi/functionlogs.go Show resolved Hide resolved
logsapi/functionlogs.go Outdated Show resolved Hide resolved
@lahsivjar
Copy link
Contributor Author

@axw Apologies for the force push 🙇

This is the commit added for addressing the review comments.

Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for the updates :)

@lahsivjar lahsivjar deleted the 256_collect_lambda_logs branch September 19, 2022 03:42
@kruskall kruskall self-assigned this Sep 27, 2022
@kruskall
Copy link
Member

Tested with BC2 (and 8.6.0-SNAPSHOT) by provisioning the environment with the terraform script (SKIP_DESTROY=1 has been used to inspect the cluster) with TF_VAR_ess_version=8.5.0-SNAPSHOT.

Verified that the logs are visible in the logs tab in the Observability section.

Made sure that ELASTIC_APM_LAMBDA_CAPTURE_LOGS=false disables logs collection.

Possible concern: #322
I don't think the above issue is a blocker according to the definition of a blocker so I'm going to label this PR as test-plan-ok

@RyanHealey1307
Copy link

I'm aware this is still experimental, but some feedback...
I've tested this for a python lambda, using the latest APM layer, and when you invocate the function, the logs don't go through to APM until the next invocation. Eg, if my lambda is run at 10:09 and then again at 10:13, the logs from 10:09 are not visible until next next invocation at 10:13. My timeout is set to 5 mins and it's a very simple function, so I can't be a timeout issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-λ-extension AWS Lambda Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect Lambda Logs (POC)
6 participants