Skip to content

Commit

Permalink
Merge pull request #251 from newrelic/mrickard/set-log-enabled
Browse files Browse the repository at this point in the history
Restoring NEW_RELIC_LOG_ENABLED env var
  • Loading branch information
mrickard authored Jun 6, 2022
2 parents 1f16e6f + 6163da6 commit c5bb6a4
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 47 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-newrelic-lambda-layers",
"version": "3.3.0",
"version": "3.3.1",
"description": "Serverless plugin for NewRelic APM AWS Lambda layers.",
"main": "dist/index.js",
"files": [
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ or make sure that you already have Serverless 3.x installed in your project.
}

private logLevel(environment) {
environment.NEW_RELIC_LOG_ENABLED = environment.NEW_RELIC_LOG_ENABLED
? environment.NEW_RELIC_LOG_ENABLED
: "true";

environment.NEW_RELIC_LOG = environment.NEW_RELIC_LOG
? environment.NEW_RELIC_LOG
: "stdout";
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/arm64.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12XARM64:30"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12XARM64:31"
],
"package": {
"exclude": [
Expand Down Expand Up @@ -52,7 +52,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14XARM64:29"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14XARM64:30"
],
"package": {
"exclude": [
Expand Down
10 changes: 6 additions & 4 deletions tests/fixtures/debug-log-level.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -44,16 +44,17 @@
"NEW_RELIC_APP_NAME": "layer-nodejs12x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "error",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
}
},
"layer-nodejs14x": {
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -65,8 +66,9 @@
"NEW_RELIC_APP_NAME": "layer-nodejs14x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "error",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
}
}
Expand Down
9 changes: 6 additions & 3 deletions tests/fixtures/debug.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -43,6 +43,7 @@
"NEW_RELIC_APP_NAME": "layer-nodejs12x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
Expand All @@ -52,7 +53,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -64,6 +65,7 @@
"NEW_RELIC_APP_NAME": "layer-nodejs14x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
Expand All @@ -73,7 +75,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:2"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:3"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -85,6 +87,7 @@
"NEW_RELIC_APP_NAME": "layer-nodejs16x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"plugins": ["serverless-newrelic-lambda-layers"],
"provider": {
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"name": "aws",
"region": "us-east-1",
Expand Down
10 changes: 6 additions & 4 deletions tests/fixtures/eu.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"NEW_RELIC_APP_NAME": "layer-nodejs12x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
},
Expand All @@ -28,7 +29,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -42,7 +43,8 @@
"NEW_RELIC_APP_NAME": "layer-nodejs14x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "debug",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
},
Expand All @@ -53,7 +55,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/include.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": { "exclude": [
"./**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"service": "newrelic-lambda-layers-nodejs-example",
"provider": {
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"name": "aws",
"stage": "prod",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/lambda-extension-disabled.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -49,7 +49,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/lambda-extension-enabled.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -47,7 +47,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": [
Expand Down Expand Up @@ -53,7 +53,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": [
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/log-disabled.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -50,7 +50,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": [
Expand Down Expand Up @@ -57,7 +57,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": [
Expand Down
6 changes: 4 additions & 2 deletions tests/fixtures/log-level.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -43,6 +43,7 @@
"NEW_RELIC_APP_NAME": "layer-nodejs12x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "error",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
Expand All @@ -52,7 +53,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -64,6 +65,7 @@
"NEW_RELIC_APP_NAME": "layer-nodejs14x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "error",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:85"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS12X:86"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -46,16 +46,17 @@
"NEW_RELIC_APP_NAME": "layer-nodejs12x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "error",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
}
},
"layer-nodejs14x": {
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:55"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS14X:56"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -67,8 +68,9 @@
"NEW_RELIC_APP_NAME": "layer-nodejs14x",
"NEW_RELIC_LAMBDA_HANDLER": "handler.handler",
"NEW_RELIC_LOG": "stdout",
"NEW_RELIC_LOG_ENABLED": "true",
"NEW_RELIC_LOG_LEVEL": "error",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_NO_CONFIG_FILE": "true",
"NEW_RELIC_TRUSTED_ACCOUNT_KEY": "${env:NEW_RELIC_ACCOUNT_ID}"
}
}
Expand Down
Loading

0 comments on commit c5bb6a4

Please sign in to comment.