-
Notifications
You must be signed in to change notification settings - Fork 534
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
feat(instrumentation-aws-lambda): Adds lambdaHandler config option #1627
Conversation
cc @carolabadeer (Component Owner) |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1627 +/- ##
==========================================
- Coverage 91.78% 91.77% -0.02%
==========================================
Files 139 139
Lines 7110 7112 +2
Branches 1426 1427 +1
==========================================
+ Hits 6526 6527 +1
- Misses 584 585 +1
|
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.
Thanks for the great research and for adding this feature
plugins/node/opentelemetry-instrumentation-aws-lambda/README.md
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-aws-lambda/src/types.ts
Outdated
Show resolved
Hide resolved
6976ae5
to
06788e2
Compare
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.
Thanks for addressing the comments 💯
Left a few nit suggestions
plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
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
Will merge after @carolabadeer review as component owner |
@schmalzs seems that lint is failing in CI. |
Co-authored-by: Amir Blum <[email protected]>
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.
plugins/node/opentelemetry-instrumentation-aws-lambda/README.md
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-aws-lambda/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Carol Abadeer <[email protected]>
Thank you for your thoughtful review, @carolabadeer! I just made the updates you suggested. Please let me know what you think. Thanks! |
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
Which problem is this PR solving?
This PR is scoped to the
@opentelemetry/instrumentation-aws-lambda
package.Currently, the AWS Lambda instrumentation uses the
_HANDLER
environment variable to determine which module to instrument. The_HANDLER
environment variable is set by AWS itself and, for most use cases, will accurately represent the handler that should be targeted by this instrumentation.There exist use cases where the
_HANDLER
environment variable does not accurately represent the module that should be targeted by this instrumentation.Specifically, I have Lambdas that are integrated with Datadog. The Datadog integration injects itself into the Lambda runtime by overriding the
_HANDLER
environment variable. It points the_HANDLER
to Datadog code (loaded via a Lambda Layer). That Datadog code acts as a proxy that wraps my actual Lambda handler code.When attempting to use this instrumentation alongside the Datadog integration, the instrumentation does not work. It ends up targeting the Datadog code (due to the value of the
_HANDLER
environment variable) rather than my actual Lambda code.My particular use case is specific to utilizing this instrumentation alongside Datadog, however, I imagine there are other use cases that would run into similar problems.
Short description of the changes
This PR adds an optional
handler
config option. This option accepts a string that can be used to manually specify the handler that the instrumentation should target. If thehandler
option is omitted, the default behavior will be to use the_HANDLER
environment variable, as it does today.I have tested this alongside the Datadog integration and have confirmed it works as expected.