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

fix(lambda): add instrument handler option to adotInstrumentation to support python lambda functions #26040

Merged
merged 28 commits into from
Jul 10, 2023

Conversation

randyridgley
Copy link
Contributor

Small change to add an enum value to AdotLambdaExecWrapper. The python layer for adot requires the path '/opt/otel-instrument' which differs from the layer needed for other languages which is '/opt/otel-handler'. In the link below in the section Enable auto-instrumentation for your Lambda function step 5 requires the '/opt/otel-instrument' path. The existing work around is to provide a lambda layer yourself and the appropriate env variable for AWS_LAMBDA_EXEC_WRAPPER without using the adotInstrumentation parameters. This fix simplifies dev requirements.

Python Lambda Otel

Closes #24666.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Jun 19, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team June 19, 2023 14:32
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Jun 19, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@randyridgley randyridgley changed the title feat(lambda): add instrument handler option to adotInstrumentation to support python lambda functions fix(lambda): add instrument handler option to adotInstrumentation to support python lambda functions Jun 19, 2023
@randyridgley
Copy link
Contributor Author

I need clarification. The aws-lambda README has a section on Adot Integration Tests but the file does not exist. I'm also not sure if an integration test is required on this update based on the nature of the change. If this all looks good I would ask for an Exemption Request for this PR. Please advise.

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Jun 19, 2023
@gitpod-io
Copy link

gitpod-io bot commented Jun 21, 2023

@randyridgley
Copy link
Contributor Author

I decided to add an integration test and updated the README but for the life of me cannot run the integration test locally. Can someone help me understand what the command would be to build up the integration testing runner and how to run it. Do integration tests belong in @aws-cdk-testing/framework-integ or in the packages/aws-cdk-lib/aws-lambda/test directory? I see integ.X in both places.

@aws-cdk-automation aws-cdk-automation dismissed their stale review June 28, 2023 19:28

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@corymhall corymhall removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 30, 2023
@corymhall corymhall self-assigned this Jun 30, 2023
@mergify mergify bot dismissed corymhall’s stale review June 30, 2023 13:09

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 30, 2023
… SDK EXEC_WRAPPER is using the INSTRUMENT_HANDLER enum value
… SDK EXEC_WRAPPER is using the INSTRUMENT_HANDLER enum value
… lambda functions when using Adot to force INSTRUMENT_HANDLER or throw error
…sing PYTHON and Adot layers. This is a destructive change as it will result in a destroy and recreate, but the side effect is that if anyone is already trying to use Python in Lambda and Adot with any handler that is not INSTRUMENT_HANDLER the layer doesn't work so no one should be impacted by this destructive change
corymhall
corymhall previously approved these changes Jul 6, 2023
@mergify
Copy link
Contributor

mergify bot commented Jul 6, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed corymhall’s stale review July 6, 2023 15:32

Pull request has been modified.

corymhall
corymhall previously approved these changes Jul 6, 2023
@mergify mergify bot dismissed corymhall’s stale review July 7, 2023 13:29

Pull request has been modified.

@randyridgley
Copy link
Contributor Author

I had to kick off the code build project again cause it was failing in an area I didn't touch. I reviewed the failure and couldn't see exactly why it was failing. Updating the branch fixed the codebuild failure.

@mergify
Copy link
Contributor

mergify bot commented Jul 10, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 3924e46
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit bd06669 into aws:main Jul 10, 2023
5 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jul 10, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

bmoffatt pushed a commit to bmoffatt/aws-cdk that referenced this pull request Jul 29, 2023
…support python lambda functions (aws#26040)

Small change to add an enum value to AdotLambdaExecWrapper. The python layer for adot requires the path *'/opt/otel-instrument'* which differs from the layer needed for other languages which is *'/opt/otel-handler'*. In the link below in the section **Enable auto-instrumentation for your Lambda function** step 5 requires the *'/opt/otel-instrument'* path. The existing work around is to provide a lambda layer yourself and the appropriate env variable for *AWS_LAMBDA_EXEC_WRAPPER* without using the adotInstrumentation parameters. This fix simplifies dev requirements.

[Python Lambda Otel](https://aws-otel.github.io/docs/getting-started/lambda/lambda-python)

Closes aws#24666.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lambda: AdotLambdaExecWrapper is incorrect for Python
3 participants