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

Feature request: disable automatically when running inside fn mocked with Amplify CLI #1007

Closed
dreamorosi opened this issue Jun 23, 2022 · 2 comments · Fixed by #1010
Closed
Assignees
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility good-first-issue Something that is suitable for those who want to start contributing tracer This item relates to the Tracer Utility

Comments

@dreamorosi
Copy link
Contributor

dreamorosi commented Jun 23, 2022

Description of the feature request

Problem statement

Amplify CLI offers a workflow that allows developers to invoke locally a Lambda function during development, this is done by running a command like amplify mock function <function_name> --event <path_to_event_json> - source.

When not running inside the actual AWS Lambda execution environment the Tracer should be disabled by default. This is needed because we cannot know if the X-Ray daemon is running, and in case it's not indeed running the aws-xray-sdk for Node.js will throw an error.

We support this behaviour already for local invocations made with SAM CLI, as discussed here, but we don't support this with Amplify CLI.

Ideally, Tracer should be able to detect it's being invoked inside an Amplify-mocked environment and disable itself.

Summary of the feature

During initialisation of the Tracer instance, check for the presence of an Amplify CLI-specific environment variable (like this one) and if present, disable tracing for said instance.

Code examples

This is the logic that checks for the presence of a SAM CLI-specific environment variable and disables the Tracer if present. The new feature should follow the same exact logic but for Amplify CLI.

Benefits for you and the wider AWS community

Being able to locally mock functions using Amplify CLI and without any code change.

Describe alternatives you've considered

Manually disabling Tracer via environment variable and/or not using Amplify CLI to mock functions that use the tracer.

Additional context

N/A

Related issues, RFCs

N/A

@dreamorosi dreamorosi added triage This item has not been triaged by a maintainer, please wait good-first-issue Something that is suitable for those who want to start contributing tracer This item relates to the Tracer Utility enhancement labels Jun 23, 2022
@dreamorosi
Copy link
Contributor Author

I've marked this as good-first-issue, if anyone wants to pick it up please leave comment below and give a read to the CONTRIBUTING guidelines here.

@dreamorosi dreamorosi self-assigned this Jun 28, 2022
@dreamorosi dreamorosi removed the triage This item has not been triaged by a maintainer, please wait label Jun 28, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@dreamorosi dreamorosi changed the title Feature (tracer): disable automatically when running inside fn mocked with Amplify CLI Feature request: disable automatically when running inside fn mocked with Amplify CLI Nov 14, 2022
@dreamorosi dreamorosi added feature-request This item refers to a feature request for an existing or new utility completed This item is complete and has been merged/shipped labels Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility good-first-issue Something that is suitable for those who want to start contributing tracer This item relates to the Tracer Utility
Projects
None yet
1 participant