add aws-sdk as parameter to xray helper#28
Merged
jagoda merged 4 commits intolifeomic:masterfrom Aug 14, 2018
Merged
Conversation
added 2 commits
August 8, 2018 13:52
add aws-sdk as parameter to xray helper
fix build - linting errors
remove unnecessary function, reorder for tidying up code
mdlavin
suggested changes
Aug 9, 2018
| xray.captureAWS(require('aws-sdk')); | ||
| xray.capturePromise(); | ||
| } | ||
| exports.captureWithXRay = function (awsSdk) { |
Contributor
There was a problem hiding this comment.
Would it be possible to make awsSdk as optional, because I think most times default aws-sdk would be fine.
Contributor
There was a problem hiding this comment.
I think that using the default is actually problematic unless we add a peerDependencies requirement to package.json. If the calling project and lambda-tools do not agree on the aws-sdk version then the caller's SDK instance will not get instrumented and there will not be any warning.
Contributor
|
Good point. I was trying to keep the calling code simple but it might not
be worth the effort to avoid the extra require. Maybe a comment could be
added to the code to explain for future readers
…On Thu, Aug 9, 2018, 9:43 AM Jeffrey Jagoda ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/xray.js
<#28 (comment)>:
> @@ -1,9 +1,7 @@
const xray = require('aws-xray-sdk-core');
-exports.captureWithXRay = () => {
- if (process.env.LAMBDA_TASK_ROOT) {
- xray.captureHTTPsGlobal(require('http'));
- xray.captureAWS(require('aws-sdk'));
- xray.capturePromise();
- }
+exports.captureWithXRay = function (awsSdk) {
I think that using the default is actually problematic unless we add a
peerDependencies requirement to package.json. If the calling project and
lambda-tools do not agree on the aws-sdk version then the caller's SDK
instance will not get instrumented and there will not be any warning.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#28 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGhl-Ex2YE1vhuT3NSYdAYd1dhb43zQks5uPDxqgaJpZM4V0e1E>
.
|
mdlavin
approved these changes
Aug 13, 2018
comment explaining why we pass in client aws-sdk
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.
this will give us the functionality to accommodate the conditional operators encountered in many cases by being able to return a captureAWS object from the aws-sdk