Skip to content

Commit

Permalink
fix(serverless): fixing indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
homelessbirds committed Apr 22, 2024
1 parent a33e362 commit 2f96ede
Showing 1 changed file with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,31 +282,32 @@ On this page, you will learn how to manually instrument your lambda function. It
>
There are two ways to instrument your Ruby Lambda functions: automatically or manually.

Automatic instrumentation:
Automatic instrumentation:

1. Download and install our Lambda CLI tool, [newrelic-lambda-cli](https://github.com/newrelic/newrelic-lambda-cli).
2. Use the tool to issue a `newrelic-lambda integrations install` command. See the [usage instructions](https://github.com/newrelic/newrelic-lambda-cli?tab=readme-ov-file#usage) for more information.

Manual instrumentation:

1. Navigate to the **Lambda** service section in the AWS web console. From there, find the Lambda function you would like to connect to New Relic.
2. In the default **Code** tab, scroll down to the **Layers** section and click on the **Add a layer** button.
3. Click the **Create layer** button.
4. Now go to the **Choose a layer** and select the **Specify an ARN** option.
5. Go to [New Relic's list of layers](https://layers.newrelic-external.com/) and use the drop-down list to select the AWS region where your Lambda function is hosted. From there, locate the ARN that matches your Lambda function's Ruby version and architecture. There should be options, either X86 or ARM64. Use the **Copy to clipboard** button or manually copy the ARN string.
6. In the **Specify an ARN** section of the AWS console form, paste in the New Relic Lambda layer ARN.
7. On the AWS console form, click the **Add** button to add the layer to your Lambda function.
8. On your Lambda function's page, with the default **Code** tab selected, scroll down to the **Runtime settings** section and click the **Edit** button.
9. Make a safe copy of the existing **Handler** value. You'll need it for a later step.
10. Change the **Handler** value to: `newrelic_lambda_wrapper.handler` and click **Save**.
11. Switch to the "Configuration" tab on your Lambda function's page.
12. Select the **Environment variables** sub-tab.
13. Define the following environment variables:
1. Use the tool to issue a `newrelic-lambda integrations install` command. See the [usage instructions](https://github.com/newrelic/newrelic-lambda-cli?tab=readme-ov-file#usage) for more information.

Manual instrumentation:

1. Navigate to the **Lambda** service section in the AWS web console. From there, find the Lambda function you would like to connect to New Relic.
1. In the default **Code** tab, scroll down to the **Layers** section and click on the **Add a layer** button.
1. Click the **Create layer** button.
1. Now go to the **Choose a layer** and select the **Specify an ARN** option.
1. Go to [New Relic's list of layers](https://layers.newrelic-external.com/) and use the drop-down list to select the AWS region where your Lambda function is hosted. From there, locate the ARN that matches your Lambda function's Ruby version and architecture. There should be options, either X86 or ARM64. Use the **Copy to clipboard** button or manually copy the ARN string.
1. In the **Specify an ARN** section of the AWS console form, paste in the New Relic Lambda layer ARN.
1. On the AWS console form, click the **Add** button to add the layer to your Lambda function.
1. On your Lambda function's page, with the default **Code** tab selected, scroll down to the **Runtime settings** section and click the **Edit** button.
1. Make a safe copy of the existing **Handler** value. You'll need it for a later step.
1. Change the **Handler** value to: `newrelic_lambda_wrapper.handler` and click **Save**.
1. Switch to the "Configuration" tab on your Lambda function's page.
1. Select the **Environment variables** sub-tab.
1. Define the following environment variables:
* `NEW_RELIC_ACCOUNT_ID` Set to your New Relic [account ID](/docs/accounts/install-new-relic/account-setup/account-id)
* `NEW_RELIC_LAMBDA_HANDLER` Set to your function's original Handler value copied down in step 8 earlier
* `NEW_RELIC_LICENSE_KEY` Set to your New Relic license key
* `NEW_RELIC_LOG_ENDPOINT` Set to 'https://log-api.newrelic.com/log/v1'
* `NEW_RELIC_TELEMETRY_ENDPOINT` Set to 'https://cloud-collector.newrelic.com/aws/lambda/v1'
13. If you wish to send your Lambda function's logs to New Relic, which will include everything your function writes to STDOUT, make sure you set the `NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS` environment variable to 'true'.
1. If you wish to send your Lambda function's logs to New Relic, which will include everything your function writes to STDOUT, make sure you set the `NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS` environment variable to 'true'.

<Callout variant="tip">
The New Relic layer will automatically deliver the New Relic Ruby agent and be loaded via a Ruby `require` prior to your Lambda function's invocation. To avoid conflicts, do not include a copy of the Ruby agent anywhere else. Feel free to perform any desired New Relic Ruby agent API calls within your function to take advantage of the agent's presence.
Expand Down

0 comments on commit 2f96ede

Please sign in to comment.