Elven Serverless Plugin
The Elven Serverless Plugin simplifies the automatic instrumentation of your AWS Lambda functions in the Serverless Framework, by adding the observability Layer, configuring the environment variables, and preparing your functions to send traces, logs, and metrics to your LGTM stack.
Prerequisites
Node.js 14.x or higher
Serverless Framework installed (
npm install -g serverless)AWS account configured
Access to the Elven Observability dashboard
Installation
Add the plugin to your project.
# with Yarn
yarn add elven-serverless-plugin
# with NPM
npm install elven-serverless-pluginConfiguration in the Serverless Framework
In your serverless.yml (ou .ts, .js) file, add the plugin to the list.
If you are already using other plugins, just add the elven-serverless-plugin alongside them.
Then, configure the plugin in the custom section.
About the values
You can pass the values directly (plain text), for example:
Best practice: use environment variables to avoid exposing sensitive data in the code.
Example of a .env file
How to obtain tenant and token
tenant and tokenGo to https://elvenobservability.com/, log in to your dashboard, and generate the Tenant ID and API Token in the project settings section. If you experience any issues, our support team is ready to help. Reach out through the dashboard or contact your dedicated representative.
What the plugin does automatically
Adds the observability Layer to your Lambda functions.
Configures the necessary environment variables for OpenTelemetry and Loki.
Generates standardized service names in the format:
service_stage_functionNameAllows disabling instrumentation for specific functions:
Deploy
Run the deploy of your service.
Verifying Instrumentation
After the deploy, go to the AWS Console.
Check if the Layer was added to your functions.
Review the environment variables in the Lambda settings.
Run a function and check the traces in the Elven dashboard.
Best practices
Always use environment variables for
token,tenanteendpoint.Set the Layer version in the
elvenPluginto ensure consistency across environments.Name your services and functions clearly to make analysis easier in Grafana and Loki.
Review the injected variables in the function during deploy to ensure everything is correct.
Troubleshooting
Traces or logs are not showing up in Grafana.
Incorrect endpoint or token
Review the values in the environment.
Uninstrumented function
disableOtel: true Applied?
Confirm in the function config.
Lambda with high latency
Collector or Loki unavailable
Test the endpoint and review the timeout.
Missing variable in the function
Override in the function config?
Check the serverless.yml
Complete example
Additional Resources
Need help? Contact our support team through the Elven Observability dashboard or send an email to [email protected].
Last updated
Was this helpful?

