-
Notifications
You must be signed in to change notification settings - Fork 156
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
Segment from Lambda triggered by SQS is never sampled #570
Comments
Hi @DanielSidhion,
Can you be more specific about how Events are generated in EB? The sampling decision is made at the root of your request, whatever that is, as long as that root has active tracing enabled. So if there is anything upstream of EB that may be injecting the unsampled decision. EB itself does not have active tracing, so it should not be making a sampling decision (neither should SQS). |
Hi @willarmiros, Thank you for the reply. In this particular case, I have the following request path: Both API Gateway and Lambda 1 don't have X-Ray/Active tracing enabled. I just experimented with turning on Active tracing on Lambda 1 and that didn't work either, but enabling X-Ray on API Gateway AND enabling Active tracing on Lambda 1 finally makes Lambda 2 get a sampled segment. This was a bit unexpected, since it looks like I'll have to enable X-Ray along the whole chain just so I can get insights on Lambda 2 (which is the thing I'm most interested in). Is there no way to work around this? I can enable X-Ray on everything, but I'm curious whether this is forcing a specific workflow or if there's a way to work around it using the X-Ray SDK. An interesting behaviour is that the ADOT layer seems to basically ignore the unsampled segment and just generates its own in that case. I haven't tested the ADOT layer with the sampled segment yet, but I'll experiment to see how it goes. |
That is surprising that enabling it on Lambda 1 did not start to introduce sampled segments. For context, it is a known issue that Lambda functions will generate
Can you clarify what you mean here? Are you saying if there is To summarize, it seems like there are 2 possible issues:
|
Hey folks, I've been scratching my head against this one for a while, I created this issue hoping that someone can help figure out what's going on.
I have a Lambda function with an alias, and the alias can be triggered by SQS. Events are coming in from EventBridge and routed to SQS. The function has Active tracing enabled.
When the function gets triggered by SQS, I see the following in my logs (values from one specific run are shown below, but this is consistent behaviour on every attempt):
Note how both of those segments are not sampled (the one from SQS and the one Lambda creates). I've tried recreating the whole infrastructure (SQS queues, EventBridge triggers, Lambda function, IAM roles) from scratch, and I tried disabling Active tracing and re-enabling it, but this behaviour keeps happening. The sample policy I'm using is the default one, and the Lambda was invoked only to test this, which means it was definitely within the policy of 1 sample per second.
However, if I manually invoke the Lambda function (with the same message it gets from SQS, no changes at all, including the unsampled
AWSTraceHeader
), then it creates a sampled segment (as expected!). Note that this is a manual invocation of the Lambda, it isn't being triggered by SQS this time:And it properly flushes the subsegments, and I can see them in the X-Ray console:
Does anyone know why apparently the Lambda function is never sampled when invoked through the SQS trigger? I noticed you folks have recently worked on an SQS->Lambda and SNS->SQS->Lambda trace continuation features (congrats btw! I'm definitely going to make use of them), so I'm wondering if something along the way changed and broke this scenario I'm describing?
The text was updated successfully, but these errors were encountered: