newrelic-lambda-cli 0.9.6__py2.py3-none-any.whl → 0.9.8__py2.py3-none-any.whl

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.
@@ -81,6 +81,11 @@ def register(group):
81
81
  help="Permit upgrade of function layers to new version.",
82
82
  is_flag=True,
83
83
  )
84
+ @click.option(
85
+ "--apm",
86
+ help="Enable APM Lambda mode",
87
+ is_flag=True,
88
+ )
84
89
  @click.option(
85
90
  "--enable-extension/--disable-extension",
86
91
  "-x",
@@ -105,8 +110,7 @@ def register(group):
105
110
  )
106
111
  @click.option(
107
112
  "--esm",
108
- default=False,
109
- show_default=True,
113
+ is_flag=True,
110
114
  help="Nodejs runtimes only - nodejs implementation runtime handler to /opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler",
111
115
  )
112
116
  @click.pass_context
@@ -104,7 +104,7 @@ def _add_new_relic(input, config, nr_license_key):
104
104
  prefix = (
105
105
  "/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index"
106
106
  if input.esm
107
- else "newrelic_lambda_wrapper"
107
+ else "newrelic-lambda-wrapper"
108
108
  )
109
109
  runtime_handler = prefix + ".handler"
110
110
 
@@ -118,6 +118,7 @@ def _add_new_relic(input, config, nr_license_key):
118
118
  success(
119
119
  "Already installed on function '%s'. Pass --upgrade (or -u) to allow "
120
120
  "upgrade or reinstall to latest layer version."
121
+ "Additionally pass --apm to enable APM Lambda mode."
121
122
  % config["Configuration"]["FunctionArn"]
122
123
  )
123
124
  return True
@@ -172,7 +173,18 @@ def _add_new_relic(input, config, nr_license_key):
172
173
 
173
174
  # Update the NEW_RELIC_LAMBDA_HANDLER envvars only when it's a new install.
174
175
  if runtime_handler and handler != runtime_handler:
175
- update_kwargs["Environment"]["Variables"]["NEW_RELIC_LAMBDA_HANDLER"] = handler
176
+ if "nodejs" in runtime:
177
+ if handler not in [
178
+ "newrelic-lambda-wrapper.handler",
179
+ "/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler",
180
+ ]:
181
+ update_kwargs["Environment"]["Variables"][
182
+ "NEW_RELIC_LAMBDA_HANDLER"
183
+ ] = handler
184
+ else:
185
+ update_kwargs["Environment"]["Variables"][
186
+ "NEW_RELIC_LAMBDA_HANDLER"
187
+ ] = handler
176
188
 
177
189
  if input.enable_extension and not utils.supports_lambda_extension(runtime):
178
190
  warning(
@@ -221,6 +233,13 @@ def _add_new_relic(input, config, nr_license_key):
221
233
  "CORECLR_PROFILER_PATH"
222
234
  ] = "/opt/lib/newrelic-dotnet-agent/libNewRelicProfiler.so"
223
235
 
236
+ if input.apm:
237
+ success(
238
+ "Enabling APM Lambda mode for function '%s' "
239
+ % config["Configuration"]["FunctionArn"]
240
+ )
241
+ update_kwargs["Environment"]["Variables"]["NEW_RELIC_APM_LAMBDA_MODE"] = "True"
242
+
224
243
  return update_kwargs
225
244
 
226
245
 
@@ -302,7 +321,25 @@ def install(input, function_arn):
302
321
  if input.verbose:
303
322
  click.echo(json.dumps(res, indent=2))
304
323
 
305
- success("Successfully installed layer on %s" % function_arn)
324
+ old_layers = config["Configuration"].get("Layers", [])
325
+ old_layer_arn = old_layers[0]["Arn"].rsplit(":", 1)[0] if old_layers else "None"
326
+ old_layer_version = (
327
+ old_layers[0]["Arn"].split(":")[-1] if old_layers else "None"
328
+ )
329
+ new_layer = update_kwargs["Layers"][0]
330
+ new_layer_arn = update_kwargs["Layers"][0].rsplit(":", 1)[0]
331
+ new_layer_version = update_kwargs["Layers"][0].split(":")[-1]
332
+
333
+ if old_layer_arn == "None":
334
+ success(
335
+ "Successfully installed Layer ARN %s for the function: %s"
336
+ % (new_layer, function_arn)
337
+ )
338
+ else:
339
+ success(
340
+ "Successfully upgraded Layer ARN %s from version: %s to version: %s for the function: %s"
341
+ % (new_layer_arn, old_layer_version, new_layer_version, function_arn)
342
+ )
306
343
  return True
