Skip to content

Commit

Permalink
Add Node 14 compatibility (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarcyRaynerDD authored Feb 4, 2021
1 parent ae5a583 commit ae7a84f
Show file tree
Hide file tree
Showing 40 changed files with 420 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Node 12.13
- name: Set up Node 14.15
uses: actions/setup-node@v1
with:
node-version: 12.13
node-version: 14.15

- name: Cache Node modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: '**/node_modules'
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
Expand All @@ -36,7 +36,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
node-version: [10.15, 12.13]
node-version: [10.15, 12.13, 14.15]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -50,7 +50,7 @@ jobs:
id: cache-node-modules
uses: actions/cache@v2
with:
path: '**/node_modules'
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
Expand Down
47 changes: 47 additions & 0 deletions integration_tests/serverless-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ layers:
node12:
package:
artifact: ../.layers/datadog_lambda_node12.13.zip
node14:
package:
artifact: ../.layers/datadog_lambda_node14.15.zip

functions:
# async-metrics
Expand All @@ -35,6 +38,15 @@ functions:
DD_FLUSH_TO_LOG: true
WITH_PLUGIN: true

async-metrics_node14_with_plugin:
handler: send-metrics.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
DD_FLUSH_TO_LOG: true
WITH_PLUGIN: true

# sync-metrics
sync-metrics_node10_with_plugin:
handler: send-metrics.handle
Expand All @@ -52,6 +64,14 @@ functions:
environment:
WITH_PLUGIN: true

sync-metrics_node14_with_plugin:
handler: send-metrics.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
WITH_PLUGIN: true

# http-requests
http-requests_node10_with_plugin:
handler: http-requests.handle
Expand All @@ -69,6 +89,14 @@ functions:
environment:
WITH_PLUGIN: true

http-requests_node14_with_plugin:
handler: http-requests.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
WITH_PLUGIN: true

# process-input-traced
process-input-traced_node10_with_plugin:
handler: process-input-traced.handle
Expand All @@ -87,6 +115,16 @@ functions:
environment:
WITH_PLUGIN: true
DD_FLUSH_TO_LOG: true

process-input-traced_node14_with_plugin:
handler: process-input-traced.handle
runtime: nodejs14.x
layers:
- { Ref: Node12LambdaLayer }
environment:
WITH_PLUGIN: true
DD_FLUSH_TO_LOG: true

# throw-error-traced
throw-error-traced_node10_with_plugin:
handler: throw-error-traced.handle
Expand All @@ -106,6 +144,15 @@ functions:
WITH_PLUGIN: true
DD_FLUSH_TO_LOG: true

throw-error-traced_node14_with_plugin:
handler: throw-error-traced.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
WITH_PLUGIN: true
DD_FLUSH_TO_LOG: true

plugins:
- serverless-plugin-datadog

Expand Down
40 changes: 40 additions & 0 deletions integration_tests/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ layers:
package:
artifact: ../.layers/datadog_lambda_node12.13.zip

node14:
package:
artifact: ../.layers/datadog_lambda_node14.15.zip

functions:
# async-metrics
async-metrics_node10:
Expand All @@ -36,6 +40,14 @@ functions:
environment:
DD_FLUSH_TO_LOG: true

async-metrics_node14:
handler: send-metrics.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
DD_FLUSH_TO_LOG: true

# sync-metrics
sync-metrics_node10:
handler: send-metrics.handle
Expand All @@ -49,6 +61,12 @@ functions:
layers:
- { Ref: Node12LambdaLayer }

sync-metrics_node14:
handler: send-metrics.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }

# http-requests
http-requests_node10:
handler: http-requests.handle
Expand All @@ -62,6 +80,12 @@ functions:
layers:
- { Ref: Node12LambdaLayer }

http-requests_node14:
handler: http-requests.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }

# process-input-traced
process-input-traced_node10:
handler: process-input-traced.handle
Expand All @@ -78,6 +102,14 @@ functions:
- { Ref: Node12LambdaLayer }
environment:
DD_FLUSH_TO_LOG: true

process-input-traced_node14:
handler: process-input-traced.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
DD_FLUSH_TO_LOG: true
# throw-error-traced
throw-error-traced_node10:
handler: throw-error-traced.handle
Expand All @@ -94,3 +126,11 @@ functions:
- { Ref: Node12LambdaLayer }
environment:
DD_FLUSH_TO_LOG: true

