Replies: 2 comments 8 replies
-
Hey @Dunedan, Great to hear from you again. We do this currently for when your function is being executed locally by SAM CLI or Chalice - no code change. We could totally do that in v2 as it makes sense to me too, since changing now it'd be breaking change. How are you running it locally today? |
Beta Was this translation helpful? Give feedback.
-
cc @pankajagrawal16 @saragerion @t1agob, what do you reckon on disabling Tracer when not running in Lambda, by default? For context, Python disables Tracer when code is run within SAM CLI as well as Chalice. I was concerned about disabling it by default and cause customers tests to fail, but seems more the other way around. In hindsight, the first implementation assumed customers might in the future run their code with X-Ray Daemon running locally[1], and that SAM or any other framework would handle that natively one day. Over a year has passed and I haven't seen that yet but largely unit tests. Which means this might not be a breaking change after all, and simplify running their code locally whether use SAM/Chalice or not. [1] Running X-Ray Daemon locally with Lambda Run as a docker container, listen on default 2000 UDP port that X-Ray SDK will try to attach to docker run \
--attach STDOUT \
-v ~/.aws:/root/.aws/:ro \
--net=host \
-e AWS_REGION=eu-west-1 \
--name xray-daemon \
-p 2000:2000/udp \
amazon/aws-xray-daemon -o From here, you need to create any segment and all code will work, though no traces will be sent to AWS X-Ray service due to |
Beta Was this translation helpful? Give feedback.
-
I find the behavior of the Tracer (or aws-xray-sdk to the same extend) when not running on AWS Lambda quite annoying. In this case I don't want to have tracing enabled, because there is no active segment anyway, so unless one explicitly creates a segment before, there'll always be an
SegmentNotFoundException
being thrown. Currently one has to explicitly disable tracing by either setting an environment variable (POWERTOOLS_TRACE_DISABLED
) or by initializing the tracer withTracer(disabled=True)
. I'd prefer if tracing would by default only be enabled when actually running on AWS Lambda.My desired behavior can currently be achieved with something like the following, but having the same behavior out-of-the-box without additional code would be quite nice.
Is that something AWS Lambda Powertools could do by default?
Beta Was this translation helpful? Give feedback.
All reactions