Skip to content

Commit c885a80

Browse files
Merge pull request #75 from DataDog/darcy.rayner/v2.24.0
v2.24.0
2 parents 745bf32 + a655ec1 commit c885a80

File tree

3 files changed

+30
-56
lines changed

3 files changed

+30
-56
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Datadog's Lambda node client library enables distributed tracing between serverf
1010

1111
## Installation
1212

13-
This library is provided both as an AWS Lambda Layer, and a NPM package. If you want to get off the ground quickly and don't need to
14-
bundle your dependencies locally, the Lambda Layer method is the recommended approach.
13+
This library is provided both as an AWS Lambda Layer, and a NPM package. If you want to get off the ground quickly and don't need to bundle your dependencies locally, the Lambda Layer method is the recommended approach.
1514

1615
### NPM method
1716

@@ -61,6 +60,8 @@ functions:
6160
DD_API_KEY: xxx
6261
```
6362
63+
Alternatively, consider using [serverless-plugin-datadog](https://github.com/DataDog/serverless-plugin-datadog). The plugin can take care of adding lambda layers to your functions, and wrapping your handlers.
64+
6465
## Environment Variables
6566
6667
You can set the following environment variables via the AWS CLI or Serverless Framework
@@ -90,9 +91,28 @@ If you set the value of this variable to "true" then the Lambda layer will incre
9091
Controlls whether or not the Datadog Trace ID is injected into log lines. See [DD_LOGS_INJECTION](#DD_LOGS_INJECTION-environment-variable) under
9192
the Trace & Log Correlation section below.
9293

94+
### DD_LAMBDA_HANDLER
95+
96+
For use with the [redirected handler](#Redirected-Handler) method. Location of your original lambda handler.
97+
98+
### DD_TRACE_ENABLED
99+
100+
When used with the [redirected handler](#Redirected-Handler) method, will auto initialize the tracer when set to true.
101+
93102
## Usage
94103

95-
Datadog needs to be able to read headers from the incoming Lambda event.
104+
Datadog needs to be able to read headers from the incoming Lambda event. To do this, you must wrap your handler function with our library. We provide some easy ways of wrapping your handlers.
105+
106+
### Redirected Handler
107+
108+
We provide a swap in replacement handler, with zero required code changes.
109+
110+
1. Set the environment variable `DD_LAMBDA_HANDLER` to your regular handler location, eg. `myfunc.handler`.
111+
2. If using the layer, set your handler to `/opt/nodejs/node_modules/datadog-lambda-js/handler.handler`. If using installing your code as a library, use `node_modules/datadog-lambda-js/handler.handler`
112+
113+
### Manual Wrap
114+
115+
You might find it more convenient to wrap your handlers manually.
96116

97117
```typescript
98118
const { datadog } = require("datadog-lambda-js");

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datadog-lambda-js",
3-
"version": "2.23.0",
3+
"version": "2.24.0",
44
"description": "Lambda client library that supports hybrid tracing in node js",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
2222
"@types/node": "^13.9.1",
2323
"@types/promise-retry": "^1.1.3",
2424
"@types/shimmer": "^1.0.1",
25-
"dd-trace": "0.20.0-beta.0",
25+
"dd-trace": "0.20.3",
2626
"jest": "^25.1.0",
2727
"nock": "12.0.2",
2828
"prettier": "^1.19.1",

yarn.lock

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -876,11 +876,6 @@ chalk@^3.0.0:
876876
ansi-styles "^4.1.0"
877877
supports-color "^7.1.0"
878878

879-
chownr@^1.1.1:
880-
version "1.1.4"
881-
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"
882-
integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==
883-
884879
ci-info@^2.0.0:
885880
version "2.0.0"
886881
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
@@ -1058,10 +1053,10 @@ data-urls@^1.1.0:
10581053
whatwg-mimetype "^2.2.0"
10591054
whatwg-url "^7.0.0"
10601055

