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

feat:IGNORE_ERROR context missing strategy #345

Merged
merged 1 commit into from
Oct 22, 2020
Merged

Conversation

cheruvian
Copy link
Contributor

Adds a new IGNORE_ERROR context missing strategy, this is especially useful when running Lambda code/libraries locally to not pollute logs with many lines of context missing.

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

@willarmiros willarmiros reopened this Oct 21, 2020
Copy link
Contributor

@willarmiros willarmiros left a comment

Choose a reason for hiding this comment

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

Thanks for the addition!

Comment on lines -149 to +151
assert.notEqual(ContextUtils.contextMissingStrategy.contextMissing, RUNTIME_ERROR_FCN_NAME);
assert.equal(ContextUtils.contextMissingStrategy.contextMissing.name, RUNTIME_ERROR_FCN_NAME);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what was going on in this test before, thanks :)

@willarmiros
Copy link
Contributor

willarmiros commented Oct 22, 2020

The Travis failure is a problem in the Koa patcher and only occurs in Node 15, and it is unrelated to this PR. We should fix the issue in the Koa ASAP to not have these misleading CI failures. Merging because the changes for this PR are not problematic.

@willarmiros willarmiros merged commit 1b81415 into aws:master Oct 22, 2020
@isaacl
Copy link
Contributor

isaacl commented Oct 25, 2020

Nice. For anyone who wants this behavior early, here is a workaround:

  • Set AWS_XRAY_CONTEXT_MISSING to empty string. This is only possible programmatically. For example, with serverless yaml: AWS_XRAY_CONTEXT_MISSING: ''
  • Run xray.setContextMissingStrategy(() => undefined) in your code. This is a NO-OP in lambda unless you do the environment hack above.

@willarmiros
Copy link
Contributor

Thanks for the pointer! The only thing I'd add is with respect to:

Set AWS_XRAY_CONTEXT_MISSING to empty string. This is only possible programmatically

I've verified you can also set the environment variable to no value in the Lambda Console for the same effect, if you're not using any kind of infra-as-code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants