Accelerating Monitored AWS Lambda Functions with Instana Lambda Extensions

May 24, 2021

Observability Best Practices for AWS Lambda Functions

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:

  1. Add the layer to the target function.
  2. 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:

  1. 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.
  2. 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.
  3. 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?

Play with Instana’s APM Observability Sandbox

Start your FREE TRIAL today!

Instana, an IBM company, provides an Enterprise Observability Platform with automated application monitoring capabilities to businesses operating complex, modern, cloud-native applications no matter where they reside – on-premises or in public and private clouds, including mobile devices or IBM Z.

Control hybrid modern applications with Instana’s AI-powered discovery of deep contextual dependencies inside hybrid applications. Instana also gives visibility into development pipelines to help enable closed-loop DevOps automation.

This provides actionable feedback needed for clients as they to optimize application performance, enable innovation and mitigate risk, helping Dev+Ops add value and efficiency to software delivery pipelines while meeting their service and business level objectives.

For further information, please visit