1061-
1062-
version "0.20.0-beta.0"
1063-
resolved "https://registry.yarnpkg.com/dd-trace/-/dd-trace-0.20.0-beta.0.tgz#c52e83db853dbaf53cee89816bf66886208a96f0"
1064-
integrity sha512-0KuxQ3LjE0bpP50w6NhAE6sijFSj7i/Kb+FNtDe2kQKZnWWSAHI0RBWLLDPagDloAgeSiCA3pDPb0QRTDnsTHA==
1056+
1057+
version "0.20.3"
1058+
resolved "https://registry.yarnpkg.com/dd-trace/-/dd-trace-0.20.3.tgz#60e060bf57cba8a36feeccf2d361863f247188f5"
1059+
integrity sha512-MiZCdfcv2zLwQq9Eg8+M9L832ccO/SfXArTzZivdppHRkOx74xMEewzN4fsaOUPlDeps+UTqEHR8Yb9z7luo8w==
10651060
dependencies:
10661061
"@types/node" "^10.12.18"
10671062
container-info "^1.0.1"
@@ -1088,7 +1083,6 @@ [email protected]:
10881083
require-in-the-middle "^2.2.2"
10891084
semver "^5.5.0"
10901085
shimmer "^1.2.0"
1091-
tar "^4.4.8"
10921086
url-parse "^1.4.3"
10931087
whatwg-fetch "^3.0.0"
10941088

@@ -1472,13 +1466,6 @@ fragment-cache@^0.2.1:
14721466
dependencies:
14731467
map-cache "^0.2.2"
14741468

1475-
fs-minipass@^1.2.5:
1476-
version "1.2.7"
1477-
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7"
1478-
integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==
1479-
dependencies:
1480-
minipass "^2.6.0"
1481-
14821469
fs.realpath@^1.0.0:
14831470
version "1.0.0"
14841471
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -2595,21 +2582,6 @@ minimist@^1.1.1, minimist@^1.2.0:
25952582
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
25962583
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
25972584

2598-
minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0:
2599-
version "2.9.0"
2600-
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6"
2601-
integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==
2602-
dependencies:
2603-
safe-buffer "^5.1.2"
2604-
yallist "^3.0.0"
2605-
2606-
minizlib@^1.2.1:
2607-
version "1.3.3"
2608-
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d"
2609-
integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==
2610-
dependencies:
2611-
minipass "^2.9.0"
2612-
26132585
mixin-deep@^1.2.0:
26142586
version "1.3.2"
26152587
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
@@ -2618,7 +2590,7 @@ mixin-deep@^1.2.0:
26182590
for-in "^1.0.2"
26192591
is-extendable "^1.0.1"
26202592

2621-
[email protected], mkdirp@^0.5.0, mkdirp@^0.5.1:
2593+
[email protected], mkdirp@^0.5.1:
26222594
version "0.5.1"
26232595
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
26242596
integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
@@ -3646,19 +3618,6 @@ symbol-tree@^3.2.2:
36463618
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
36473619
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
36483620

3649-
tar@^4.4.8:
3650-
version "4.4.13"
3651-
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
3652-
integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==
3653-
dependencies:
3654-
chownr "^1.1.1"
3655-
fs-minipass "^1.2.5"
3656-
minipass "^2.8.6"
3657-
minizlib "^1.2.1"
3658-
mkdirp "^0.5.0"
3659-
safe-buffer "^5.1.2"
3660-
yallist "^3.0.3"
3661-
36623621
terminal-link@^2.0.0:
36633622
version "2.1.1"
36643623
resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994"
@@ -4067,11 +4026,6 @@ y18n@^4.0.0:
40674026
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
40684027
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
40694028

4070-
yallist@^3.0.0, yallist@^3.0.3:
4071-
version "3.1.1"
4072-
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
4073-
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
4074-
40754029
yargs-parser@^16.1.0:
40764030
version "16.1.0"
40774031
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-16.1.0.tgz#73747d53ae187e7b8dbe333f95714c76ea00ecf1"

0 commit comments

Comments
 (0)