-
Notifications
You must be signed in to change notification settings - Fork 609
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
refactor: avoid exception when lambda_handler envs not present in aws-lambda instrumentation #2750
Merged
lzchen
merged 14 commits into
open-telemetry:main
from
Ronald-TR:refactor/missing_lambda_handler_in_aws_lambda_raises_exception
Jul 30, 2024
Merged
refactor: avoid exception when lambda_handler envs not present in aws-lambda instrumentation #2750
lzchen
merged 14 commits into
open-telemetry:main
from
Ronald-TR:refactor/missing_lambda_handler_in_aws_lambda_raises_exception
Jul 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…-lambda instrumentation
Ronald-TR
force-pushed
the
refactor/missing_lambda_handler_in_aws_lambda_raises_exception
branch
from
July 29, 2024 15:16
aac8922
to
7a8b084
Compare
xrmx
reviewed
Jul 29, 2024
...elemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py
Outdated
Show resolved
Hide resolved
Quick example: import requests
requests.get("https://httpbin.org/robots.txt") Installs: pip install --upgrade pip
pip install opentelemetry-distro
pip install requests
opentelemetry-bootstrap -a install Run opentelemetry-instrument --traces_exporter console --metrics_exporter console --service_name test python example.py |
…ning outside a lambda
…a_raises_exception
Ronald-TR
changed the title
refactor: raise exception when lambda_handler envs not present in aws-lambda instrumentation
refactor: avoid exception when lambda_handler envs not present in aws-lambda instrumentation
Jul 29, 2024
…ception' of github.com:Ronald-TR/opentelemetry-python-contrib into refactor/missing_lambda_handler_in_aws_lambda_raises_exception
emdneto
reviewed
Jul 29, 2024
...elemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py
Outdated
Show resolved
Hide resolved
emdneto
reviewed
Jul 30, 2024
Co-authored-by: Emídio Neto <[email protected]>
xrmx
reviewed
Jul 30, 2024
...elemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py
Outdated
Show resolved
Hide resolved
xrmx
approved these changes
Jul 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the text updated to give an hint on how to fix things
…pentelemetry/instrumentation/aws_lambda/__init__.py Co-authored-by: Riccardo Magliocchetti <[email protected]>
…a_raises_exception
emdneto
approved these changes
Jul 30, 2024
…a_raises_exception
tammy-baylis-swi
approved these changes
Jul 30, 2024
mlorenzana
reviewed
Jul 30, 2024
...elemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This small refactor explains what happens when the aws-lambda instrumentation fails during
_instrument()
method, the exception occurs when the environment variables ORIG_HANDLER and _HANDLER doesn't exists, probably because the instrumentation is running outside an aws lambda.Otherwise, this doesn't fix the original issue:
opentelemetry-instrumentation-aws-lambda
is installed by default duringopentelemetry-bootstrap -a install
, that is the reason why the original issue happens.The PR just brings more clarity for this error.
Fixes #2744
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.