refactor: avoid exception when lambda_handler envs not present in aws-lambda instrumentation#2750
Merged
lzchen merged 14 commits intoopen-telemetry:mainfrom Jul 30, 2024
Conversation
…-lambda instrumentation
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
Member
|
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 installRun opentelemetry-instrument --traces_exporter console --metrics_exporter console --service_name test python example.py |
…ning outside a lambda
…a_raises_exception
…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 <9735060+emdneto@users.noreply.github.com>
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
Contributor
xrmx
left a comment
There was a problem hiding this comment.
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 <riccardo.magliocchetti@gmail.com>
…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
xrmx
pushed a commit
to xrmx/opentelemetry-python-contrib
that referenced
this pull request
Jan 24, 2025
…-lambda instrumentation (open-telemetry#2750)
This file contains hidden or 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
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-lambdais 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.