Open ivanmartos opened 4 years ago
Hi ivanmartos,
We're been slowly filling in the gaps of feature parity between our SDKs. This is absolutely a great little feature we should implement on the Node SDK. We'll be happy to add this on our TODO list and prioritize it accordingly, but feel free to open a PR.
I'm using serverless-offline to test my app locally and having xray blow it up is very inconvenient.
.../backend/node_modules/serverloffline: Failure: Missing AWS Lambda trace data for X-Ray. Expected _X_AMZN_TRACE_ID to be set.
[start:backend] ess-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:199:24)
[start:backend] at LambdaFunction.runHandler (/Users/cyber/dev/jb/jkv2-demo/ts-sls/packages/backend/node_modules/serverless-offline/dist/lambda/LambdaFunction.js:325:20)
[start:backend] at hapiHandler (/Users/cyber/dev/jb/jkv2-demo/ts-sls/packages/backend/node_modules/serverless-offline/dist/events/http/HttpServer.js:521:18)
@revmischa yes we've had several issues for various serverless packages in this regard.
You should be able to use the "AWS_XRAY_CONTEXT_MISSING" environment variable set to "LOG_ERROR" to merely log these missing context issues. https://github.com/aws/aws-xray-sdk-node/tree/master/packages/core#environment-variables
Considering that serverless seems like a core use case for XRay and that this request has been open for over a year, is there an expected ETA to support disabling the XRay SDK entirely for NodeJS? Logging errors is rather a nuisance when it's not actually an error for our application that it cannot send traces, which we don't care about when a dev is doing local testing unrelated to XRay.
Still unresolved in 2021?
Hi @mannharleen Apologies for the delay. We still have it on our backlog and would like to prioritize it as soon as possible. We will update this issue with any progress. Stay tuned. Thanks!
Any updates on this ticket? It will be cool to turn off xray during unit testing. Right now it is not possible and i need to make wrapper for xray library to handle this .
Hi @bordeux,
We still have not been able to prioritize this feature unfortunately, but are always open to PRs.
Alternatively, we have released the AWS Distro for OpenTelemetry JavaScript as a generally available tracing instrumentation SDK with first class support for X-Ray. That SDK is highly configurable and can be put into a no-op mode where it does not emit trace data and consumes minimal system resources.
Still an issue in 2022? In Python, we're able to do this with env var AWS_XRAY_SDK_ENABLED=false
Still an issue in 2022? In Python, we're able to do this with env var
AWS_XRAY_SDK_ENABLED=false
I use this which takes care of it automatically https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/tracer/
any progress? it's really poor developer experience not being able to turn it off during integration and unit tests
2023! @willarmiros ?
2024?
This is a bit silly, the code tested is meant to be the same as the actual code used. And we cannot test it if it won't run.
We're moving to OpenTelemetry. That's one way to turn off X-Ray. I suggest everyone move to that future.
In Python XRay sdk it is possible to turn off XRay via environment variable
AWS_XRAY_SDK_ENABLED
(https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-python-configuration.html)Would it be possible to add this feature also to node SDK? Thanks