Skip to content

Commit ce4c3bd

Browse files
authored
Merge pull request #28 from DataDog/tian.chu/update-readme-for-serverless-plugin
Document serverless plugin
2 parents d29de3b + 1154cb5 commit ce4c3bd

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

README.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,34 @@ When developing your Lambda function locally where AWS Layer doesn't work, the D
2727

2828
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.
2929

30-
### Environment Variables
30+
### The Serverless Framework
31+
32+
[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.
33+
34+
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.
35+
36+
```yaml
37+
provider:
38+
name: aws
39+
runtime: python3.7
40+
tracing:
41+
lambda: true
42+
apiGateway: true
43+
44+
functions:
45+
hello:
46+
handler: handler.hello
47+
events:
48+
- http:
49+
path: hello
50+
method: get
51+
layers:
52+
- arn:aws:lambda:<AWS_REGION>:464622532012:layer:Datadog-<PYTHON_RUNTIME>:<VERSION>
53+
environment:
54+
DD_API_KEY: <DD_API_KEY>
55+
```
56+
57+
## Environment Variables
3158
3259
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):
3360
@@ -61,31 +88,6 @@ To increment `aws.lambda.enhanced.invocations` and `aws.lambda.enhanced.errors`
6188

6289
- DD_ENHANCED_METRICS
6390

64-
### The Serverless Framework
65-
66-
If your Lambda function is deployed using the Serverless Framework, refer to this sample `serverless.yml`.
67-
68-
```yaml
69-
provider:
70-
name: aws
71-
runtime: python3.7
72-
tracing:
73-
lambda: true
74-
apiGateway: true
75-
76-
functions:
77-
hello:
78-
handler: handler.hello
79-
events:
80-
- http:
81-
path: hello
82-
method: get
83-
layers:
84-
- arn:aws:lambda:<AWS_REGION>:464622532012:layer:Datadog-<PYTHON_RUNTIME>:<VERSION>
85-
environment:
86-
DD_API_KEY: <DD_API_KEY>
87-
```
88-
8991
## Basic Usage
9092

9193
```python

0 commit comments

Comments
 (0)