Skip to content

Commit

Permalink
Merge pull request #17410 from newrelic/sd-containerized-images-ruby
Browse files Browse the repository at this point in the history
fix(serverless): adding ruby for containerized functions
  • Loading branch information
homelessbirds committed May 25, 2024
2 parents 1aea3d8 + 4c0c5a1 commit 8e66ac6
Show file tree
Hide file tree
Showing 3 changed files with 430 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,371 @@ Our <InlinePopover type="alerts" /> let you get notifications on anything you ca
Besides the data we provide by default, you can also set up your own [events](/docs/using-new-relic/welcome-new-relic/get-started/glossary#event) or [attributes](/docs/using-new-relic/welcome-new-relic/get-started/glossary#attribute).

For details about these language-specific settings, see [Configuring custom attributes and events in AWS Lambda](https://discuss.newrelic.com/t/configuring-custom-attributes-and-events-in-aws-lambda/96043).

## Environment variables [#environment]

It's important to configure your Lambda functions with the New Relic environment variables that match your monitoring needs. Choose your runtime to see the available environment variables and our recommendations for default settings.

<CollapserGroup>

<Collapser
id="go"
title="Go"
>

<table>
<thead>
<tr>
<th>Environment variable</th>
<th>Default value</th>
<th>Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`NEW_RELIC_ACCOUNT_ID`</td>
<td></td>
<td></td>
<td>Your New Relic account ID</td>
</tr>
<tr>
<td>`NEW_RELIC_TRUSTED_ACCOUNT_KEY`</td>
<td></td>
<td></td>
<td>Your New Relic account ID or parent ID, if it exists</td>
</tr>
</tbody>
</table>
</Collapser>

<Collapser
id="java"
title="Java OpenTracing"
>
<table>
<thead>
<tr>
<th>Environment variable</th>
<th>Default value</th>
<th>Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`NEW_RELIC_ACCOUNT_ID`</td>
<td></td>
<td></td>
<td>Your New Relic account ID</td>
</tr>
<tr>
<td>`NEW_RELIC_TRUSTED_ACCOUNT_KEY`</td>
<td></td>
<td></td>
<td>Your New Relic account ID or parent ID, if it exists</td>
</tr>
<tr>
<td>`NEW_RELIC_DISTRIBUTED_TRACING_ENABLED`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Enable or disable distributed tracing</td>
</tr>
<tr>
<td>`NEW_RELIC_PRIMARY_APPLICATION_ID`</td>
<td></td>
<td></td>
<td>Your New Relic account ID</td>
</tr>
<tr>
<td>`NEW_RELIC_DEBUG`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Agent log level</td>
</tr>
</tbody>
</table>
</Collapser>

<Collapser
id="node-js"
title="Node.js"
>
<table>
<thead>
<tr>
<th>Environment variable</th>
<th>Default value</th>
<th>Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`NEW_RELIC_ACCOUNT_ID`</td>
<td></td>
<td></td>
<td>Your New Relic account ID</td>
</tr>
<tr>
<td>`NEW_RELIC_TRUSTED_ACCOUNT_KEY`</td>
<td></td>
<td></td>
<td>Your New Relic account ID or parent ID, if it exists</td>
</tr>
<tr>
<td>`NEW_RELIC_DISTRIBUTED_TRACING_ENABLED`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Enable or disable distributed tracing (Java excluded)</td>
</tr>
<tr>
<td>`NEW_RELIC_NO_CONFIG_FILE`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>The Node.js agent uses environment variables in Lambda, so this should be set to `true`</td>
</tr>
<tr>
<td>`NEW_RELIC_APP_NAME`</td>
<td></td>
<td></td>
<td>Should be set but is not used in the New Relic UI. Instead, entity names come from the AWS integration.</td>
</tr>
<tr>
<td>`NEW_RELIC_LOG_ENABLED`</td>
<td>`false`</td>
<td>`true`,`false`</td>
<td>Outputs agent logs to CloudWatch</td>
</tr>
<tr>
<td>`NEW_RELIC_LOG_LEVEL`</td>
<td>`info`</td>
<td>`fatal`, `error`, `warn`, `info`, `debug`, `trace`</td>
<td>Agent log level</td>
</tr>
<tr>
<td>`NEW_RELIC_LOG`</td>
<td>`stdout`</td>
<td>`stdout`</td>
<td>Agent log path should be stdout for the Node.js agent in serverless mode</td>
</tr>
<tr>
<td>`NEW_RELIC_USE_ESM`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>ESM functions that use async/await and not callbacks</td>
</tr>
<tr>
<td>`NEW_RELIC_NATIVE_METRICS_ENABLED`</td>
<td>`true`</td>
<td>`true`, `false`</td>
<td>Should be set to false to reduce cold start duration. When set to `false` it does not collect VM metrics</td>
</tr>
</tbody>
</table>

You can find more environment variables in our [Node.js configuration documentation](/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/).

</Collapser>

<Collapser
id="python"
title="Python"
>
<table>
<thead>
<tr>
<th>Environment variable</th>
<th>Default value</th>
<th>Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`NEW_RELIC_ACCOUNT_ID`</td>
<td></td>
<td></td>
<td>Your New Relic account ID</td>
</tr>
<tr>
<td>`NEW_RELIC_TRUSTED_ACCOUNT_KEY`</td>
<td></td>
<td></td>
<td>Your New Relic account ID or parent ID, if it exists</td>
</tr>
<tr>
<td>`NEW_RELIC_DISTRIBUTED_TRACING_ENABLED`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Enable or disable distributed tracing (Java excluded)</td>
</tr>
<tr>
<td>`NEW_RELIC_NO_CONFIG_FILE`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Agent uses environment variables in Lambda so this should be set to true</td>
</tr>
<tr>
<td>`NEW_RELIC_APP_NAME`</td>
<td></td>
<td></td>
<td>Should be set but is not used in the New Relic UI. Instead, entity names come from the AWS integration.</td>
</tr>
<tr>
<td>`NEW_RELIC_LOG`</td>
<td>`stderr`</td>
<td>`stderr`</td>
<td>Agent log path should be `stderr `for the Python agent in serverless mode</td>
</tr>
<tr>
<td>`NEW_RELIC_LOG_LEVEL`</td>
<td>`info`</td>
<td>`critical`, `error`, `warning`, `info`, `debug`</td>
<td>Agent log level</td>
</tr>
<tr>
<td>`NEW_RELIC_SERVERLESS_MODE_ENABLED`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>This should be set to `true` so the agent will run in serverless mode</td>
</tr>
<tr>
<td>`NEW_RELIC_PACKAGE_REPORTING_ENABLED`</td>
<td>`true`</td>
<td>`true`, `false`</td>
<td>Python agent package reporting should be set to `false` to improve cold start times</td>
</tr>
</tbody>
</table>

You can find more environment variables in our [Python configuration documentation](/docs/apm/agents/python-agent/configuration/python-agent-configuration).
</Collapser>

<Collapser
id="ruby"
title="Ruby"
>
<table>
<thead>
<tr>
<th>Environment variable</th>
<th>Default value</th>
<th>Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`NEW_RELIC_ACCOUNT_ID`</td>
<td></td>
<td></td>
<td>Your New Relic account ID</td>
</tr>
<tr>
<td>`NEW_RELIC_TRUSTED_ACCOUNT_KEY`</td>
<td></td>
<td></td>
<td>Your New Relic account ID or parent ID, if it exists</td>
</tr>
<tr>
<td>`NEW_RELIC_DISTRIBUTED_TRACING_ENABLED`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Enable or disable distributed tracing </td>
</tr>
<tr>
<td>`NEW_RELIC_LAMBDA_HANDLER`</td>
<td></td>
<td></td>
<td>Set to your function's original Handler value</td>
</tr>
</tbody>
</table>
</Collapser>

<Collapser
id="extension"
title="Lambda extension"
>

<table>
<thead>
<tr>
<th>Environment variable</th>
<th>Default value</th>
<th>Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`NEW_RELIC_LAMBDA_EXTENSION_ENABLED`</td>
<td>`true`</td>
<td>`true`, `false` </td>
<td>Enable or disable the extension</td>
</tr>
<tr>
<td>`NEW_RELIC_LICENSE_KEY`</td>
<td></td>
<td></td>
<td>Your New Relic ingest key. This overrides Secrets Manager</td>
</tr>
<tr>
<td>`NEW_RELIC_LICENSE_KEY_SECRET`</td>
<td>`NEW_RELIC_LICENSE_KEY`</td>
<td></td>
<td>Custom secret name in AWS Secrets Manager</td>
</tr>
<tr>
<td>`NEW_RELIC_LAMBDA_HANDLER`</td>
<td></td>
<td></td>
<td>If you don't use New Relic's [manual wrapping method](https://github.com/newrelic/newrelic-lambda-layers?tab=readme-ov-file#note-on-performance-for-es-module-functions) this is your your function's handler.</td>
</tr>
<tr>
<td>`NEW_RELIC_DATA_COLLECTION_TIMEOUT`</td>
<td>10s</td>
<td></td>
<td>Reduce timeout duration when for `Telemetry client error`</td>
</tr>
<tr>
<td>`NEW_RELIC_EXTENSION_LOGS_ENABLED`</td>
<td>`true`</td>
<td>`true`, `false`</td>
<td>Enable or disable `NR_EXT` log lines</td>
</tr>
<tr>
<td>`NEW_RELIC_EXTENSION_LOG_LEVEL`</td>
<td>`info`</td>
<td>`info`, `debug`</td>
<td>log level for NR_EXT log lines</td>
</tr>
<tr>
<td>`NEW_RELIC_EXTENSION_SEND_FUNCTION_LOGS`</td>
<td>`false`</td>
<td>`true`, `false`</td>
<td>Send function logs</td>
</tr>
<tr>
<td>`NEW_RELIC_LOG_ENDPOINT`</td>
<td></td>
<td></td>
<td>Set to https://log-api.newrelic.com/log/v</td>
</tr>
<tr>
<td>`NEW_RELIC_TELEMETRY_ENDPOINT`</td>
<td>Set to [US endpoint](https://cloud-collector.newrelic.com/aws/lambda/v1)</td>
<td></td>
<td>Optional [EU endpoint](https://github.com/newrelic/newrelic-lambda-extension/blob/3c4218dd7727d0b0467f24f0902b616b7f4e46b7/telemetry/client.go#L24-L27)</td>
</tr>
</tbody>
</table>

See more environment variables for the New Relic extension in our [documentation](https://github.com/newrelic/newrelic-lambda-extension/blob/cf86fb53f0bd816e1d09d07f7b5c5ab4841010a0/config/config.go#L41-L55).

</Collapser>
</CollapserGroup>



Loading

0 comments on commit 8e66ac6

Please sign in to comment.