Package Exports
- serverless-lumigo
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-lumigo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
serverless-lumigo
Serverless framework plugin to auto-install the Lumigo tracer for Node.js and Python functions.
TOC
Install
Run npm install in your Serverless project.
$ npm install --save-dev serverless-lumigo
Add the plugin to your serverless.yml file
plugins:
- serverless-lumigoUsing Lambda Layers
Going forward, this plugin will work the same as the Auto-Trace option in the Lumigo dashboard. This has somes advantage because the plugin doesn't need to modify your upload artifact:
- your upload artifact is smaller in size
- it doesn't interfere with other plugins such as Webpack
For now, this feature has to be explicitly opted-in.
To do so, set useLayers to true (under custom.lumigo).
By default, the plugin would use the latest version of the node/python tracer layer in your region. But you can override that by adding a nodeLayerVersion or pythonLayerVersion attribute.
For example:
provider:
name: aws
runtime: nodejs12.x
custom:
lumigo:
token: <YOUR TOKEN GOES HERE>
useLayers: true
nodeLayerVersion: <OPTIONAL>
pythonLayerVersion: <OPTIONAL>Node.js functions
For Node.js functions, the plugin would install the latest version of the Lumigo tracer for Node.js during serverless package and serverless deploy. It would also wrap your functions as well, so you only need to configure your Lumigo token in a custom section inside the serverless.yml.
For example:
provider:
name: aws
runtime: nodejs12.x
custom:
lumigo:
token: <YOUR TOKEN GOES HERE>
nodePackageManager: <npm or yarn>In case you want to pin the specific tracer version use pinVersion attribute.
For example
provider:
name: aws
runtime: nodejs12.x
custom:
lumigo:
token: <YOUR TOKEN GOES HERE>
pinVersion: 1.31.1In case you want to manage the Lumigo tracer dependency yourself - e.g. you want to use Lerna or Webpack, and can't have this plugin install the Lumigo tracer on your behalf on every deployment - then you can also disable the NPM install process altogether.
provider:
name: aws
runtime: nodejs12.x
custom:
lumigo:
token: <YOUR TOKEN GOES HERE>
skipInstallNodeTracer: true # defaults to falsePython functions
For Python functions, we recommend using the serverless-python-requirements plugin to help you manage your dependencies. You should have the following in your requirements.txt:
lumigo_tracerThis installs the Lumigo tracer for Python, and this plugin would wrap your functions during serverless package and serverless deploy.
You also need to configure the Lumigo token in a custom section in the serverless.yml.
provider:
name: aws
runtime: python3.7
custom:
lumigo:
token: <YOUR TOKEN GOES HERE>In case you are not using requirements.txt to manage your requirements then you can add skipReqCheck and set it to true
custom:
lumigo:
token: 1234
skipReqCheck: trueConfiguration
In order to pass parameters to the tracer, just add them as keys to lumigo custom configuration. For example:
custom:
lumigo:
token: <YOUR TOKEN GOES HERE>
step_function: trueFunction Scope Configuration
You can configure lumigo behavior for individual functions as well -
enabled- Allows one to enable or disable lumigo for specific a specific functionfunctions: foo: lumigo: enabled: false bar: lumigo: enabled: ${self:custom.enabledLumigo}
How to test
- Run
npm run test:all