npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-plugin-thundra

v2.6.2

Published

Thundra's serverless plugin for automatic wrapping

Downloads

92

Readme

serverless-plugin-thundra

serverless npm version

Automatically wrap your AWS Lambda functions with Thundra for the serverless framework ⚡️ https://thundra.io

Check out Thundra docs for more information.

Installation

npm install serverless-plugin-thundra

Usage

Thundra's serverless plugin allows you to automatically wrap your Python, Node.js, .NET Core and Java Lambda functions to enable monitoring with Thundra.

Supported Runtimes

| Runtime | Version | |----------------------|------------------------| | Python | 2.7 , 3.6 , 3.7 , 3.8 | | Node.js | 10.x , 12.x | | .NET Core | 2.1 | | Java | 8 , 11 |

Please ensure that along with this library, you also download the respective library of the Thundra agent related to the language in which you are developing.

  • For Thundra's Python agent:
pip3 install thundra -t .
  • For Thundra's Node agent:
npm install @thundra/core --save
  • For Thundra's Java agent, no need to install any Thundra Java dependency as Thundra Java agent comes through layer at runtime (not at build time).

After installing the respective Thundra agent and Thundra's serverless plugin with the npm install serverless-plugin-thundra. Add it to your serverless plugins by including itunder the plugins section of your '.yml' file.

plugins:
  - serverless-plugin-thundra

Ensure that the plugin is the first plugin you add under plugins

Also make sure that you have thundra_apiKey environment variable set to your api key, to see your invocations in the Thundra web console.

Configuration

You can configure Thundra's serverless plugin to disable specific functions, or the whole plugin in general.

Disable Plugin:

You may disable Thundra's serverless plugin by using the disable variable under the thundra component which you added under custom when adding the plugin to your '.yml' file.

custom:
  thundra:
    disable: true

Disable Specific Functions:

You may disable automatic wrapping of specific functions by setting disable to true, under the custom.thundra for the function you want.

functions:
  hello-world-test:
    name: hello-world-test
    handler: index.handler
    custom:
      thundra:
        disable: true

Defining custom node_modules path for functions [Node.js]

By default, plugin searches for @thundra/core package in the following directories, @thundra/core package should be available in at least one of them:

  • Any directory in modules.paths (default search paths used by require)
  • <directory that contains handler file for a specific function>/node_modules
  • The directory that is given as follows:

Globally

custom:
  thundra:
    node_modules_path: <directory that contains @thundra/core>

Or per function:

functions:
  hello-world-test:
    name: hello-world-test
    handler: index.handler
    custom:
      thundra:
        node_modules_path: <directory that contains @thundra/core>

Defining custom package.json path [Node.js]

By default, this plugin searches for the package.json file in the root serverless application directory and if the file is found, it ensures that the @thundra/core package is installed. There are repositories that use multiple package.json files and the default one is not the one where the module dependencies are defined (this is particularly common with monorepo directory structures). The package_json_path can be used to specify the directory where to look for the correct package.json file.

This can be defined globally as follows:

custom:
  thundra:
    package_json_path: <directory that contains correct package.json>

Alternatively, this can be overriden using the serverless cli argument --prefix=<directory or the npm_config_prefix environment variable.

Specify Layer version

By default, plugin uses default layer version of the plugin and it might be changed by each version of plugin. But it can be specified by configuration property in the yml file globally and/or function based.

Latest Layer version

Plugin will fetch and set the latest layer version if the version value is set to latest in the configuration above.

Globally:

custom:
  thundra:
    layer:
      version: <layer version of the corresponding agent>

Specify Layer version [Java]

By default, plugin uses default Java layer version of the plugin and it might be changed by each version of plugin. But it can be specified by configuration property in the yml file globally and/or function based.

Globally:

custom:
  thundra:
    java:
      layer:
        version: <layer version of the Java agent>

For per function:

functions:
  hello-world-test:
    name: hello-world-test
    handler: com.mycompany.HelloWorlHandler
    custom:
      thundra:
        java:
          layer:
            version: <layer version of the Java agent>