🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

serverless-plugin-datadog

Package Overview
Dependencies
Maintainers
1
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-plugin-datadog

Serverless plugin to automatically instrument python and node functions with datadog tracing

0.16.0
Source
npm
Version published
Weekly downloads
103K
-24.59%
Maintainers
1
Weekly downloads
 
Created
Source

Datadog Serverless Plugin

serverless CircleCI Code Coverage NPM Slack License

This serverless framework plugin automatically instruments your Python and NodeJS Lambda functions with Datadog's native Lambda Layers. You can use this function to collect traces, and custom metrics.

Installation

You can install the plugin with one of the following commands. Keep in mind, you will need to bundle this package with your function manually.

yarn add --dev serverless-plugin-datadog         # Yarn users
npm install --save-dev serverless-plugin-datadog # NPM users

Then in your serverless.yml add the following:

plugins:
  - serverless-plugin-datadog

How it works

This plugin attaches the Datadog Lambda Layers for Node.js and Python to your functions. At deploy time, it generates new handler functions that wrap your existing functions and initializes the Lambda Layers.

Configurations

You can configure the library by add the following section to your serverless.yml:

Datadog Log Forwarder

Default

custom:
  datadog:
    # Whether to add the Lambda Layers, or expect the user to bring their own
    addLayers: true
    # Datadog API Key, only necessary when using metrics without log forwarding
    apiKey: ""
    # Whether the log forwarder integration is enabled by default
    flushMetricsToLogs: false

All Options

custom:
  datadog:
    # Add one of the following variables to override it's default

    # Whether to add the Lambda Layers, or expect the user to bring their own
    addLayers: true

    # Datadog API Key, only necessary when using metrics without log forwarding
    apiKey: ""

    # Datadog API Key encrypted using KMS, only necessary when using metrics without log forwarding
    apiKMSKey: ""

    # Which Site to send to, (should be datadoghq.com or datadoghq.eu)
    site: datadoghq.com

    # The log level, (set to DEBUG for extended logging)
    logLevel: "info"

    # Whether the log forwarder integration is enabled by default
    flushMetricsToLogs: false

FAQ

What if I want to provide my own version of datadog-lambda-layer-js or datadog-lambda-layer-python?

You can use your own version of those libraries by setting 'addLayers' to false in the datadog configuration block. Just make sure to bundle those libaries with your Lambda functions.

How do I use this with serverless-webpack?

Make sure serverless-datadog is above the serverless-webpack entry in your serverless.yml

plugins:
  - serverless-plugin-datadog
  - serverless-webpack

When using serverless webpack, the plugin will assume you are using es6 module format. If that's not the case, you can manually configure nodeModuleType.

custom:
  datadog:
    nodeModuleType: "node" # 'typescript' | 'es6'

If you have the addLayers option enabled, you may also want to add 'datadog-lambda-js' and 'dd-trace' to the externals section of your webpack config.

How do I use this with serverless-typescript?

Make sure serverless-datadog is above the serverless-typescript entry in your serverless.yml. The plugin will detect automatically .ts files.

plugins:
  - serverless-plugin-datadog
  - serverless-typescript

Opening Issues

If you encounter a bug with this package, we want to hear about it. Before opening a new issue, search the existing issues to avoid duplicates.

When opening an issue, include your Serverless Framework version, Python/Node.js version, and stack trace if available. In addition, include the steps to reproduce when appropriate.

You can also open an issue for a feature request.

Contributing

If you find an issue with this package and have a fix, please feel free to open a pull request following the procedures.

License

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.

This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2019 Datadog, Inc.

FAQs

Package last updated on 24 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts