Skip to content

Document serverless plugin #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,34 @@ When developing your Lambda function locally where AWS Layer doesn't work, the D

The minor version of the `datadog-lambda` package always match the layer version. E.g., datadog-lambda v0.5.0 matches the content in layer version 5.

### Environment Variables
### The Serverless Framework

[The Datadog Serverless Framework Plugin](https://github.com/DataDog/serverless-plugin-datadog) makes it easy to manage the Datadog instrumentation for all of your Lambda functions in one place.

Instead of the plugin, you can also use the sample `serverless.yml` below as a reference for manually including the Lambda Layer, enable AWS X-Ray tracing, and set up environment variables.

```yaml
provider:
name: aws
runtime: python3.7
tracing:
lambda: true
apiGateway: true

functions:
hello:
handler: handler.hello
events:
- http:
path: hello
method: get
layers:
- arn:aws:lambda:<AWS_REGION>:464622532012:layer:Datadog-<PYTHON_RUNTIME>:<VERSION>
environment:
DD_API_KEY: <DD_API_KEY>
```

## Environment Variables

The Datadog API must be defined as an environment variable via [AWS CLI](https://docs.aws.amazon.com/lambda/latest/dg/env_variables.html) or [Serverless Framework](https://serverless-stack.com/chapters/serverless-environment-variables.html):

Expand Down Expand Up @@ -61,31 +88,6 @@ To increment `aws.lambda.enhanced.invocations` and `aws.lambda.enhanced.errors`

- DD_ENHANCED_METRICS

### The Serverless Framework

If your Lambda function is deployed using the Serverless Framework, refer to this sample `serverless.yml`.

```yaml
provider:
name: aws
runtime: python3.7
tracing:
lambda: true
apiGateway: true

functions:
hello:
handler: handler.hello
events:
- http:
path: hello
method: get
layers:
- arn:aws:lambda:<AWS_REGION>:464622532012:layer:Datadog-<PYTHON_RUNTIME>:<VERSION>
environment:
DD_API_KEY: <DD_API_KEY>
```

## Basic Usage

```python
Expand Down