(This post has been updated to reflect the release of native support for SQS in Lambda in July 2018)
I like SQS. It’s one of my favorite AWS services. It’s got a clear purpose, it handles unexpected errors well with a decent config and dead letter queues, and the API is simple enough.
We use currently us SQS for 2 systems at IOpipe:
Our weekly email pipeline, which you can see a snippet of our own production version below (yes we run lots of lambda too!)
Since we launched IOpipe alerts nearly 7 months ago, we’ve seen how powerful they can be as a first line of defense against erroring, slow, or runaway lambda functions. We’ve triaged several incidents internally where we were dogfooding our own product (surprisingly easy). So after you launch a new function in your environment, ensure it’s covered by an alert!
Let’s go over the current alert methods and how they have helped:
This one is pretty easy. If a function has errors, you probably don’t want that. And you’re probably going to want to know when that happens. Alerting on the number of errors within a time window is a simple, effective method to get eyes on a potential issue. Is a dependent service down? Did the team deploy a syntax error (try eslint for js)? …
Update: performance landed in the nodejs core! (version 9+)
So you’ve got a code path that you think might be running a little slowly — perhaps it’s a database call, or maybe a fun imagemagick transform. How do you instrument this event to observe and iterate on solutions to reduce latency?
Besides a more heavy-handed solution such as a profiling agent, the answer you might come up with is to simply log some high-resolution time metrics. Or to be direct:
process.hrtime. Let’s take a look:
While you could use
Date.now() in a similar fashion,
process.hrtime is built expressly for these types of use cases. …
At IOpipe, we are striving to provide a comprehensive application insight platform built from the ground up for serverless architectures. Abstracting away a nice chunk of operational concerns with serverless is great, but there are still core observability measures that can help your team tune and troubleshoot quickly.
Enter tracing. While there are conflicting thoughts on exactly what tracing is, we’ve appropriated the term to mean: measures for the app events you care about.
This a screenshot from the IOpipe Dashboard of a lambda function in our own production environment. It’s actually a lambda that runs a rule engine to determine if you should be alerted for your special function. …
The Serverless Framework is an indispensable tool for Lambda, OpenWhisk, and Azure functions-as-service development and deployment. Once you get the hang of launching functions with it, the sky’s the limit. But when you have 10 or 100 functions, you might want to abstract your build pipeline further to include your favorite tooling + processes. There are plenty of powerful plugins already.
So to enable even easier integration with IOpipe, we made a plugin too.
The task of code modification shouldn’t be taken lightly — and luckily we don’t have to reinvent the wheel here. We can use an AST parser and builder to do the hard work for us. With the rise of varied JS build tools, AST libraries are certainly en vogue and we have plenty of options. …