diff --git a/README.md b/README.md index 226d5062..85414797 100644 --- a/README.md +++ b/README.md @@ -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::464622532012:layer:Datadog-: + environment: + 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): @@ -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::464622532012:layer:Datadog-: - environment: - DD_API_KEY: -``` - ## Basic Usage ```python