If you're using Serverless Framework infrastructure as a code platform to define and deploy your resources, you can easily add Thundra Layer to your project. See the Node.js, Python, Java and .NET pages for information about some exceptions according to runtime.
Defining Thundra for each function can be a daunting task, which is why we created a Serverless Framework plugin that automatically adds Thundra Layer and instruments all the functions in the .yaml file.
First, download Thundra’s serverless plugin using the npm command as shown below:
npm install serverless-plugin-thundra
After installing Thundra’s serverless plugin, specify it as a plugin for your serverless environment by adding it under the
plugins section of your .yml file:
Add your Thundra API key by setting the
thundra_apiKey environment variable:
You can configure Thundra's serverless plugin to disable specific functions or the whole plugin.
To disable Thundra's serverless plugin, use the
disable variable under the Thundra component, which you added under
custom when adding the
plugin to your '.yml' file:
You may disable Thundra's serverless plugin for some specific function when defining your functions under the
functions:hello-world-test:name: hello-world-testhandler: index.handlercustom:thundra:disable: true
Thundra's Serverless Framework plugin allows you to instrument several functions in one go, and also protect your code base from errors that can occur from manual wrapping. However, you still need to configure other aspects of your monitoring requirements. Thundra has several monitoring capabilities, such as instrumentation, to visualize your entire serverless environment in forms of spans. If you would like to enhance your monitoring experience, you will need to perform further configurations, most of which can be performed via environment variables. This prevents you from injecting configurations within your code base, which are prone to errors if not done correctly.