Setting Up AWS Distro for OpenTelemetry with Container-Based Lambda Functions and New Relic
Blog post from New Relic
AWS Distro for OpenTelemetry (ADOT) facilitates observability in serverless environments by providing a vendor-neutral method to collect and export telemetry, using OpenTelemetry APIs without locking into a specific backend. The traditional use of Lambda Layers for deploying ADOT is incompatible with containerized Lambda functions, necessitating an alternative method for integration. The solution involves embedding ADOT directly into the container image via a multi-stage Docker build, allowing telemetry data to be exported to New Relic. This process leverages the advantages of container images, such as larger package sizes, consistent CI/CD tooling, and control over runtime dependencies, while addressing the challenge of bypassing AWS's mechanism for injecting layer content. The approach involves downloading and extracting ADOT layer content during the Docker build, configuring the Serverless Application Model (SAM) template for environment variables, and integrating custom metrics and instrumentation for enhanced observability in New Relic. The guide highlights the benefits of combining container deployments with OpenTelemetry for deep, actionable telemetry, despite some operational overhead like cold starts and memory usage, and encourages developers to explore this integration further with resources provided.