newrelic-lambda-cli 0.9.9__tar.gz → 0.9.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/PKG-INFO +11 -2
  2. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/README.md +10 -1
  3. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/api.py +5 -4
  4. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/layers.py +36 -4
  5. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/layers.py +48 -3
  6. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/types.py +7 -0
  7. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/utils.py +3 -1
  8. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/PKG-INFO +11 -2
  9. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/setup.py +1 -1
  10. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_layers.py +373 -4
  11. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/CODE_OF_CONDUCT.md +0 -0
  12. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/CONTRIBUTING.md +0 -0
  13. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/LICENSE +0 -0
  14. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/MANIFEST.in +0 -0
  15. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/THIRD_PARTY_NOTICES.md +0 -0
  16. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/__init__.py +0 -0
  17. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/__init__.py +0 -0
  18. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/decorators.py +0 -0
  19. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/functions.py +0 -0
  20. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/integrations.py +0 -0
  21. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/otel_ingestions.py +0 -0
  22. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cli/subscriptions.py +0 -0
  23. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/cliutils.py +0 -0
  24. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/functions.py +0 -0
  25. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/integrations.py +0 -0
  26. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/otel_ingestions.py +0 -0
  27. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/permissions.py +0 -0
  28. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/subscriptions.py +0 -0
  29. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/templates/import-template.yaml +0 -0
  30. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/templates/license-key-secret.yaml +0 -0
  31. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli/templates/nr-lambda-integration-role.yaml +0 -0
  32. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/SOURCES.txt +0 -0
  33. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/dependency_links.txt +0 -0
  34. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/entry_points.txt +0 -0
  35. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/not-zip-safe +0 -0
  36. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/requires.txt +0 -0
  37. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/newrelic_lambda_cli.egg-info/top_level.txt +0 -0
  38. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/pyproject.toml +0 -0
  39. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/setup.cfg +0 -0
  40. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_api.py +0 -0
  41. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_functions.py +0 -0
  42. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_integrations.py +0 -0
  43. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_new_relic_gql.py +0 -0
  44. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_permissions.py +0 -0
  45. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_subscriptions.py +0 -0
  46. {newrelic_lambda_cli-0.9.9 → newrelic_lambda_cli-0.9.10}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.9
3
+ Version: 0.9.10
4
4
  Summary: A CLI to install the New Relic AWS Lambda integration and layers.
5
5
  Home-page: https://github.com/newrelic/newrelic-lambda-cli
6
6
  Author: New Relic
@@ -126,6 +126,9 @@ newrelic-lambda integrations install \
126
126
  | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. |
127
127
  | `--linked-account-name` or `-n` | No | A label for the New Relic Linked Account. This is how this integration will appear in New Relic. Defaults to "New Relic Lambda Integration - <AWS Account ID>". |
128
128
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. This is disabled by default. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
129
+ | `--enable-license-key-secret` | No | Securely manages and store your New Relic license key in `AWS Secrets Manager` |
130
+ | `--enable-cw-ingest` | No | Enable the CloudWatch `log ingest` function |
131
+ | `--disable-cw-ingest` | No | Disable the CloudWatch `log ingest` function |
129
132
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. Default to 128MB. |
130
133
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. |
131
134
  | `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. Defaults to 30 seconds. |
@@ -171,6 +174,7 @@ newrelic-lambda integrations update \
171
174
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
172
175
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
173
176
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
177
+ | `--enable-license-key-secret` | No | Securely manages and store your New Relic license key in `AWS Secrets Manager` |
174
178
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. |
175
179
  | `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. |
176
180
  | `--role-name` | No | Role name for the ingestion function. If you prefer to create and manage an IAM role for the function to assume out of band, do so and specify that role's name here. This avoids needing CAPABILITY_IAM. |
@@ -198,11 +202,16 @@ newrelic-lambda layers install \
198
202
  | `--layer-arn` or `-l` | No | Specify a specific layer version ARN to use. This is auto detected by default. |
199
203
  | `--upgrade` or `-u` | No | Permit upgrade to the latest layer version for this region and runtime. |
200
204
  | `--disable-extension` | No | Disable the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). |
201
- | `--enable-extension-function-logs` | No | Enable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
205
+ | `--enable-extension-function-logs` or `--send-function-logs` | No | Enable sending Lambda function logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
206
+ | `--disable-extension-function-logs` or `--disable-function-logs` | No | Disable sending Lambda function logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension).|
207
+ | `--send-extension-logs` | No | Enable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
208
+ | `--disable-extension-logs` | No | Disable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension).|
202
209
  | `--aws-profile` or `-p` | No | The AWS profile to use for this command. Can also use `AWS_PROFILE`. Will also check `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables if not using AWS CLI. |
203
210
  | `--aws-region` or `-r` | No | The AWS region this function is located. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
204
211
  | `--nr-api-key` or `-k` | No | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
205
212
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
213
+ | `--nr-env-delimite` | No | Set `NR_ENV_DELIMITER` environment variable for your Lambda Function |
214
+ | `--nr-tags` | No | Set `NR_TAGS` environment variable for your Lambda Function |
206
215
  | `--java_handler_method` or `-j` | No | For java runtimes only to specify an aws implementation method. Defaults to RequestHandler. Optional inputs are: handleRequest, handleStreamsRequest `--java_handler_method handleStreamsRequest`. |
207
216
  | `--esm` | No | For Node.js functions using ES Modules (ESM), enable the specific ESM wrapper during installation (e.g., using the --esm flag). This sets the Lambda handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. |
208
217
 
@@ -100,6 +100,9 @@ newrelic-lambda integrations install \
100
100
  | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. |
101
101
  | `--linked-account-name` or `-n` | No | A label for the New Relic Linked Account. This is how this integration will appear in New Relic. Defaults to "New Relic Lambda Integration - <AWS Account ID>". |
102
102
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. This is disabled by default. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
103
+ | `--enable-license-key-secret` | No | Securely manages and store your New Relic license key in `AWS Secrets Manager` |
104
+ | `--enable-cw-ingest` | No | Enable the CloudWatch `log ingest` function |
105
+ | `--disable-cw-ingest` | No | Disable the CloudWatch `log ingest` function |
103
106
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. Default to 128MB. |
104
107
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. |
105
108
  | `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. Defaults to 30 seconds. |
@@ -145,6 +148,7 @@ newrelic-lambda integrations update \
145
148
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
146
149
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
147
150
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
151
+ | `--enable-license-key-secret` | No | Securely manages and store your New Relic license key in `AWS Secrets Manager` |
148
152
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. |
149
153
  | `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. |
150
154
  | `--role-name` | No | Role name for the ingestion function. If you prefer to create and manage an IAM role for the function to assume out of band, do so and specify that role's name here. This avoids needing CAPABILITY_IAM. |
@@ -172,11 +176,16 @@ newrelic-lambda layers install \
172
176
  | `--layer-arn` or `-l` | No | Specify a specific layer version ARN to use. This is auto detected by default. |
173
177
  | `--upgrade` or `-u` | No | Permit upgrade to the latest layer version for this region and runtime. |
174
178
  | `--disable-extension` | No | Disable the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). |
175
- | `--enable-extension-function-logs` | No | Enable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
179
+ | `--enable-extension-function-logs` or `--send-function-logs` | No | Enable sending Lambda function logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
180
+ | `--disable-extension-function-logs` or `--disable-function-logs` | No | Disable sending Lambda function logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension).|
181
+ | `--send-extension-logs` | No | Enable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
182
+ | `--disable-extension-logs` | No | Disable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension).|
176
183
  | `--aws-profile` or `-p` | No | The AWS profile to use for this command. Can also use `AWS_PROFILE`. Will also check `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables if not using AWS CLI. |
177
184
  | `--aws-region` or `-r` | No | The AWS region this function is located. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
178
185
  | `--nr-api-key` or `-k` | No | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
179
186
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
187
+ | `--nr-env-delimite` | No | Set `NR_ENV_DELIMITER` environment variable for your Lambda Function |
188
+ | `--nr-tags` | No | Set `NR_TAGS` environment variable for your Lambda Function |
180
189
  | `--java_handler_method` or `-j` | No | For java runtimes only to specify an aws implementation method. Defaults to RequestHandler. Optional inputs are: handleRequest, handleStreamsRequest `--java_handler_method handleStreamsRequest`. |
181
190
  | `--esm` | No | For Node.js functions using ES Modules (ESM), enable the specific ESM wrapper during installation (e.g., using the --esm flag). This sets the Lambda handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. |
182
191
 
@@ -370,11 +370,12 @@ def retrieve_license_key(gql):
370
370
  return __cached_license_key
371
371
  except Exception:
372
372
  raise click.BadParameter(
373
- "Could not retrieve license key from New Relic. Check that your New Relic "
374
- "Account ID is valid and try again.",
373
+ f"For New Relic Account ID: {gql.account_id}. "
374
+ "Could not retrieve INGEST - LICENSE key from New Relic. "
375
+ "Check that your New Relic Account ID and USER key are valid and try again.",
375
376
  ctx=None,
376
- param="nr_account_id",
377
- param_hint="New Relic Account ID",
377
+ param="nr_api_key",
378
+ param_hint="API Key",
378
379
  )
379
380
 
380
381
 
@@ -94,10 +94,42 @@ def register(group):
94
94
  help="Enable/disable the New Relic Lambda Extension",
95
95
  )
96
96
  @click.option(
97
- "--enable-extension-function-logs/--disable-extension-function-logs",
98
- default=False,
99
- show_default=True,
100
- help="Enable/disable sending Lambda function logs via the Extension",
97
+ "--send-extension-logs",
98
+ is_flag=True,
99
+ help="Enable sending extension logs via the New Relic Lambda Extension",
100
+ )
101
+ @click.option(
102
+ "--disable-extension-logs",
103
+ is_flag=True,
104
+ help="Disable sending extension logs via the New Relic Lambda Extension",
105
+ )
106
+ @click.option(
107
+ "--enable-extension-function-logs",
108
+ is_flag=True,
109
+ help="Enable sending Lambda function logs via the New Relic Lambda Extension",
110
+ )
111
+ @click.option(
112
+ "--disable-extension-function-logs",
113
+ is_flag=True,
114
+ help="Disable sending Lambda function logs via the New Relic Lambda Extension",
115
+ )
116
+ @click.option(
117
+ "--nr-tags",
118
+ help="Set NR_TAGS environment variable for Lambda (e.g. key1:value1;key2:value2)",
119
+ )
120
+ @click.option(
121
+ "--nr-env-delimiter",
122
+ help="Set NR_ENV_DELIMITER environment variable for Lambda (e.g. ',' for comma)",
123
+ )
124
+ @click.option(
125
+ "--send-function-logs",
126
+ is_flag=True,
127
+ help="Enable sending Lambda function logs via the New Relic Lambda Extension",
128
+ )
129
+ @click.option(
130
+ "--disable-function-logs",
131
+ is_flag=True,
132
+ help="Disable sending Lambda function logs via the New Relic Lambda Extension",
101
133
  )
102
134
  @click.option(
103
135
  "--java_handler_method",
@@ -18,6 +18,7 @@ from newrelic_lambda_cli.utils import catch_boto_errors
18
18
 
19
19
  NEW_RELIC_ENV_VARS = (
20
20
  "NEW_RELIC_ACCOUNT_ID",
21
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS",
21
22
  "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS",
22
23
  "NEW_RELIC_LAMBDA_EXTENSION_ENABLED",
23
24
  "NEW_RELIC_LAMBDA_HANDLER",
@@ -25,6 +26,8 @@ NEW_RELIC_ENV_VARS = (
25
26
  "NEW_RELIC_LOG_ENDPOINT",
26
27
  "NEW_RELIC_TELEMETRY_ENDPOINT",
27
28
  "NEW_RELIC_APM_LAMBDA_MODE",
29
+ "NR_TAGS",
30
+ "NR_ENV_DELIMITER",
28
31
  )
29
32
 
30
33
 
@@ -201,10 +204,52 @@ def _add_new_relic(input, config, nr_license_key):
201
204
  "NEW_RELIC_LAMBDA_EXTENSION_ENABLED"
202
205
  ] = "true"
203
206
 
204
- update_kwargs["Environment"]["Variables"][
205
- "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
206
- ] = ("true" if input.enable_extension_function_logs else "false")
207
+ if not input.upgrade:
208
+ update_kwargs["Environment"]["Variables"][
209
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
210
+ ] = "false"
211
+ elif input.enable_extension_function_logs or input.send_function_logs:
212
+ update_kwargs["Environment"]["Variables"][
213
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
214
+ ] = "true"
215
+ success(
216
+ "Successfully enabled NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS tag to the function"
217
+ )
218
+ elif input.disable_extension_function_logs or input.disable_function_logs:
219
+ update_kwargs["Environment"]["Variables"][
220
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
221
+ ] = "false"
222
+ success(
223
+ "Successfully disabled NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS tag to the function"
224
+ )
207
225
 
226
+ if not input.upgrade:
227
+ update_kwargs["Environment"]["Variables"][
228
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
229
+ ] = "false"
230
+ elif input.send_extension_logs:
231
+ update_kwargs["Environment"]["Variables"][
232
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
233
+ ] = "true"
234
+ success(
235
+ "Successfully enabled NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS tag to the function"
236
+ )
237
+ elif input.disable_extension_logs:
238
+ update_kwargs["Environment"]["Variables"][
239
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
240
+ ] = "false"
241
+ success(
242
+ "Successfully disabled NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS tag to the function"
243
+ )
244
+
245
+ if input.nr_tags:
246
+ update_kwargs["Environment"]["Variables"]["NR_TAGS"] = input.nr_tags
247
+ success("Successfully added NR_TAGS tag to the function")
248
+ if input.nr_env_delimiter:
249
+ update_kwargs["Environment"]["Variables"][
250
+ "NR_ENV_DELIMITER"
251
+ ] = input.nr_env_delimiter
252
+ success("Successfully added NR_ENV_DELIMITER tag to the function")
208
253
  if input.nr_region == "staging":
209
254
  update_kwargs["Environment"]["Variables"][
210
255
  "NEW_RELIC_TELEMETRY_ENDPOINT"
@@ -107,6 +107,13 @@ LAYER_INSTALL_KEYS = [
107
107
  "apm",
108
108
  "enable_extension",
109
109
  "enable_extension_function_logs",
110
+ "disable_extension_function_logs",
111
+ "nr_tags",
112
+ "nr_env_delimiter",
113
+ "send_function_logs",
114
+ "disable_function_logs",
115
+ "send_extension_logs",
116
+ "disable_extension_logs",
110
117
  "java_handler_method",
111
118
  "esm",
112
119
  ]
@@ -187,7 +187,9 @@ def parse_arn(arn):
187
187
  result["resource"] = elements[5]
188
188
  result["resourcetype"] = None
189
189
  else:
190
- result["resourcetype"], result["resource"] = elements[5].split("/")
190
+ splitted_arn = elements[5].split("/")
191
+ result["resourcetype"] = splitted_arn[0]
192
+ result["resource"] = "/".join(splitted_arn[1:])
191
193
  return result
192
194
 
193
195
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.9
3
+ Version: 0.9.10
4
4
  Summary: A CLI to install the New Relic AWS Lambda integration and layers.
5
5
  Home-page: https://github.com/newrelic/newrelic-lambda-cli
6
6
  Author: New Relic
@@ -126,6 +126,9 @@ newrelic-lambda integrations install \
126
126
  | `--nr-api-key` or `-k` | Yes | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. |
127
127
  | `--linked-account-name` or `-n` | No | A label for the New Relic Linked Account. This is how this integration will appear in New Relic. Defaults to "New Relic Lambda Integration - <AWS Account ID>". |
128
128
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. This is disabled by default. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
129
+ | `--enable-license-key-secret` | No | Securely manages and store your New Relic license key in `AWS Secrets Manager` |
130
+ | `--enable-cw-ingest` | No | Enable the CloudWatch `log ingest` function |
131
+ | `--disable-cw-ingest` | No | Disable the CloudWatch `log ingest` function |
129
132
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. Default to 128MB. |
130
133
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. |
131
134
  | `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. Defaults to 30 seconds. |
@@ -171,6 +174,7 @@ newrelic-lambda integrations update \
171
174
  | `--disable-logs` or `-d` | No | Disables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ...` afterwards. |
172
175
  | `--enable-logs` or `-e` | No | Enables forwarding logs to New Relic Logging. Make sure you run `newrelic-lambda subscriptions install --function ... --filter-pattern ""` afterwards. |
173
176
  | `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. |
177
+ | `--enable-license-key-secret` | No | Securely manages and store your New Relic license key in `AWS Secrets Manager` |
174
178
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. |
175
179
  | `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. |
176
180
  | `--role-name` | No | Role name for the ingestion function. If you prefer to create and manage an IAM role for the function to assume out of band, do so and specify that role's name here. This avoids needing CAPABILITY_IAM. |
@@ -198,11 +202,16 @@ newrelic-lambda layers install \
198
202
  | `--layer-arn` or `-l` | No | Specify a specific layer version ARN to use. This is auto detected by default. |
199
203
  | `--upgrade` or `-u` | No | Permit upgrade to the latest layer version for this region and runtime. |
200
204
  | `--disable-extension` | No | Disable the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). |
201
- | `--enable-extension-function-logs` | No | Enable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
205
+ | `--enable-extension-function-logs` or `--send-function-logs` | No | Enable sending Lambda function logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
206
+ | `--disable-extension-function-logs` or `--disable-function-logs` | No | Disable sending Lambda function logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension).|
207
+ | `--send-extension-logs` | No | Enable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension). Disabled by default. |
208
+ | `--disable-extension-logs` | No | Disable forwarding logs via the [New Relic Lambda Extension](https://github.com/newrelic/newrelic-lambda-extension).|
202
209
  | `--aws-profile` or `-p` | No | The AWS profile to use for this command. Can also use `AWS_PROFILE`. Will also check `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables if not using AWS CLI. |
203
210
  | `--aws-region` or `-r` | No | The AWS region this function is located. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
204
211
  | `--nr-api-key` or `-k` | No | Your [New Relic User API Key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key). Can also use the `NEW_RELIC_API_KEY` environment variable. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
205
212
  | `--nr-region` | No | The New Relic region to use for the integration. Can use the `NEW_RELIC_REGION` environment variable. Can be either `eu` or `us`. Defaults to `us`. Only used if `--enable-extension` is set and there is no New Relic license key in AWS Secrets Manager. |
213
+ | `--nr-env-delimite` | No | Set `NR_ENV_DELIMITER` environment variable for your Lambda Function |
214
+ | `--nr-tags` | No | Set `NR_TAGS` environment variable for your Lambda Function |
206
215
  | `--java_handler_method` or `-j` | No | For java runtimes only to specify an aws implementation method. Defaults to RequestHandler. Optional inputs are: handleRequest, handleStreamsRequest `--java_handler_method handleStreamsRequest`. |
207
216
  | `--esm` | No | For Node.js functions using ES Modules (ESM), enable the specific ESM wrapper during installation (e.g., using the --esm flag). This sets the Lambda handler to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. |
208
217
 
@@ -6,7 +6,7 @@ README = open(os.path.join(os.path.dirname(__file__), "README.md"), "r").read()
6
6
 
7
7
  setup(
8
8
  name="newrelic-lambda-cli",
9
- version="0.9.9",
9
+ version="0.9.10",
10
10
  python_requires=">=3.3",
11
11
  description="A CLI to install the New Relic AWS Lambda integration and layers.",
12
12
  long_description=README,
@@ -55,7 +55,7 @@ def test_add_new_relic(aws_credentials, mock_function_config):
55
55
  update_kwargs["Environment"]["Variables"][
56
56
  "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
57
57
  ]
58
- == "true"
58
+ == "false"
59
59
  )
60
60
 
61
61
  config = mock_function_config("not.a.runtime")
@@ -384,7 +384,7 @@ def test_add_new_relic_dotnet(aws_credentials, mock_function_config):
384
384
  update_kwargs["Environment"]["Variables"][
385
385
  "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
386
386
  ]
387
- == "true"
387
+ == "false"
388
388
  )
389
389
 
390
390
  # .NET specific environment variables
@@ -462,7 +462,7 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
462
462
  update_kwargs_std["Environment"]["Variables"][
463
463
  "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
464
464
  ]
465
- == "true"
465
+ == "false"
466
466
  )
467
467
 
468
468
  # --- Scenario 2: ESM Node.js Handler (ESM enabled) ---
@@ -514,7 +514,7 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
514
514
  update_kwargs_esm["Environment"]["Variables"][
515
515
  "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
516
516
  ]
517
- == "true"
517
+ == "false"
518
518
  )
519
519
 
520
520
 
@@ -781,3 +781,372 @@ def test_install_success_message_new_layer(aws_credentials, mock_function_config
781
781
  "Successfully installed Layer ARN %s for the function: %s"
782
782
  % (new_layer_arn, function_arn)
783
783
  )
784
+
785
+
786
+ @mock_aws
787
+ def test_extension_logs_flags(aws_credentials, mock_function_config):
788
+ """Test that --send-extension-logs and --disable-extension-logs flags work correctly"""
789
+ session = boto3.Session(region_name="us-east-1")
790
+ nr_account_id = 12345
791
+
792
+ # Test 1: Fresh install with default settings - logs should be disabled by default
793
+ config = mock_function_config("python3.12")
794
+ update_kwargs = _add_new_relic(
795
+ layer_install(
796
+ session=session,
797
+ aws_region="us-east-1",
798
+ nr_account_id=nr_account_id,
799
+ enable_extension=True,
800
+ ),
801
+ config,
802
+ nr_license_key=None,
803
+ )
804
+
805
+ assert (
806
+ update_kwargs["Environment"]["Variables"][
807
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
808
+ ]
809
+ == "false"
810
+ )
811
+
812
+ # Test 2: Fresh install with --send-extension-logs
813
+ config = mock_function_config("python3.12")
814
+ update_kwargs = _add_new_relic(
815
+ layer_install(
816
+ session=session,
817
+ aws_region="us-east-1",
818
+ nr_account_id=nr_account_id,
819
+ enable_extension=True,
820
+ send_extension_logs=True,
821
+ ),
822
+ config,
823
+ nr_license_key=None,
824
+ )
825
+
826
+ assert (
827
+ update_kwargs["Environment"]["Variables"][
828
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
829
+ ]
830
+ == "false"
831
+ )
832
+
833
+ # Test 3: Upgrade with --send-extension-logs - should set to true
834
+ config = mock_function_config("python3.12")
835
+ config["Configuration"]["Environment"]["Variables"][
836
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
837
+ ] = "false"
838
+
839
+ update_kwargs = _add_new_relic(
840
+ layer_install(
841
+ session=session,
842
+ aws_region="us-east-1",
843
+ nr_account_id=nr_account_id,
844
+ enable_extension=True,
845
+ send_extension_logs=True,
846
+ upgrade=True,
847
+ ),
848
+ config,
849
+ nr_license_key=None,
850
+ )
851
+
852
+ assert (
853
+ update_kwargs["Environment"]["Variables"][
854
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
855
+ ]
856
+ == "true"
857
+ )
858
+
859
+ # Test 4: Upgrade with --disable-extension-logs - should set to false
860
+ config = mock_function_config("python3.12")
861
+ config["Configuration"]["Environment"]["Variables"][
862
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
863
+ ] = "true"
864
+
865
+ update_kwargs = _add_new_relic(
866
+ layer_install(
867
+ session=session,
868
+ aws_region="us-east-1",
869
+ nr_account_id=nr_account_id,
870
+ enable_extension=True,
871
+ disable_extension_logs=True,
872
+ upgrade=True,
873
+ ),
874
+ config,
875
+ nr_license_key=None,
876
+ )
877
+
878
+ assert (
879
+ update_kwargs["Environment"]["Variables"][
880
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
881
+ ]
882
+ == "false"
883
+ )
884
+
885
+ # Test 5: Upgrade without flags - should preserve existing value
886
+ config = mock_function_config("python3.12")
887
+ config["Configuration"]["Environment"]["Variables"][
888
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
889
+ ] = "true"
890
+
891
+ update_kwargs = _add_new_relic(
892
+ layer_install(
893
+ session=session,
894
+ aws_region="us-east-1",
895
+ nr_account_id=nr_account_id,
896
+ enable_extension=True,
897
+ upgrade=True,
898
+ ),
899
+ config,
900
+ nr_license_key=None,
901
+ )
902
+
903
+ assert (
904
+ update_kwargs["Environment"]["Variables"][
905
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
906
+ ]
907
+ == "true"
908
+ )
909
+
910
+
911
+ @mock_aws
912
+ def test_function_logs_flags(aws_credentials, mock_function_config):
913
+ """Test that --send-function-logs and --disable-function-logs flags work correctly"""
914
+ session = boto3.Session(region_name="us-east-1")
915
+ nr_account_id = 12345
916
+
917
+ # Test 1: Fresh install with default settings - logs should be disabled by default
918
+ config = mock_function_config("python3.12")
919
+ update_kwargs = _add_new_relic(
920
+ layer_install(
921
+ session=session,
922
+ aws_region="us-east-1",
923
+ nr_account_id=nr_account_id,
924
+ enable_extension=True,
925
+ ),
926
+ config,
927
+ nr_license_key=None,
928
+ )
929
+
930
+ assert (
931
+ update_kwargs["Environment"]["Variables"][
932
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
933
+ ]
934
+ == "false"
935
+ )
936
+
937
+ # Test 2: Fresh install with --send-function-logs - should still be false
938
+ config = mock_function_config("python3.12")
939
+ update_kwargs = _add_new_relic(
940
+ layer_install(
941
+ session=session,
942
+ aws_region="us-east-1",
943
+ nr_account_id=nr_account_id,
944
+ enable_extension=True,
945
+ send_function_logs=True,
946
+ ),
947
+ config,
948
+ nr_license_key=None,
949
+ )
950
+
951
+ assert (
952
+ update_kwargs["Environment"]["Variables"][
953
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
954
+ ]
955
+ == "false"
956
+ )
957
+
958
+ # Test 3: Upgrade with --send-function-logs - should set to true
959
+ config = mock_function_config("python3.12")
960
+ config["Configuration"]["Environment"]["Variables"][
961
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
962
+ ] = "false"
963
+
964
+ update_kwargs = _add_new_relic(
965
+ layer_install(
966
+ session=session,
967
+ aws_region="us-east-1",
968
+ nr_account_id=nr_account_id,
969
+ enable_extension=True,
970
+ send_function_logs=True,
971
+ upgrade=True,
972
+ ),
973
+ config,
974
+ nr_license_key=None,
975
+ )
976
+
977
+ assert (
978
+ update_kwargs["Environment"]["Variables"][
979
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
980
+ ]
981
+ == "true"
982
+ )
983
+
984
+ # Test 4: Upgrade with --disable-function-logs - should set to false
985
+ config = mock_function_config("python3.12")
986
+ config["Configuration"]["Environment"]["Variables"][
987
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
988
+ ] = "true"
989
+
990
+ update_kwargs = _add_new_relic(
991
+ layer_install(
992
+ session=session,
993
+ aws_region="us-east-1",
994
+ nr_account_id=nr_account_id,
995
+ enable_extension=True,
996
+ disable_function_logs=True,
997
+ upgrade=True,
998
+ ),
999
+ config,
1000
+ nr_license_key=None,
1001
+ )
1002
+
1003
+ assert (
1004
+ update_kwargs["Environment"]["Variables"][
1005
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
1006
+ ]
1007
+ == "false"
1008
+ )
1009
+
1010
+ # Test 5: Upgrade without flags - should preserve existing value
1011
+ config = mock_function_config("python3.12")
1012
+ config["Configuration"]["Environment"]["Variables"][
1013
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
1014
+ ] = "true"
1015
+
1016
+ update_kwargs = _add_new_relic(
1017
+ layer_install(
1018
+ session=session,
1019
+ aws_region="us-east-1",
1020
+ nr_account_id=nr_account_id,
1021
+ enable_extension=True,
1022
+ upgrade=True,
1023
+ ),
1024
+ config,
1025
+ nr_license_key=None,
1026
+ )
1027
+
1028
+ assert (
1029
+ update_kwargs["Environment"]["Variables"][
1030
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
1031
+ ]
1032
+ == "true"
1033
+ )
1034
+
1035
+
1036
+ @mock_aws
1037
+ def test_independent_log_settings(aws_credentials, mock_function_config):
1038
+ """Test that function logs and extension logs are independent settings"""
1039
+ session = boto3.Session(region_name="us-east-1")
1040
+ nr_account_id = 12345
1041
+
1042
+ # Test: Upgrade with one flag should not affect the other setting
1043
+ config = mock_function_config("python3.12")
1044
+ config["Configuration"]["Environment"]["Variables"][
1045
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
1046
+ ] = "true"
1047
+ config["Configuration"]["Environment"]["Variables"][
1048
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
1049
+ ] = "true"
1050
+
1051
+ # Set only function logs to false
1052
+ update_kwargs = _add_new_relic(
1053
+ layer_install(
1054
+ session=session,
1055
+ aws_region="us-east-1",
1056
+ nr_account_id=nr_account_id,
1057
+ enable_extension=True,
1058
+ disable_function_logs=True,
1059
+ upgrade=True,
1060
+ ),
1061
+ config,
1062
+ nr_license_key=None,
1063
+ )
1064
+
1065
+ # Function logs should be set to false, extension logs should be preserved
1066
+ assert (
1067
+ update_kwargs["Environment"]["Variables"][
1068
+ "NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS"
1069
+ ]
1070
+ == "false"
1071
+ )
1072
+ assert (
1073
+ update_kwargs["Environment"]["Variables"][
1074
+ "NEW_RELIC_EXTENSION_SEND_EXTENSION_LOGS"
1075
+ ]
1076
+ == "true"
1077
+ )
1078
+
1079
+
1080
+ @mock_aws
1081
+ def test_add_new_relic_sets_nr_tags(aws_credentials, mock_function_config):
1082
+ session = boto3.Session(region_name="us-east-1")
1083
+ config = mock_function_config("python3.12")
1084
+ tags_value = "foo:bar;baz:qux"
1085
+
1086
+ update_kwargs = _add_new_relic(
1087
+ layer_install(
1088
+ session=session,
1089
+ aws_region="us-east-1",
1090
+ nr_account_id=12345,
1091
+ enable_extension=True,
1092
+ enable_extension_function_logs=True,
1093
+ nr_tags=tags_value,
1094
+ ),
1095
+ config,
1096
+ nr_license_key=None,
1097
+ )
1098
+
1099
+ assert update_kwargs["Environment"]["Variables"]["NR_TAGS"] == tags_value
1100
+
1101
+
1102
+ @mock_aws
1103
+ def test_add_new_relic_sets_nr_env_delimiter(aws_credentials, mock_function_config):
1104
+ session = boto3.Session(region_name="us-east-1")
1105
+ config = mock_function_config("python3.12")
1106
+ delimiter_value = "|"
1107
+
1108
+ update_kwargs = _add_new_relic(
1109
+ layer_install(
1110
+ session=session,
1111
+ aws_region="us-east-1",
1112
+ nr_account_id=12345,
1113
+ enable_extension=True,
1114
+ enable_extension_function_logs=True,
1115
+ nr_env_delimiter=delimiter_value,
1116
+ ),
1117
+ config,
1118
+ nr_license_key=None,
1119
+ )
1120
+
1121
+ assert (
1122
+ update_kwargs["Environment"]["Variables"]["NR_ENV_DELIMITER"] == delimiter_value
1123
+ )
1124
+
1125
+
1126
+ @mock_aws
1127
+ def test_add_new_relic_sets_both_nr_tags_and_env_delimiter(
1128
+ aws_credentials, mock_function_config
1129
+ ):
1130
+ session = boto3.Session(region_name="us-east-1")
1131
+ config = mock_function_config("python3.12")
1132
+ tags_value = "foo:bar|baz:qux"
1133
+ delimiter_value = "|"
1134
+
1135
+ update_kwargs = _add_new_relic(
1136
+ layer_install(
1137
+ session=session,
1138
+ aws_region="us-east-1",
1139
+ nr_account_id=12345,
1140
+ enable_extension=True,
1141
+ enable_extension_function_logs=True,
1142
+ nr_tags=tags_value,
1143
+ nr_env_delimiter=delimiter_value,
1144
+ ),
1145
+ config,
1146
+ nr_license_key=None,
1147
+ )
1148
+
1149
+ assert update_kwargs["Environment"]["Variables"]["NR_TAGS"] == tags_value
1150
+ assert (
1151
+ update_kwargs["Environment"]["Variables"]["NR_ENV_DELIMITER"] == delimiter_value
1152
+ )