307
344
 
308
345
 
@@ -401,7 +438,11 @@ def uninstall(input, function_arn):
401
438
  if input.verbose:
402
439
  click.echo(json.dumps(res, indent=2))
403
440
 
404
- success("Successfully uninstalled layer on %s" % function_arn)
441
+ old_layers = config["Configuration"].get("Layers", [])
442
+ old_layer_arn = old_layers[0]["Arn"] if old_layers else "None"
443
+ success(
444
+ "Successfully uninstalled Layer %s from %s" % (old_layer_arn, function_arn)
445
+ )
405
446
  return True
406
447
 
407
448
 
@@ -104,6 +104,7 @@ LAYER_INSTALL_KEYS = [
104
104
  "excludes",
105
105
  "layer_arn",
106
106
  "upgrade",
107
+ "apm",
107
108
  "enable_extension",
108
109
  "enable_extension_function_logs",
109
110
  "java_handler_method",
@@ -131,6 +131,12 @@ def all_lambda_regions():
131
131
 
132
132
  def is_valid_handler(runtime, handler):
133
133
  runtime_handler = RUNTIME_CONFIG.get(runtime, {}).get("Handler", None)
134
+ if (
135
+ "nodejs" in runtime
136
+ and handler
137
+ == "/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler"
138
+ ):
139
+ return True
134
140
  if isinstance(runtime_handler, dict):
135
141
  for _, valid_handler in runtime_handler.items():
136
142
  if handler == valid_handler:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.6
3
+ Version: 0.9.8
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
@@ -3,25 +3,25 @@ newrelic_lambda_cli/api.py,sha256=b75XwylRhW9pcA6aZ9EjBW1yIFOGHhhULDD5hNhMyes,15
3
3
  newrelic_lambda_cli/cliutils.py,sha256=XDtvTlgbf2uVg01yCJrfJmmgxbF0nIL9x58ETyvefk8,685
4
4
  newrelic_lambda_cli/functions.py,sha256=p57ZUw424BaSUA_Gw8DrYsJOYKROEHEaXgARadqwcP0,2800
5
5
  newrelic_lambda_cli/integrations.py,sha256=r0gxfEqVHTGu3xbr4dOCDwm0-Yhoz3KntfeQRWvoWrQ,31266
6
- newrelic_lambda_cli/layers.py,sha256=gH7-xRcistsk0GNlgC8VkN1yzz8UDm7g_CRFvUgsg1g,15049
6
+ newrelic_lambda_cli/layers.py,sha256=FOXOpvs0BHHj7XOFMBXuE7TOMiHnFNNxaeNWWnezdYs,16750
7
7
  newrelic_lambda_cli/otel_ingestions.py,sha256=vi1Mlfc9nRvRWV7STwK7fDXZGozG8ufKohmpHcaWGic,9250
8
8
  newrelic_lambda_cli/permissions.py,sha256=H7v5IMpKaJIWC4Dff2YcTis4BKAAFIJr9IHWUj1LnF4,9093
9
9
  newrelic_lambda_cli/subscriptions.py,sha256=-BYkltqiDLdmhUB_Ot4w-5vvrKcQC6aHcTBLl1mlUlI,9564
10
- newrelic_lambda_cli/types.py,sha256=q5m6T027sYWFFCzO_6ADRBZrGG0tIoiROvq9jdEV6G4,3304
11
- newrelic_lambda_cli/utils.py,sha256=98Y0gvJtQk4RfQUrwnrq_tXm9b_0Agg__F5AKvHYqzQ,5663
10
+ newrelic_lambda_cli/types.py,sha256=7c9YIkOlU0ZDgs6yZLHVDEdOeeV-fk3EkuuqRKqqAp8,3315
11
+ newrelic_lambda_cli/utils.py,sha256=mtjhu0DEWOugS6-dS2u9cTSb6oC1TaQze_hFTrbi4Nk,5827
12
12
  newrelic_lambda_cli/cli/__init__.py,sha256=FciF2RVqQbpMKqEiN8qjO6qmdLB6Yv8LyyyPYcfJNrc,622
13
13
  newrelic_lambda_cli/cli/decorators.py,sha256=a3agkVfy8omkUSL4aKblwSX95xtxYOGASULDYcJDPHk,1786
14
14
  newrelic_lambda_cli/cli/functions.py,sha256=RSh2Cowe1_oQup8q5YRidp03z-BITo2uzvDh4zvLr4I,2601
15
15
  newrelic_lambda_cli/cli/integrations.py,sha256=aQAWcCCU2kBmbF8fLKwKB9bzSY0uipvnojajjTkhqEs,10461
16
- newrelic_lambda_cli/cli/layers.py,sha256=sfAoruTDLxWHJoTp9i5A-sz5Lss2vdjJq1qKt5kKIds,6395
16
+ newrelic_lambda_cli/cli/layers.py,sha256=6eWN9yYaL8aZAWXn10MoPe6mH1_hPt8Q5fJ8Zc9oEYM,6454
17
17
  newrelic_lambda_cli/cli/otel_ingestions.py,sha256=4rTm9iYUo2qdMeqxJSrYLCA6ZXHy5bJnjDn9x54pCYc,6096
18
18
  newrelic_lambda_cli/cli/subscriptions.py,sha256=bUupv5iv3mUkC8t31nnI3BahoKxDnUJ8Rgq4QHJcFNU,5890
19
19
  newrelic_lambda_cli/templates/import-template.yaml,sha256=0r1yeoqpnqtEMggWomALkPG10NiANPWWBqz03rChch8,3771
20
20
  newrelic_lambda_cli/templates/license-key-secret.yaml,sha256=ZldQaLXsyF1K2I4X_AsLdH7kRmLkPUYI3talmhqQyHg,1849
21
21
  newrelic_lambda_cli/templates/nr-lambda-integration-role.yaml,sha256=s7T73B_k-mAwgzJrD2xn8YGUNgn2E1V7Exifrl81ViU,2874
22
- newrelic_lambda_cli-0.9.6.dist-info/licenses/LICENSE,sha256=uuxDzQm0yfq_tNZX0tQYzsZUVRIF0jm3dBLZUojSYzI,11345
23
- newrelic_lambda_cli-0.9.6.dist-info/METADATA,sha256=-Om63qSLIoGcrpi5y5nJWJ9cL2RyQfOpwF_lGsKxnE8,27333
24
- newrelic_lambda_cli-0.9.6.dist-info/WHEEL,sha256=oSJJyWjO7Z2XSScFQUpXG1HL-N0sFMqqeKVVbZTPkWc,109
25
- newrelic_lambda_cli-0.9.6.dist-info/entry_points.txt,sha256=iks2k9Y4WNgIecsDzreIvMV9pGCjwwKTf33LKKvl2A8,65
26
- newrelic_lambda_cli-0.9.6.dist-info/top_level.txt,sha256=dxX2w58VgSUFiPD8C_lFuY-T2C1kjfeY0xi8iTh0r44,20
27
- newrelic_lambda_cli-0.9.6.dist-info/RECORD,,
22
+ newrelic_lambda_cli-0.9.8.dist-info/licenses/LICENSE,sha256=uuxDzQm0yfq_tNZX0tQYzsZUVRIF0jm3dBLZUojSYzI,11345
23
+ newrelic_lambda_cli-0.9.8.dist-info/METADATA,sha256=uHoHZrCZ8yyue3qZaNmvSz2tUCrHIwlmDNuOwWNeq1U,27333
24
+ newrelic_lambda_cli-0.9.8.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
25
+ newrelic_lambda_cli-0.9.8.dist-info/entry_points.txt,sha256=iks2k9Y4WNgIecsDzreIvMV9pGCjwwKTf33LKKvl2A8,65
26
+ newrelic_lambda_cli-0.9.8.dist-info/top_level.txt,sha256=dxX2w58VgSUFiPD8C_lFuY-T2C1kjfeY0xi8iTh0r44,20
27
+ newrelic_lambda_cli-0.9.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any