You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-13Lines changed: 17 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -63,39 +63,43 @@ functions:
63
63
64
64
## Environment Variables
65
65
66
-
The Datadog API Key must be defined as one of the following environment variables 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):
66
+
### DD_FLUSH_TO_LOG
67
+
68
+
Set to `true` (recommended) to send custom metrics asynchronously (with no added latency to your Lambda function executions) through CloudWatch Logs with the help of [Datadog Forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/master/aws/logs_monitoring).
69
+
70
+
If set to `false`, you also need to set `DD_API_KEY` and `DD_SITE`.
71
+
72
+
### DD_API_KEY
73
+
74
+
If `DD_FLUSH_TO_LOG` is set to false (not recommended), the Datadog API Key must be defined as one of the following environment variables:
67
75
68
76
- DD_API_KEY - the Datadog API Key in plain-text, NOT recommended
69
77
- DD_KMS_API_KEY - the KMS-encrypted API Key, requires the `kms:Decrypt` permission
70
78
- DD_API_KEY_SECRET_ARN - the Secret ARN to fetch API Key from the Secrets Manager, requires the `secretsmanager:GetSecretValue` permission (and `kms:Decrypt` if using a customer managed CMK)
71
79
72
-
You can also supply or override the API key at runtime:
80
+
You can also supply or override the API key at runtime (not recommended):
73
81
74
82
```python
75
83
# Override DD API Key after importing datadog_lambda packages
76
84
from datadog import api
77
85
api._api_key = "MY_API_KEY"
78
86
```
79
87
80
-
Set the following Datadog environment variable to `datadoghq.eu` to send your data to the Datadog EU site.
81
-
82
-
- DD_SITE
88
+
### DD_SITE
83
89
84
-
If your Lambda function powers a performance-critical task (e.g., a consumer-facing API). You can avoid the added latencies of metric-submitting API calls, by setting the following Datadog environment variable to `True`. Custom metrics will be submitted asynchronously through CloudWatch Logs and [the Datadog log forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/master/aws/logs_monitoring).
90
+
If `DD_FLUSH_TO_LOG` is set to false (not recommended), and your data need to be sent to the Datadog EU site, you must set `DD_SITE` to `datadoghq.eu`.
85
91
86
-
- DD_FLUSH_TO_LOG
92
+
### DD_LOGS_INJECTION
87
93
88
94
Inject Datadog trace id into logs for [correlation](https://docs.datadoghq.com/tracing/connect_logs_and_traces/?tab=python). Defaults to true.
89
95
90
-
- DD_LOGS_INJECTION
91
-
92
-
To debug the Datadog Lambda Layer, set the environment variable below to `DEBUG`.
96
+
### DD_LOG_LEVEL
93
97
94
-
- DD_LOG_LEVEL
98
+
Set to `debug` enable debug los from the Datadog Lambda Layer.
95
99
96
-
To increment `aws.lambda.enhanced.invocations` and `aws.lambda.enhanced.errors` Datadog Lambda integration metrics set this environment variable to `true`:
100
+
### DD_ENHANCED_METRICS
97
101
98
-
- DD_ENHANCED_METRICS
102
+
Generate enhanced Datadog Lambda integration metrics, such as, `aws.lambda.enhanced.invocations` and `aws.lambda.enhanced.errors`. Defaults to true.
0 commit comments