The combination of SNS to SQS to Lambda is a common sight in serverless applications on AWS. Perhaps triggered by messages from an API function.
This architecture is great for improving UX by offloading slow, asynchronous tasks so the API can stay responsive.
It presents an interesting challenge for observability, however. Because observability tools are not able to trace invocations through this combination end-to-end.
In X-Ray, for example, the trace would stop at SNS.
X-Ray would capture the 2nd half of this transaction but as a separate trace. Which is not at all helpful when trying to understand the end-to-end behaviour of your application.
And considering the aggressive sampling (5% of all transactions over 1 req/s) employed by X-Ray, there’s actually a good chance that you won’t have both halves of this transaction in X-Ray at all.
This problem is not limited to X-Ray.
Lumigo recently rolled out a new feature to their platform and added support for this combination.
You can now see transactions involving SNS and SQS end-to-end.
You can click on any of the icons in this transaction to learn more.
For example, I can click on the SNS icon to see the request and response from the SNS
Similarly, I can click on the SQS and Lambda icons to learn more about this transaction.
What invocation event did the Lambda function receive?
What was the return value from the function?
What environment variables were used in this invocation?
What did the function log during the invocation?
These give me a good insight into the state of my application during this transaction. And the great thing about Lumigo is that I get all these out-of-the-box with no need for manual instrumentation!
Whereas the combination of SNS to SQS to Lambda was a blind spot for many AWS developers. This exciting new feature in Lumigo finally pierces through the veil and shines a light on the problem.
If you wanna give it try, go to lumigo.io and sign up for a free account. It takes five minutes to get started and I hope it’s as much a game-changer for your development experience as it has been for me.