Skip to content

Commit 9a78fcc

Browse files
authored
Configuration instructions in one place (#222)
1 parent fdfca01 commit 9a78fcc

File tree

1 file changed

+2
-78
lines changed

1 file changed

+2
-78
lines changed

README.md

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -12,85 +12,9 @@ Datadog Lambda Library for Python (3.6, 3.7, 3.8, and 3.9) enables [enhanced Lam
1212

1313
Follow the [installation instructions](https://docs.datadoghq.com/serverless/installation/python/), and view your function's enhanced metrics, traces and logs in Datadog.
1414

15-
For advanced distributed tracing use cases, check out the [official documentation for Datadog APM client](https://ddtrace.readthedocs.io).
15+
## Configuration
1616

17-
To connect traces and logs using a custom logger, see [connecting logs and traces](https://docs.datadoghq.com/tracing/connect_logs_and_traces/python/).
18-
19-
## Environment Variables
20-
21-
### DD_API_KEY
22-
23-
If you are using the [Datadog Lambda Extension](https://docs.datadoghq.com/serverless/libraries_integrations/extension/), the Datadog API Key must be defined by setting one of the following environment variables:
24-
25-
- DD_API_KEY - the Datadog API Key in plain-text, NOT recommended
26-
- DD_KMS_API_KEY - the KMS-encrypted API Key, requires the `kms:Decrypt` permission
27-
- 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)
28-
29-
If you are using the [Datadog Forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/main/aws/logs_monitoring), you must set the Datadog API Key on the Datadog Forwarder instead of your own Lambda function.
30-
31-
### DD_SITE
32-
33-
If you are using the [Datadog Lambda Extension](https://docs.datadoghq.com/serverless/libraries_integrations/extension/), you must set `DD_SITE` on your Lambda function based on your [Datadog site](https://docs.datadoghq.com/getting_started/site/). The default is `datadoghq.com`.
34-
35-
If you are using the [Datadog Forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/main/aws/logs_monitoring), you must set this on the Datadog Forwarder instead of your own Lambda function.
36-
37-
### DD_LOGS_INJECTION
38-
39-
Inject Datadog trace id into logs for [correlation](https://docs.datadoghq.com/tracing/connect_logs_and_traces/python/) if you are using a `logging.Formatter` in the default `LambdaLoggerHandler` by the Lambda runtime. Defaults to `true`.
40-
41-
### DD_LOG_LEVEL
42-
43-
Set to `debug` enable debug logs from the Datadog Lambda Library. Defaults to `info`.
44-
45-
### DD_ENHANCED_METRICS
46-
47-
Generate enhanced Datadog Lambda integration metrics, such as, `aws.lambda.enhanced.invocations` and `aws.lambda.enhanced.errors`. Defaults to `true`.
48-
49-
### DD_LAMBDA_HANDLER
50-
51-
In order to instrument individual invocations, the Datadog Lambda library needs to wrap around your Lambda handler function. This is usually achieved by setting your function's handler to the Datadog handler function (`datadog_lambda.handler.handler`) and setting the environment variable `DD_LAMBDA_HANDLER` with your original handler function to be called by the Datadog handler.
52-
53-
For some advanced use cases, instead of overriding the handler setting and the `DD_LAMBDA_HANDLER` environment variable, you can apply the Datadog Lambda library wrapper in your function code like below:
54-
55-
```python
56-
from datadog_lambda.wrapper import datadog_lambda_wrapper
57-
58-
@datadog_lambda_wrapper
59-
def my_lambda_handle(event, context):
60-
# your function code
61-
```
62-
63-
### DD_TRACE_ENABLED
64-
65-
Initialize the Datadog tracer when set to `true`. Defaults to `false`.
66-
67-
### DD_MERGE_XRAY_TRACES
68-
69-
Set to `true` to merge the X-Ray trace and the Datadog trace, when using both the X-Ray and Datadog tracing. Defaults to `false`.
70-
71-
### DD_TRACE_MANAGED_SERVICES (experimental)
72-
73-
Inferred Spans are spans that Datadog can create based on incoming event metadata.
74-
Set `DD_TRACE_MANAGED_SERVICES` to `true` to infer spans based on Lambda events.
75-
Inferring upstream spans is only supported if you are using the [Datadog Lambda Extension](https://docs.datadoghq.com/serverless/libraries_integrations/extension/).
76-
Defaults to `true`.
77-
Infers spans for:
78-
79-
- API Gateway REST events
80-
- API Gateway WebSocket events
81-
- HTTP API events
82-
- SQS
83-
- SNS (SNS messaged delivered via SQS are also supported)
84-
- Kinesis Streams (if data is a JSON string or base64 encoded JSON string)
85-
- EventBridge (custom events, where Details is a JSON string)
86-
- S3
87-
- DynamoDB
88-
89-
### DD_FLUSH_TO_LOG (Deprecated)
90-
91-
When the [Datadog Forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/main/aws/logs_monitoring) was launched previously, `DD_FLUSH_TO_LOG` was introduced to control whether to send custom metrics synchronously from your own Lambda function directly to Datadog with added latency (set `DD_FLUSH_TO_LOG` to `false` and you also need to set `DD_API_KEY` and `DD_SITE`) or asynchronously through CloudWatch logs (set `DD_FLUSH_TO_LOG` to `true`).
92-
93-
Now you should consider adopting the [Datadog Lambda Extension](https://docs.datadoghq.com/serverless/libraries_integrations/extension/) for sending custom metrics. When the Datadog Lambda Extension is installed and detected, `DD_FLUSH_TO_LOG` is ignored. If you wish to Defaults to `false`. If set to `false`, you also need to set `DD_API_KEY` and `DD_SITE`.
17+
Follow the [configuration instructions][https://docs.datadoghq.com/serverless/configuration] to tag your telemetry, capture request/response payloads, filter or scrub sensitive information from logs or traces, and more.
9418

9519
## Opening Issues
9620

0 commit comments

Comments
 (0)