We are pleased to announce the general availability of the Instana Lambda Extension. Our extension offers modification-free, low latency tracing of Lambda serverless functions backed by our real time Enterprise Observability platform. This work improves upon our existing AWS Lambda tracing to greatly decrease the latency for short lived functions. If you would like to get started now, check out our “Getting Started” documentation or, read on for a history of Lambda Extension mechanisms, Instana’s history of monitoring Lambda, and how the new release lets us deliver an even better monitoring experience for you.
Monitoring Lambda at Instana
Our first attempt at monitoring AWS Lambda was via a set of per language Lambda Layers.
They proved to be a very appealing mechanism to deliver instrumentation. Layers allowed us to offer a simple, two step monitoring process which could be accomplished without making code changes. To get a lambda function monitored with Instana an end user only needed to:
- Add the layer to the target function.
- Set the appropriate environment variables as documented in the installation page.
Once installed, the layer would run in conjunction with the customer code in the following workflow:
On each invocation, the function code would run until the customer written portion has finished and the monitoring vendor has flushed any tracing data needed to their backend.
This workflow was well received across our customer base. It offered a simple way for teams to take advantage of the cost, scalability and performance gains Lambda can bring, all while letting them keep their favorite observability tool. The only downside was the fact that monitoring was sharing the same execution lifetime as the customer provided function code. In some cases, the flushing process could take longer than the customer code needed to run and artificially inflate latency. This was clearly not an optimal experience and needed a change.
Better Lifecycle Management via AWS Lambda Extensions
With the May 20th release of our new Lambda extension, we have decoupled the monitoring process from the “hot path” of customer code. For Lambda functions that have very short lifespans, the extension will offer a marked improvement in responsiveness. Unlike our previous workflow, the extension allows us to shift any time consuming monitoring activities to the background. To better illustrate this, let’s look at a breakdown of the new workflow:
This new workflow operates in three distinct phases:
- The extension starts up and registers itself with the Runtime Extensions API. This registration process allows for our extension to help manage the lifecycle of a Lambda’s execution environment.
- The extension long polls on a HTTP endpoint to signal it is ready to handle a function innovation. Once an invocation is received, it buffers and proxies traffic to our backend. The customer written function code is free to send its response at any time, and our extension will ensure that the data ends up in the backend.
- When notified by the Runtime API, our extension makes sure that any unsent but buffered data makes it to us before the Lambda instance is shutdown.
All together, these changes remove the bottleneck present in the pre-release workflow. There is no longer any waiting on the monitoring to flush data to the backend before a response can be delivered by the customer invoked code.
Until Next Time
Hopefully, this overview of the new release has been helpful. If you haven’t yet, and you’ve made it this far, why not try it for yourself today and start a free trial of Instana?