Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
serverless-plugin-datadog
Advanced tools
Serverless plugin to automatically instrument python and node functions with datadog tracing
The serverless-plugin-datadog npm package is designed to integrate Datadog monitoring and observability features into Serverless Framework applications. It allows you to automatically instrument your AWS Lambda functions with Datadog, enabling you to monitor performance, track metrics, and set up alerts.
Automatic Instrumentation
This feature automatically instruments your AWS Lambda functions with Datadog. By adding the plugin to your Serverless Framework configuration and setting the appropriate custom options, you can enable Datadog layers, flush metrics to logs, and set the log level.
{
"plugins": ["serverless-plugin-datadog"],
"custom": {
"datadog": {
"addLayers": true,
"flushMetricsToLogs": true,
"logLevel": "info"
}
}
}
Custom Metrics
This feature allows you to enable custom metrics for your Lambda functions. By setting the `customMetrics` option to true, you can send custom metrics from your Lambda functions to Datadog.
{
"custom": {
"datadog": {
"customMetrics": true
}
}
}
Tracing
This feature enables tracing for your Lambda functions. By setting `enableXrayTracing` and `enableDDTracing` to true, you can enable AWS X-Ray and Datadog tracing, respectively, to get detailed insights into your function's performance.
{
"custom": {
"datadog": {
"enableXrayTracing": true,
"enableDDTracing": true
}
}
}
The serverless-plugin-splunk package integrates Splunk logging and monitoring with Serverless Framework applications. It provides similar functionalities to serverless-plugin-datadog, such as automatic instrumentation and custom metrics, but it is tailored for Splunk's monitoring and observability tools.
The serverless-plugin-aws-alerts package allows you to set up AWS CloudWatch alerts for your Serverless Framework applications. While it does not provide the same level of integration with a third-party monitoring service like Datadog, it offers a way to monitor and alert on AWS Lambda function performance using AWS-native tools.
The Datadog serverless framework plugin automatically installs the Datadog Lambda library to your Python and Node.js Lambda functions, and enables the collection of enhanced Lambda metrics, custom metrics, traces, and logs from your Lambda functions.
Follow the installation instructions for Python or Node.js, and view your function's enhanced metrics, traces and logs in Datadog.
You can configure the plugin by adding the following section to your serverless.yml
:
custom:
datadog:
# Send custom metrics via logs with the help of Datadog Forwarder Lambda function (recommended). Defaults to `false`.
# When disabled, the parameter `site` and `apiKey` (or `apiKMSKey` if encrypted) must be set.
flushMetricsToLogs: false
# Which Datadog Site to send data to, only needed when flushMetricsToLogs is `false`. Defaults to `datadoghq.com`.
# Set to `datadoghq.eu` for Datadog EU.
site: datadoghq.com
# Datadog API Key, only needed when flushMetricsToLogs is false.
apiKey: ""
# Datadog API Key encrypted using KMS, only needed when flushMetricsToLogs is false.
apiKMSKey: ""
# Whether to install the Datadog Lambda library as a layer. Defaults to `true`.
# Set to `false` when you plan to package the Datadog Lambda library to your function's deployment package on your own.
addLayers: true
# The log level, set to DEBUG for extended logging. Defaults to `info`.
logLevel: "info"
# Enable X-Ray tracing on the Lambda functions and API Gateway integrations. Defaults to `false`.
enableXrayTracing: false
# Enable Datadog tracing on the Lambda function. Defaults to `true`.
# When enabled, the parameter `forwarder` must be set.
enableDDTracing: true
# When set, automatically subscribe the Lambda functions' CloudWatch log groups to the given Datadog forwarder Lambda function.
forwarder: arn:aws:lambda:us-east-1:000000000000:function:datadog-forwarder
# When set, automatically tag the Lambda functions with the `service` and `env` tags using the `service` and `stage` values from the serverless application definition. It does NOT override if a `service` or `env` tag already exists. Defaults to `true`.
enableTags: true
Set addLayers
to false, and then you can install and package a specific version of the Datadog Lambda library (Python or Node.js) on your own.
You may encounter the error of missing type definitions if you use the prebuilt layers (i.e., set addLayers
to true
, which is the default) and need to import helper functions from the datadog-lambda-js
and dd-trace
packages to submit custom metrics or instrument a specific function. To resolve the error, add datadog-lambda-js
and dd-trace
to the devDependencies
list of your project's package.json.
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
You are recommended to use the prebuilt layers (i.e., set addLayers
to true
, which is the default), and add datadog-lambda-js
and dd-trace
to the externals section of your webpack config.
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.
If you find an issue with this package and have a fix, please feel free to open a pull request following the procedures.
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
Serverless plugin to automatically instrument python and node functions with datadog tracing
We found that serverless-plugin-datadog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.