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 logic to instrument AWS Lambda functions using Application Signals #136

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

AsakerMohd
Copy link
Collaborator

@AsakerMohd AsakerMohd commented Nov 9, 2024

Description of changes:
This is a big change that includes multiple important things to support AWS Lambda function instrumentation:

  1. Added our own custom logger: This removes dependency on Microsoft.Extensions.Logging.Console since it's net core specific. This improves the net6 and net8 support.
  2. Added lambda sample app with terraform and a deployment script that builds the lambda layer and deploys it with the app and an API gateway.
  3. The main logic is in the LambdaWrapper.cs. This will be the main entry point as the handler. It will then call the original lambda handler and then calls forceFlush. This ensures that traces are flushed when the Lambda function finishes execution. This also includes updates to the instrument.sh script. When setting the special lambda env var AWS_LAMBDA_EXEC_WRAPPER=/opt/instrument.sh, the lambda runtime executes this script to add OTEL specific env vars to instrument the function.

Testing:
Tested by running the build-and-deploy.sh. This deployed the sample app and the lambda layer. After executing the lambda layer, the traces were visible in both the xray console and the application signals console.

Screenshot 2024-11-12 at 5 46 57 PM

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AsakerMohd AsakerMohd requested a review from a team as a code owner November 9, 2024 00:11
sample-applications/integration-test-app/Dockerfile Outdated Show resolved Hide resolved
instrument.sh Show resolved Hide resolved
instrument.sh Outdated Show resolved Hide resolved
instrument.sh Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants