https://github.com/scribd/elasticache-slowlog-to-datadog
Use AWS Lambda to collect Elasticache Redis slowlog entries and submit to Datadog
https://github.com/scribd/elasticache-slowlog-to-datadog
aws-elasticache aws-lambda core-infrastructure datadog redis
Last synced: about 1 month ago
JSON representation
Use AWS Lambda to collect Elasticache Redis slowlog entries and submit to Datadog
- Host: GitHub
- URL: https://github.com/scribd/elasticache-slowlog-to-datadog
- Owner: scribd
- License: mit
- Created: 2020-04-27T23:04:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-21T15:14:34.000Z (9 months ago)
- Last Synced: 2025-03-28T02:45:38.572Z (about 2 months ago)
- Topics: aws-elasticache, aws-lambda, core-infrastructure, datadog, redis
- Language: Ruby
- Size: 325 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# elasticache-slowlog-to-datadog
This AWS Lambda function connects to an AWS Elasticache instance running in redis mode,
and submits slowlog entry metrics to a Datadog account.
[](https://github.com/semantic-release/semantic-release)
# lambda_function.rb
## Usage
This lambda function was built and tested with the `ruby-3.3` runtime.
Deploy the "Full zip distribution" from the [releases pages](https://github.com/scribd/elasticache-slowlog-to-datadog/releases) to AWS lambda
### Parameters
The following parameters need to be supplied to the lambda function.
Environment Variable | Type | Description | Required | Default
---------------------|--------|---------------------------------------------------------------|----------|---------
REDIS_HOST | string | FQDN or URI of the elasticache redis endpoint | yes | -
DATADOG_API_KEY | string | Datadog API Key | no | -
DATADOG_APP_KEY | string | Datadog API Key | no | -
NAMESPACE | string | "namespace" tag to apply to Datadog metric | yes | -
ENV | string | "env" tag to apply to the Datadog metric | yes | -
METRICNAME | string | Metric name to use | no | 'elasticache.slowlog'
SSM_PATH | string | SSM Path where Datadog API Key and Datadog App key are stored | no | -*note: either DATADOG_API_KEY and DATADOG_APP_KEY must be set environment variables or passed in from SSM.*
### Terraform
See https://github.com/scribd/terraform-elasticache-slowlog-to-datadog/blob/master/main.tf for a reference
implementation in Terraform.# inject_slow_query.rb
This script is used to inject arbitrary slow queries into a target redis instance.
DO NOT use this script in production environments, as it will CPU thrash the target instance.
### Parameters
Environment Variable | Type | Description | Required | Default
---------------------|--------|---------------------------------------------------------------|----------|---------
REDIS_HOST | string | FQDN or URI of the elasticache redis endpoint | yes | -# Requirements
To use *elasticache-slowlog-to-datadog* you need:
- An AWS account with an Elasticache instance running the `redis5.0+` engine.
- A Datadog account# Development
Releases are cut using [semantic-release](https://github.com/semantic-release/semantic-release).
Please write commit messages following [Angular commit guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines)