newrelic-lambda-cli 0.9.2__tar.gz → 0.9.4__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.
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/PKG-INFO +72 -3
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/README.md +71 -1
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/api.py +14 -1
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/__init__.py +8 -1
- newrelic_lambda_cli-0.9.4/newrelic_lambda_cli/cli/otel_ingestions.py +219 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/subscriptions.py +72 -32
- newrelic_lambda_cli-0.9.4/newrelic_lambda_cli/cliutils.py +37 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/integrations.py +34 -21
- newrelic_lambda_cli-0.9.4/newrelic_lambda_cli/otel_ingestions.py +276 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/subscriptions.py +93 -4
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/types.py +51 -1
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/PKG-INFO +72 -3
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/SOURCES.txt +2 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/requires.txt +0 -1
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/setup.py +1 -3
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_functions.py +3 -3
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_integrations.py +7 -13
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_layers.py +4 -4
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_subscriptions.py +90 -0
- newrelic_lambda_cli-0.9.2/newrelic_lambda_cli/cliutils.py +0 -38
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/CODE_OF_CONDUCT.md +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/CONTRIBUTING.md +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/LICENSE +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/MANIFEST.in +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/THIRD_PARTY_NOTICES.md +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/__init__.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/decorators.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/functions.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/integrations.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/layers.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/functions.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/layers.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/permissions.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/templates/import-template.yaml +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/templates/license-key-secret.yaml +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/templates/nr-lambda-integration-role.yaml +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/utils.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/dependency_links.txt +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/entry_points.txt +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/not-zip-safe +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli.egg-info/top_level.txt +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/pyproject.toml +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/setup.cfg +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_api.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_new_relic_gql.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_permissions.py +0 -0
- {newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: newrelic-lambda-cli
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.4
|
|
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
|
|
@@ -11,7 +11,6 @@ License-File: LICENSE
|
|
|
11
11
|
Requires-Dist: boto3<5
|
|
12
12
|
Requires-Dist: click>=7.1.2
|
|
13
13
|
Requires-Dist: colorama
|
|
14
|
-
Requires-Dist: emoji<3,>=2
|
|
15
14
|
Requires-Dist: gql<3,>=2
|
|
16
15
|
Requires-Dist: requests<3
|
|
17
16
|
Requires-Dist: tabulate
|
|
@@ -34,6 +33,9 @@ A CLI to install the New Relic AWS Lambda integration and layers.
|
|
|
34
33
|
* [AWS Lambda Layers](#aws-lambda-layers)
|
|
35
34
|
* [AWS Lambda Functions](#aws-lambda-functions)
|
|
36
35
|
* [NewRelic Log Subscription](#newRelic-log-subscription)
|
|
36
|
+
* [NewRelic Otel Log Ingestions](#newRelic-otel-ingestions-install)
|
|
37
|
+
* [NewRelic Otel Log Subscription](#newRelic-otel-log-subscription)
|
|
38
|
+
|
|
37
39
|
* **[Docker](#docker)**
|
|
38
40
|
* **[Contributing](#contributing)**
|
|
39
41
|
* **[Code Style](#code-style)**
|
|
@@ -63,6 +65,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
|
|
|
63
65
|
* nodejs20.x
|
|
64
66
|
* provided
|
|
65
67
|
* provided.al2
|
|
68
|
+
* provided.al2023
|
|
66
69
|
* python3.7
|
|
67
70
|
* python3.8
|
|
68
71
|
* python3.9
|
|
@@ -272,6 +275,72 @@ newrelic-lambda subscriptions uninstall --function <name or arn>
|
|
|
272
275
|
| `--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. |
|
|
273
276
|
| `--aws-region` or `-r` | No | The AWS region this function is located. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
|
|
274
277
|
|
|
278
|
+
### NewRelic Otel Ingestions Install
|
|
279
|
+
|
|
280
|
+
#### Install Otel Log Ingestion
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
newrelic-lambda otel-ingestions install \
|
|
284
|
+
--nr-account-id <account id> \
|
|
285
|
+
--nr-api-key <api key>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
| Option | Required? | Description |
|
|
289
|
+
|--------|-----------|-------------|
|
|
290
|
+
| `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for this integration. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
|
|
291
|
+
| `--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. |
|
|
292
|
+
| `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. Default to 128MB. |
|
|
293
|
+
| `--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`. |
|
|
294
|
+
| `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. Defaults to 30 seconds. |
|
|
295
|
+
| `--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. |
|
|
296
|
+
| `--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. |
|
|
297
|
+
| `--aws-region` or `-r` | No | The AWS region for the integration. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
|
|
298
|
+
| `--aws-role-policy` | No | Specify an alternative IAM role policy ARN for this integration. |
|
|
299
|
+
| `--tag <key> <value>` | No | Sets tags on the CloudFormation Stacks this CLI creates. Can be used multiple times, example: `--tag key1 value1 --tag key2 value2`. |
|
|
300
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
#### Uninstall Otel Log Ingestion
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
newrelic-lambda otel-ingestions uninstall
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
| Option | Required? | Description |
|
|
310
|
+
|--------|-----------|-------------|
|
|
311
|
+
| `--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. |
|
|
312
|
+
| `--aws-region` or `-r` | No | The AWS region for the integration. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
|
|
313
|
+
| `--force` or `-f` | No | Forces uninstall non-interactively |
|
|
314
|
+
| `--nr-account-id` or `-a` | No | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Only required if also uninstalling the New Relic AWS Lambda integration. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
|
|
315
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
316
|
+
|
|
317
|
+
### NewRelic Otel Log Subscription
|
|
318
|
+
|
|
319
|
+
#### Install Otel Log Subscription
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
newrelic-lambda subscriptions install --function <name or arn> --otel
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
| Option | Required? | Description |
|
|
326
|
+
|--------|-----------|-------------|
|
|
327
|
+
| `--function` or `-f` | Yes | The AWS Lambda function name or ARN in which to remove a log subscription. Can provide multiple `--function` arguments. Will also accept `all`, `installed` and `not-installed` similar to `newrelic-lambda functions list`. |
|
|
328
|
+
| `--otel` or `-o` | Yes | Use this flag to install subscription filters for Lambdas that are instrumented with OpenTelemetry (Otel) |
|
|
329
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
#### Uninstall Otel Log Subscription
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
newrelic-lambda subscriptions uninstall --function <name or arn> --otel
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
| Option | Required? | Description |
|
|
339
|
+
|--------|-----------|-------------|
|
|
340
|
+
| `--function` or `-f` | Yes | The AWS Lambda function name or ARN in which to remove a log subscription. Can provide multiple `--function` arguments. Will also accept `all`, `installed` and `not-installed` similar to `newrelic-lambda functions list`. |
|
|
341
|
+
| `--otel` or `-o` | Yes | Use this flag to install subscription filters for Lambdas that are instrumented with OpenTelemetry (Otel) |
|
|
342
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
343
|
+
|
|
275
344
|
## Docker
|
|
276
345
|
|
|
277
346
|
Now, you can run newrelic-lambda-cli as a container.
|
|
@@ -307,7 +376,7 @@ Using these together will auto format your git commits.
|
|
|
307
376
|
## Running Tests
|
|
308
377
|
|
|
309
378
|
```bash
|
|
310
|
-
|
|
379
|
+
pytest tests
|
|
311
380
|
```
|
|
312
381
|
|
|
313
382
|
## Troubleshooting
|
|
@@ -16,6 +16,9 @@ A CLI to install the New Relic AWS Lambda integration and layers.
|
|
|
16
16
|
* [AWS Lambda Layers](#aws-lambda-layers)
|
|
17
17
|
* [AWS Lambda Functions](#aws-lambda-functions)
|
|
18
18
|
* [NewRelic Log Subscription](#newRelic-log-subscription)
|
|
19
|
+
* [NewRelic Otel Log Ingestions](#newRelic-otel-ingestions-install)
|
|
20
|
+
* [NewRelic Otel Log Subscription](#newRelic-otel-log-subscription)
|
|
21
|
+
|
|
19
22
|
* **[Docker](#docker)**
|
|
20
23
|
* **[Contributing](#contributing)**
|
|
21
24
|
* **[Code Style](#code-style)**
|
|
@@ -45,6 +48,7 @@ A CLI to install the New Relic AWS Lambda integration and layers.
|
|
|
45
48
|
* nodejs20.x
|
|
46
49
|
* provided
|
|
47
50
|
* provided.al2
|
|
51
|
+
* provided.al2023
|
|
48
52
|
* python3.7
|
|
49
53
|
* python3.8
|
|
50
54
|
* python3.9
|
|
@@ -254,6 +258,72 @@ newrelic-lambda subscriptions uninstall --function <name or arn>
|
|
|
254
258
|
| `--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. |
|
|
255
259
|
| `--aws-region` or `-r` | No | The AWS region this function is located. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
|
|
256
260
|
|
|
261
|
+
### NewRelic Otel Ingestions Install
|
|
262
|
+
|
|
263
|
+
#### Install Otel Log Ingestion
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
newrelic-lambda otel-ingestions install \
|
|
267
|
+
--nr-account-id <account id> \
|
|
268
|
+
--nr-api-key <api key>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
| Option | Required? | Description |
|
|
272
|
+
|--------|-----------|-------------|
|
|
273
|
+
| `--nr-account-id` or `-a` | Yes | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for this integration. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
|
|
274
|
+
| `--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. |
|
|
275
|
+
| `--memory-size` or `-m` | No | Memory size (in MiB) for the New Relic log ingestion function. Default to 128MB. |
|
|
276
|
+
| `--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`. |
|
|
277
|
+
| `--timeout` or `-t` | No | Timeout (in seconds) for the New Relic log ingestion function. Defaults to 30 seconds. |
|
|
278
|
+
| `--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. |
|
|
279
|
+
| `--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. |
|
|
280
|
+
| `--aws-region` or `-r` | No | The AWS region for the integration. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
|
|
281
|
+
| `--aws-role-policy` | No | Specify an alternative IAM role policy ARN for this integration. |
|
|
282
|
+
| `--tag <key> <value>` | No | Sets tags on the CloudFormation Stacks this CLI creates. Can be used multiple times, example: `--tag key1 value1 --tag key2 value2`. |
|
|
283
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
#### Uninstall Otel Log Ingestion
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
newrelic-lambda otel-ingestions uninstall
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
| Option | Required? | Description |
|
|
293
|
+
|--------|-----------|-------------|
|
|
294
|
+
| `--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. |
|
|
295
|
+
| `--aws-region` or `-r` | No | The AWS region for the integration. Can use `AWS_DEFAULT_REGION` environment variable. Defaults to AWS session region. |
|
|
296
|
+
| `--force` or `-f` | No | Forces uninstall non-interactively |
|
|
297
|
+
| `--nr-account-id` or `-a` | No | The [New Relic Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) for the integration. Only required if also uninstalling the New Relic AWS Lambda integration. Can also use the `NEW_RELIC_ACCOUNT_ID` environment variable. |
|
|
298
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
299
|
+
|
|
300
|
+
### NewRelic Otel Log Subscription
|
|
301
|
+
|
|
302
|
+
#### Install Otel Log Subscription
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
newrelic-lambda subscriptions install --function <name or arn> --otel
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
| Option | Required? | Description |
|
|
309
|
+
|--------|-----------|-------------|
|
|
310
|
+
| `--function` or `-f` | Yes | The AWS Lambda function name or ARN in which to remove a log subscription. Can provide multiple `--function` arguments. Will also accept `all`, `installed` and `not-installed` similar to `newrelic-lambda functions list`. |
|
|
311
|
+
| `--otel` or `-o` | Yes | Use this flag to install subscription filters for Lambdas that are instrumented with OpenTelemetry (Otel) |
|
|
312
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
#### Uninstall Otel Log Subscription
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
newrelic-lambda subscriptions uninstall --function <name or arn> --otel
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
| Option | Required? | Description |
|
|
322
|
+
|--------|-----------|-------------|
|
|
323
|
+
| `--function` or `-f` | Yes | The AWS Lambda function name or ARN in which to remove a log subscription. Can provide multiple `--function` arguments. Will also accept `all`, `installed` and `not-installed` similar to `newrelic-lambda functions list`. |
|
|
324
|
+
| `--otel` or `-o` | Yes | Use this flag to install subscription filters for Lambdas that are instrumented with OpenTelemetry (Otel) |
|
|
325
|
+
| `--stackname` | No | The AWS Cloudformation stack name which contains the newrelic-aws-otel-log-ingestion lambda function. If no value is provided, the command searches for the NewRelicOtelLogIngestion stack |
|
|
326
|
+
|
|
257
327
|
## Docker
|
|
258
328
|
|
|
259
329
|
Now, you can run newrelic-lambda-cli as a container.
|
|
@@ -289,7 +359,7 @@ Using these together will auto format your git commits.
|
|
|
289
359
|
## Running Tests
|
|
290
360
|
|
|
291
361
|
```bash
|
|
292
|
-
|
|
362
|
+
pytest tests
|
|
293
363
|
```
|
|
294
364
|
|
|
295
365
|
## Troubleshooting
|
|
@@ -21,6 +21,9 @@ from newrelic_lambda_cli.types import (
|
|
|
21
21
|
IntegrationInstall,
|
|
22
22
|
IntegrationUpdate,
|
|
23
23
|
LayerInstall,
|
|
24
|
+
OtelIngestionInstall,
|
|
25
|
+
OtelIngestionUninstall,
|
|
26
|
+
OtelIngestionUpdate,
|
|
24
27
|
)
|
|
25
28
|
from newrelic_lambda_cli.utils import parse_arn
|
|
26
29
|
|
|
@@ -333,7 +336,17 @@ class NewRelicGQL(object):
|
|
|
333
336
|
|
|
334
337
|
|
|
335
338
|
def validate_gql_credentials(input):
|
|
336
|
-
|
|
339
|
+
|
|
340
|
+
assert isinstance(
|
|
341
|
+
input,
|
|
342
|
+
(
|
|
343
|
+
IntegrationInstall,
|
|
344
|
+
IntegrationUpdate,
|
|
345
|
+
LayerInstall,
|
|
346
|
+
OtelIngestionInstall,
|
|
347
|
+
OtelIngestionUpdate,
|
|
348
|
+
),
|
|
349
|
+
)
|
|
337
350
|
|
|
338
351
|
try:
|
|
339
352
|
return NewRelicGQL(input.nr_account_id, input.nr_api_key, input.nr_region)
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import click
|
|
4
4
|
|
|
5
|
-
from newrelic_lambda_cli.cli import
|
|
5
|
+
from newrelic_lambda_cli.cli import (
|
|
6
|
+
functions,
|
|
7
|
+
integrations,
|
|
8
|
+
layers,
|
|
9
|
+
otel_ingestions,
|
|
10
|
+
subscriptions,
|
|
11
|
+
)
|
|
6
12
|
|
|
7
13
|
|
|
8
14
|
@click.group()
|
|
@@ -17,6 +23,7 @@ def cli(ctx, verbose):
|
|
|
17
23
|
def register_groups(group):
|
|
18
24
|
functions.register(group)
|
|
19
25
|
integrations.register(group)
|
|
26
|
+
otel_ingestions.register(group)
|
|
20
27
|
layers.register(group)
|
|
21
28
|
subscriptions.register(group)
|
|
22
29
|
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import boto3
|
|
4
|
+
import click
|
|
5
|
+
|
|
6
|
+
from newrelic_lambda_cli import api, otel_ingestions, permissions, integrations
|
|
7
|
+
from newrelic_lambda_cli.types import (
|
|
8
|
+
OtelIngestionInstall,
|
|
9
|
+
OtelIngestionUninstall,
|
|
10
|
+
OtelIngestionUpdate,
|
|
11
|
+
)
|
|
12
|
+
from newrelic_lambda_cli.cli.decorators import add_options, AWS_OPTIONS, NR_OPTIONS
|
|
13
|
+
from newrelic_lambda_cli.cliutils import done, failure
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@click.group(name="otel-ingestions")
|
|
17
|
+
def ingestion_group():
|
|
18
|
+
"""Manage New Relic AWS Lambda Otel Log Ingestion lambda"""
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def register(group):
|
|
23
|
+
group.add_command(ingestion_group)
|
|
24
|
+
ingestion_group.add_command(install)
|
|
25
|
+
ingestion_group.add_command(uninstall)
|
|
26
|
+
ingestion_group.add_command(update)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@click.command(name="install")
|
|
30
|
+
@add_options(AWS_OPTIONS)
|
|
31
|
+
@click.option(
|
|
32
|
+
"--aws-role-policy",
|
|
33
|
+
help="Alternative AWS role policy to use for integration",
|
|
34
|
+
metavar="<arn>",
|
|
35
|
+
)
|
|
36
|
+
@click.option(
|
|
37
|
+
"--stackname",
|
|
38
|
+
default=otel_ingestions.OTEL_INGEST_STACK_NAME,
|
|
39
|
+
help=f"The AWS Cloudformation stack name which contains the {otel_ingestions.OTEL_INGEST_LAMBDA_NAME} lambda function",
|
|
40
|
+
metavar="<arn>",
|
|
41
|
+
show_default=False,
|
|
42
|
+
required=False,
|
|
43
|
+
)
|
|
44
|
+
@click.option(
|
|
45
|
+
"--memory-size",
|
|
46
|
+
"-m",
|
|
47
|
+
default=128,
|
|
48
|
+
help="Memory size (in MiB) for the log ingestion function",
|
|
49
|
+
metavar="<size>",
|
|
50
|
+
show_default=True,
|
|
51
|
+
type=click.INT,
|
|
52
|
+
)
|
|
53
|
+
@add_options(NR_OPTIONS)
|
|
54
|
+
@click.option(
|
|
55
|
+
"--timeout",
|
|
56
|
+
"-t",
|
|
57
|
+
default=30,
|
|
58
|
+
help="Timeout (in seconds) for the New Relic log ingestion function",
|
|
59
|
+
metavar="<secs>",
|
|
60
|
+
show_default=True,
|
|
61
|
+
type=click.INT,
|
|
62
|
+
)
|
|
63
|
+
@click.option(
|
|
64
|
+
"--role-name",
|
|
65
|
+
default=None,
|
|
66
|
+
help="The name of a pre-created execution role for the log ingest function",
|
|
67
|
+
metavar="<role_name>",
|
|
68
|
+
show_default=False,
|
|
69
|
+
)
|
|
70
|
+
@click.option(
|
|
71
|
+
"--tag",
|
|
72
|
+
"tags",
|
|
73
|
+
default=[],
|
|
74
|
+
help="A tag to be added to the CloudFormation Stack (can be used multiple times)",
|
|
75
|
+
metavar="<key> <value>",
|
|
76
|
+
multiple=True,
|
|
77
|
+
nargs=2,
|
|
78
|
+
)
|
|
79
|
+
@click.pass_context
|
|
80
|
+
def install(ctx, **kwargs):
|
|
81
|
+
"""Install New Relic AWS OTEL Ingestion Lambda"""
|
|
82
|
+
input = OtelIngestionInstall(session=None, verbose=ctx.obj["VERBOSE"], **kwargs)
|
|
83
|
+
|
|
84
|
+
input = input._replace(
|
|
85
|
+
session=boto3.Session(
|
|
86
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if input.aws_permissions_check:
|
|
91
|
+
permissions.ensure_integration_install_permissions(input)
|
|
92
|
+
|
|
93
|
+
click.echo("Validating New Relic credentials")
|
|
94
|
+
gql_client = api.validate_gql_credentials(input)
|
|
95
|
+
|
|
96
|
+
click.echo("Retrieving integration license key")
|
|
97
|
+
nr_license_key = api.retrieve_license_key(gql_client)
|
|
98
|
+
|
|
99
|
+
install_success = True
|
|
100
|
+
|
|
101
|
+
click.echo(
|
|
102
|
+
f"Creating {otel_ingestions.OTEL_INGEST_LAMBDA_NAME} Lambda function in AWS account"
|
|
103
|
+
)
|
|
104
|
+
res = otel_ingestions.install_otel_log_ingestion(input, nr_license_key)
|
|
105
|
+
install_success = res and install_success
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@click.command(name="uninstall")
|
|
109
|
+
@add_options(AWS_OPTIONS)
|
|
110
|
+
@click.option(
|
|
111
|
+
"--nr-account-id",
|
|
112
|
+
"-a",
|
|
113
|
+
envvar="NEW_RELIC_ACCOUNT_ID",
|
|
114
|
+
help="New Relic Account ID",
|
|
115
|
+
metavar="<id>",
|
|
116
|
+
required=False,
|
|
117
|
+
type=click.INT,
|
|
118
|
+
)
|
|
119
|
+
@click.option(
|
|
120
|
+
"--stackname",
|
|
121
|
+
default=otel_ingestions.OTEL_INGEST_STACK_NAME,
|
|
122
|
+
help=f"The AWS Cloudformation stack name which contains the {otel_ingestions.OTEL_INGEST_LAMBDA_NAME} lambda function",
|
|
123
|
+
metavar="<arn>",
|
|
124
|
+
show_default=False,
|
|
125
|
+
required=False,
|
|
126
|
+
)
|
|
127
|
+
@click.option("--force", "-f", help="Force uninstall non-interactively", is_flag=True)
|
|
128
|
+
def uninstall(**kwargs):
|
|
129
|
+
"""Uninstall New Relic AWS OTEL Ingestion Lambda"""
|
|
130
|
+
input = OtelIngestionUninstall(session=None, **kwargs)
|
|
131
|
+
|
|
132
|
+
input = input._replace(
|
|
133
|
+
session=boto3.Session(
|
|
134
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
if input.aws_permissions_check:
|
|
139
|
+
permissions.ensure_integration_uninstall_permissions(input)
|
|
140
|
+
|
|
141
|
+
integrations.remove_log_ingestion_function(input, otel=True)
|
|
142
|
+
|
|
143
|
+
done("Uninstall Complete")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@click.command(name="update")
|
|
147
|
+
@add_options(AWS_OPTIONS)
|
|
148
|
+
@click.option(
|
|
149
|
+
"--stackname",
|
|
150
|
+
default=otel_ingestions.OTEL_INGEST_STACK_NAME,
|
|
151
|
+
help=f"The AWS Cloudformation stack name which contains the {otel_ingestions.OTEL_INGEST_LAMBDA_NAME} lambda function",
|
|
152
|
+
metavar="<arn>",
|
|
153
|
+
show_default=False,
|
|
154
|
+
required=False,
|
|
155
|
+
)
|
|
156
|
+
@click.option(
|
|
157
|
+
"--memory-size",
|
|
158
|
+
"-m",
|
|
159
|
+
help="Memory size (in MiB) for the log ingestion function",
|
|
160
|
+
metavar="<size>",
|
|
161
|
+
type=click.INT,
|
|
162
|
+
)
|
|
163
|
+
@add_options(NR_OPTIONS)
|
|
164
|
+
@click.option(
|
|
165
|
+
"--timeout",
|
|
166
|
+
"-t",
|
|
167
|
+
help="Timeout (in seconds) for the New Relic log ingestion function",
|
|
168
|
+
metavar="<secs>",
|
|
169
|
+
type=click.INT,
|
|
170
|
+
)
|
|
171
|
+
@click.option(
|
|
172
|
+
"--role-name",
|
|
173
|
+
default=None,
|
|
174
|
+
help="The name of a new pre-created execution role for the log ingest function",
|
|
175
|
+
metavar="<role_name>",
|
|
176
|
+
show_default=False,
|
|
177
|
+
)
|
|
178
|
+
@click.option(
|
|
179
|
+
"--stackname",
|
|
180
|
+
default="NewRelicOtelLogIngestion",
|
|
181
|
+
help="The AWS Cloudformation stack name which contains the newrelic-log-ingestion lambda function",
|
|
182
|
+
metavar="<arn>",
|
|
183
|
+
show_default=False,
|
|
184
|
+
required=False,
|
|
185
|
+
)
|
|
186
|
+
@click.option(
|
|
187
|
+
"--tag",
|
|
188
|
+
"tags",
|
|
189
|
+
default=[],
|
|
190
|
+
help="A tag to be added to the CloudFormation Stack (can be used multiple times)",
|
|
191
|
+
metavar="<key> <value>",
|
|
192
|
+
multiple=True,
|
|
193
|
+
nargs=2,
|
|
194
|
+
)
|
|
195
|
+
def update(**kwargs):
|
|
196
|
+
"""UpdateNew New Relic AWS OTEL Ingestion Lambda"""
|
|
197
|
+
input = OtelIngestionUpdate(session=None, **kwargs)
|
|
198
|
+
|
|
199
|
+
input = input._replace(
|
|
200
|
+
session=boto3.Session(
|
|
201
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
202
|
+
)
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
if input.aws_permissions_check:
|
|
206
|
+
permissions.ensure_integration_install_permissions(input)
|
|
207
|
+
|
|
208
|
+
update_success = True
|
|
209
|
+
|
|
210
|
+
click.echo(
|
|
211
|
+
f"Updating {otel_ingestions.OTEL_INGEST_LAMBDA_NAME} Lambda function in AWS account"
|
|
212
|
+
)
|
|
213
|
+
res = otel_ingestions.update_otel_log_ingestion(input)
|
|
214
|
+
update_success = res and update_success
|
|
215
|
+
|
|
216
|
+
if update_success:
|
|
217
|
+
done("Update Complete")
|
|
218
|
+
else:
|
|
219
|
+
failure("Update Incomplete. See messages above for details.", exit=True)
|
{newrelic_lambda_cli-0.9.2 → newrelic_lambda_cli-0.9.4}/newrelic_lambda_cli/cli/subscriptions.py
RENAMED
|
@@ -61,9 +61,23 @@ def register(group):
|
|
|
61
61
|
metavar="<pattern>",
|
|
62
62
|
show_default=False,
|
|
63
63
|
)
|
|
64
|
+
@click.option(
|
|
65
|
+
"--otel",
|
|
66
|
+
"-o",
|
|
67
|
+
help="Subscribe to OTEL log ingestion function",
|
|
68
|
+
is_flag=True,
|
|
69
|
+
)
|
|
64
70
|
def install(**kwargs):
|
|
65
71
|
"""Install New Relic AWS Lambda Log Subscriptions"""
|
|
66
72
|
input = SubscriptionInstall(session=None, **kwargs)
|
|
73
|
+
if input.otel and input.filter_pattern == DEFAULT_FILTER_PATTERN:
|
|
74
|
+
input = input._replace(
|
|
75
|
+
filter_pattern="",
|
|
76
|
+
)
|
|
77
|
+
if input.otel and input.stackname == "NewRelicLogIngestion":
|
|
78
|
+
input = input._replace(
|
|
79
|
+
stackname="NewRelicOtelLogIngestion",
|
|
80
|
+
)
|
|
67
81
|
input = input._replace(
|
|
68
82
|
session=boto3.Session(
|
|
69
83
|
profile_name=input.aws_profile, region_name=input.aws_region
|
|
@@ -75,18 +89,32 @@ def install(**kwargs):
|
|
|
75
89
|
functions = get_aliased_functions(input)
|
|
76
90
|
|
|
77
91
|
with ThreadPoolExecutor() as executor:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
if input.otel:
|
|
93
|
+
futures = [
|
|
94
|
+
executor.submit(
|
|
95
|
+
subscriptions.create_otel_log_subscription,
|
|
96
|
+
input._replace(
|
|
97
|
+
session=boto3.Session(
|
|
98
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
99
|
+
)
|
|
100
|
+
),
|
|
101
|
+
function,
|
|
102
|
+
)
|
|
103
|
+
for function in functions
|
|
104
|
+
]
|
|
105
|
+
else:
|
|
106
|
+
futures = [
|
|
107
|
+
executor.submit(
|
|
108
|
+
subscriptions.create_log_subscription,
|
|
109
|
+
input._replace(
|
|
110
|
+
session=boto3.Session(
|
|
111
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
112
|
+
)
|
|
113
|
+
),
|
|
114
|
+
function,
|
|
115
|
+
)
|
|
116
|
+
for function in functions
|
|
117
|
+
]
|
|
90
118
|
install_success = all(future.result() for future in as_completed(futures))
|
|
91
119
|
|
|
92
120
|
if install_success:
|
|
@@ -106,14 +134,6 @@ def install(**kwargs):
|
|
|
106
134
|
multiple=True,
|
|
107
135
|
required=True,
|
|
108
136
|
)
|
|
109
|
-
@click.option(
|
|
110
|
-
"--stackname",
|
|
111
|
-
default="NewRelicLogIngestion",
|
|
112
|
-
help="The AWS Cloudformation stack name which contains the newrelic-log-ingestion lambda function",
|
|
113
|
-
metavar="<arn>",
|
|
114
|
-
show_default=False,
|
|
115
|
-
required=False,
|
|
116
|
-
)
|
|
117
137
|
@click.option(
|
|
118
138
|
"excludes",
|
|
119
139
|
"--exclude",
|
|
@@ -122,6 +142,12 @@ def install(**kwargs):
|
|
|
122
142
|
metavar="<name>",
|
|
123
143
|
multiple=True,
|
|
124
144
|
)
|
|
145
|
+
@click.option(
|
|
146
|
+
"--otel",
|
|
147
|
+
"-o",
|
|
148
|
+
help="Subscribe to OTEL log ingestion function",
|
|
149
|
+
is_flag=True,
|
|
150
|
+
)
|
|
125
151
|
def uninstall(**kwargs):
|
|
126
152
|
"""Uninstall New Relic AWS Lambda Log Subscriptions"""
|
|
127
153
|
input = SubscriptionUninstall(session=None, **kwargs)
|
|
@@ -136,18 +162,32 @@ def uninstall(**kwargs):
|
|
|
136
162
|
functions = get_aliased_functions(input)
|
|
137
163
|
|
|
138
164
|
with ThreadPoolExecutor() as executor:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
165
|
+
if input.otel:
|
|
166
|
+
futures = [
|
|
167
|
+
executor.submit(
|
|
168
|
+
subscriptions.remove_otel_log_subscription,
|
|
169
|
+
input._replace(
|
|
170
|
+
session=boto3.Session(
|
|
171
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
172
|
+
)
|
|
173
|
+
),
|
|
174
|
+
function,
|
|
175
|
+
)
|
|
176
|
+
for function in functions
|
|
177
|
+
]
|
|
178
|
+
else:
|
|
179
|
+
futures = [
|
|
180
|
+
executor.submit(
|
|
181
|
+
subscriptions.remove_log_subscription,
|
|
182
|
+
input._replace(
|
|
183
|
+
session=boto3.Session(
|
|
184
|
+
profile_name=input.aws_profile, region_name=input.aws_region
|
|
185
|
+
)
|
|
186
|
+
),
|
|
187
|
+
function,
|
|
188
|
+
)
|
|
189
|
+
for function in functions
|
|
190
|
+
]
|
|
151
191
|
uninstall_success = all(future.result() for future in as_completed(futures))
|
|
152
192
|
|
|
153
193
|
if uninstall_success:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from click.exceptions import Exit
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def done(message):
|
|
9
|
+
"""Prints a done message to the terminal"""
|
|
10
|
+
click.echo(f"✔️ {message} ✔️")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def failure(message, exit=False):
|
|
14
|
+
"""Prints a failure message to the terminal"""
|
|
15
|
+
click.secho(
|
|
16
|
+
f"✘ {message}",
|
|
17
|
+
fg="red",
|
|
18
|
+
err=True,
|
|
19
|
+
)
|
|
20
|
+
if exit:
|
|
21
|
+
raise Exit(1)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def success(message):
|
|
25
|
+
"""Prints a success message to the terminal"""
|
|
26
|
+
click.secho(
|
|
27
|
+
f"✔️ {message}",
|
|
28
|
+
fg="green",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def warning(message):
|
|
33
|
+
"""Prints a warning message to the terminal"""
|
|
34
|
+
click.secho(
|
|
35
|
+
f"⚠️ {message}",
|
|
36
|
+
fg="blue",
|
|
37
|
+
)
|