Stackery and Epsagon to Increase Serverless Observability

The primary problem most developers report with using serverless in production is observability. When things start performing poorly or behaving badly, red teams are left digging through logs from dozens of services trying to synthesize information.

For serverless functions (Lambda) on Amazon Web Services (AWS), Epsagon helps you get both a high-level view and details on critical failures. With Stackery, deploying Epsagon as part of your stacks takes just a few minutes.

There are two steps to deploying a lambda with Epsagon

  1. Require the Epsagon SDK
  2. Wrap your handler function

While step 2 is super easy, step 1 is a lot easier with Stackery. The process takes at most 15 minutes.

I’ll start this process with the standard Stackery stack. If you don’t yet have a Stackery account, set it up with these instructions.

Create a serverless application with Stackery

This stack has some basic functionality right out of the box: it serves a welcome page at an endpoint, and makes sure errors experienced by any lambdas in the stack are all logged back to one place.

To add the Epsagon SDK to our stack, all we need to do is add it to our function’s package.json requirements. Start by pulling your Stackery stack down to your local machine. In the left-hand toolbar follow the link to your code repository.

Add your code repository in Stackery

More detailed on working with your code repository are in Stackery’s quick start guide.

In your local shell, navigate to src/[function name] within your repository. Then install the SDK with:

npm install –save epsagon

Now you can modify your basic Lambda code to include the Epsagon SDK and wrap your function.

js

Next – commit your code up to your repository with:

git add . && git commit -m “added Epsagon” && git push

With that, it’s time to go back to the Stackery dashboard and deploy this stack!

The stack is deployed in Stackery

Stackery will note that you’ve updated your repository and prompt you to “refresh” the stack (nothing visual will change since we’re only changing the code underlying one Lambda function)

After hitting prepare deployment and deploy you’ll be taken to the CloudFormation dash where you can execute these changes. If your Lambda is activated frequently you’ll see data within about 20 minutes!

Now that an initial version is set up, gather a lot more information by adding Epsagon’s custom stack to your CloudFormation dashboard.

Gain insights into your application by adding the Epsagon stack

That’s it! Let us know if you have any questions. Have fun using Stackery and Epsagon!