Skip to content

Commit a93ab98

Browse files
authored
Merge branch 'main' into chris.agocs/lambda_url_spans_and_triggers
2 parents 04cc766 + d2e40f0 commit a93ab98

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ By default, the Datadog trace id gets automatically injected into the logs for c
5151

5252
Set the environment variable `DD_LOGS_INJECTION` to `false` to disable this feature.
5353

54+
## Handler wrapper
55+
56+
In order to instrument individual invocations, the Datadog Lambda library needs to wrap around your Lambda handler function. This is usually achieved by pointing your function's handler setting to the provided Datadog handler function and passing the original handler function through an environment variable to be called by the Datadog handler.
57+
58+
If this method doesn't work for you, instead of overriding the handler and setting the `DD_LAMBDA_HANDLER` environment variable, you can apply the Datadog Lambda library wrapper in your function code like below:
59+
60+
```js
61+
const { datadog } = require("datadog-lambda-js");
62+
const tracer = require('dd-trace').init({});
63+
64+
module.exports.myHandler = datadog(myHandler, {
65+
// my function code
66+
});
67+
```
68+
5469
## Custom logger
5570

5671
You can use your own logger to log layer error and debug logs instead of default `console`

0 commit comments

Comments
 (0)