throw-error-traced_node14:
handler: throw-error-traced.handle
runtime: nodejs14.x
layers:
- { Ref: Node14LambdaLayer }
environment:
DD_FLUSH_TO_LOG: true
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ START RequestId: XXXX Version: $LATEST
{"e":XXXX,"m":"aws.lambda.enhanced.invocations","t":["region:us-east-1","account_id:XXXX","functionname:integration-plugin-dev-async-metrics_node12_with_plugin","resource:integration-plugin-dev-async-metrics_node12_with_plugin","cold_start:false","memorysize:1024","datadog_lambda:vX.X.X","runtime:nodejs12.x"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.records_processed","t":["tagkey:tagvalue","eventsource:SNS","dd_lambda_layer:datadog-nodev12.XX.X"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.execution","t":["tagkey:tagvalue","eventsource:SNS","dd_lambda_layer:datadog-nodev12.XX.X"],"v":1}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed SNS request
{"traces":[[{"trace_id":"XXXX","span_id":"XXXX","parent_id":"XXXX","name":"aws.lambda","resource":"integration-plugin-dev-async-metrics_node12_with_plugin","error":0,"meta":{"_dd.origin":"lambda","service":"integration-plugin-dev-async-metrics_node12_with_plugin","cold_start":"false","function_arn":"XXXX_node12_with_plugin","function_version":"$LATEST","request_id":"XXXX","resource_names":"integration-plugin-dev-async-metrics_node12_with_plugin","datadog_lambda":"XXXX","dd_trace":"XXXX","_dd.parent_source":"xray","function_trigger.event_source":"sns","function_trigger.event_source_arn":"arn:aws:sns:us-east-2:123456789012:sns-lambda"},"metrics":{"_sample_rate":1,"_sampling_priority_v1":2},"start":XXXX,"duration":XXXX,"service":"aws.lambda","type":"serverless"}]]}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed SNS request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
Expand All @@ -22,8 +22,8 @@ START RequestId: XXXX Version: $LATEST
{"e":XXXX,"m":"serverless.integration_test.records_processed","t":["tagkey:tagvalue","eventsource:SQS","dd_lambda_layer:datadog-nodev12.XX.X"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.records_processed","t":["tagkey:tagvalue","eventsource:SQS","dd_lambda_layer:datadog-nodev12.XX.X"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.execution","t":["tagkey:tagvalue","eventsource:SQS","dd_lambda_layer:datadog-nodev12.XX.X"],"v":1}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed SQS request
{"traces":[[{"trace_id":"XXXX","span_id":"XXXX","parent_id":"XXXX","name":"aws.lambda","resource":"integration-plugin-dev-async-metrics_node12_with_plugin","error":0,"meta":{"_dd.origin":"lambda","service":"integration-plugin-dev-async-metrics_node12_with_plugin","cold_start":"false","function_arn":"XXXX_node12_with_plugin","function_version":"$LATEST","request_id":"XXXX","resource_names":"integration-plugin-dev-async-metrics_node12_with_plugin","datadog_lambda":"XXXX","dd_trace":"XXXX","_dd.parent_source":"xray","function_trigger.event_source":"sqs","function_trigger.event_source_arn":"arn:aws:sqs:us-east-2:123456789012:my-queue"},"metrics":{"_sample_rate":1,"_sampling_priority_v1":2},"start":XXXX,"duration":XXXX,"service":"aws.lambda","type":"serverless"}]]}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed SQS request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
26 changes: 26 additions & 0 deletions integration_tests/snapshots/logs/async-metrics_node14.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
START RequestId: XXXX Version: $LATEST
{"e":XXXX,"m":"aws.lambda.enhanced.invocations","t":["region:us-east-1","account_id:XXXX","functionname:integration-dev-async-metrics_node14","resource:integration-dev-async-metrics_node14","cold_start:true","memorysize:1024","datadog_lambda:vX.X.X","runtime:nodejs14.x"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.execution","t":["tagkey:tagvalue","eventsource:APIGateway","dd_lambda_layer:datadog-nodev14.XX.X"],"v":1}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed APIGateway request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true

START RequestId: XXXX Version: $LATEST
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed SNS request
{"e":XXXX,"m":"aws.lambda.enhanced.invocations","t":["region:us-east-1","account_id:XXXX","functionname:integration-dev-async-metrics_node14","resource:integration-dev-async-metrics_node14","cold_start:false","memorysize:1024","datadog_lambda:vX.X.X","runtime:nodejs14.x"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.records_processed","t":["tagkey:tagvalue","eventsource:SNS","dd_lambda_layer:datadog-nodev14.XX.X"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.execution","t":["tagkey:tagvalue","eventsource:SNS","dd_lambda_layer:datadog-nodev14.XX.X"],"v":1}
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true

START RequestId: XXXX Version: $LATEST
{"e":XXXX,"m":"aws.lambda.enhanced.invocations","t":["region:us-east-1","account_id:XXXX","functionname:integration-dev-async-metrics_node14","resource:integration-dev-async-metrics_node14","cold_start:false","memorysize:1024","datadog_lambda:vX.X.X","runtime:nodejs14.x"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.records_processed","t":["tagkey:tagvalue","eventsource:SQS","dd_lambda_layer:datadog-nodev14.XX.X"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.records_processed","t":["tagkey:tagvalue","eventsource:SQS","dd_lambda_layer:datadog-nodev14.XX.X"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.execution","t":["tagkey:tagvalue","eventsource:SQS","dd_lambda_layer:datadog-nodev14.XX.X"],"v":1}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Processed SQS request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
START RequestId: XXXX Version: $LATEST
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX ERROR {"status":"error","message":"datadog:handler not initialized"}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO Processed APIGateway request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true

START RequestId: XXXX Version: $LATEST
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX ERROR {"status":"error","message":"datadog:handler not initialized"}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX ERROR {"status":"error","message":"datadog:handler not initialized"}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO Processed SNS request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true

START RequestId: XXXX Version: $LATEST
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX ERROR {"status":"error","message":"datadog:handler not initialized"}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX ERROR {"status":"error","message":"datadog:handler not initialized"}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX ERROR {"status":"error","message":"datadog:handler not initialized"}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO Processed SQS request
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
2 changes: 1 addition & 1 deletion integration_tests/snapshots/logs/http-requests_node12.log
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ START RequestId: XXXX Version: $LATEST
{"e":XXXX,"m":"aws.lambda.enhanced.invocations","t":["region:us-east-1","account_id:XXXX","functionname:integration-dev-http-requests_node12","resource:integration-dev-http-requests_node12","cold_start:false","memorysize:1024","datadog_lambda:vX.X.X","runtime:nodejs12.x"],"v":1}
HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["Accept:application/json, text/plain, */*","User-Agent:axios/0.21.1","x-datadog-parent-id:XXXX","x-datadog-sampling-priority:2","x-datadog-trace-id:XXXX"]
HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["Accept:application/json, text/plain, */*","User-Agent:axios/0.21.1","x-datadog-parent-id:XXXX","x-datadog-sampling-priority:2","x-datadog-trace-id:XXXX"]
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Snapshot test http requests successfully made to URLs: https://ip-ranges.datadoghq.com,https://ip-ranges.datadoghq.eu
HTTP POST https://api.datadoghq.com/api/v1/distribution_points?api_key=XXXX Headers: ["content-type:application/json","x-datadog-parent-id:XXXX","x-datadog-sampling-priority:2","x-datadog-trace-id:XXXX"]
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Snapshot test http requests successfully made to URLs: https://ip-ranges.datadoghq.com,https://ip-ranges.datadoghq.eu
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
START RequestId: XXXX Version: $LATEST
{"e":XXXX,"m":"aws.lambda.enhanced.invocations","t":["region:us-east-1","account_id:XXXX","functionname:integration-plugin-dev-http-requests_node12_with_plugin","resource:integration-plugin-dev-http-requests_node12_with_plugin","cold_start:false","memorysize:1024","datadog_lambda:vX.X.X","runtime:nodejs12.x"],"v":1}
{"e":XXXX,"m":"serverless.integration_test.execution","t":["function:http-request","dd_lambda_layer:datadog-nodev12.XX.X"],"v":1}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Snapshot test http requests successfully made to URLs: https://ip-ranges.datadoghq.com,https://ip-ranges.datadoghq.eu
{"traces":[[{"trace_id":"XXXX","span_id":"XXXX","parent_id":"XXXX","name":"http.request","resource":"GET","error":0,"meta":{"_dd.origin":"lambda","service":"integration-plugin-dev-http-requests_node12_with_plugin","span.kind":"client","http.method":"GET","http.url":"https://ip-ranges.datadoghq.com/","http.status_code":"200"},"metrics":{"_sample_rate":1,"_sampling_priority_v1":2},"start":XXXX,"duration":XXXX,"service":"integration-plugin-dev-http-requests_node12_with_plugin-http-client","type":"http"},{"trace_id":"XXXX","span_id":"XXXX","parent_id":"XXXX","name":"http.request","resource":"GET","error":0,"meta":{"_dd.origin":"lambda","service":"integration-plugin-dev-http-requests_node12_with_plugin","span.kind":"client","http.method":"GET","http.url":"https://ip-ranges.datadoghq.eu/","http.status_code":"200"},"metrics":{"_sample_rate":1,"_sampling_priority_v1":2},"start":XXXX,"duration":XXXX,"service":"integration-plugin-dev-http-requests_node12_with_plugin-http-client","type":"http"},{"trace_id":"XXXX","span_id":"XXXX","parent_id":"XXXX","name":"aws.lambda","resource":"integration-plugin-dev-http-requests_node12_with_plugin","error":0,"meta":{"_dd.origin":"lambda","service":"integration-plugin-dev-http-requests_node12_with_plugin","cold_start":"false","function_arn":"XXXX_node12_with_plugin","function_version":"$LATEST","request_id":"XXXX","resource_names":"integration-plugin-dev-http-requests_node12_with_plugin","datadog_lambda":"XXXX","dd_trace":"XXXX","_dd.parent_source":"xray","function_trigger.event_source":"sqs","function_trigger.event_source_arn":"arn:aws:sqs:us-east-2:123456789012:my-queue"},"metrics":{"_sample_rate":1,"_sampling_priority_v1":2},"start":XXXX,"duration":XXXX,"service":"aws.lambda","type":"serverless"}]]}
XXXX-XX-XX XX:XX:XX.XXX XXXX-XXXX-XXXX-XXXX-XXXX INFO [dd.trace_id=XXXX dd.span_id=XXXX] Snapshot test http requests successfully made to URLs: https://ip-ranges.datadoghq.com,https://ip-ranges.datadoghq.eu
END RequestId: XXXX
REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB
XRAY TraceId: XXXX SegmentId: XXXX Sampled: true
Loading

0 comments on commit ae7a84f

Please sign in to comment.