This guide outlines the major changes between NewRelic.OpenTracing.AmazonLambda.Tracer
and the .NET Agent Lambda layer. It also details the different available options when upgrading, and how to migrate successfully to using the .NET Agent Lambda layer.
重要
Support for instrumenting AWS Lambda functions starts in v10.24.0 of the .NET Agent.
Here are the major changes for this transition:
- The
NewRelic.OpenTracing.AmazonLambda.Tracer
package conflicts with agent instrumentation and must be removed. - Any code changes made to the AWS Lambda function for OpenTracing need to be reverted.
- The New Relic .NET Agent will be used to instrument the AWS Lambda function.
- AWS Lambda Layers are available when you bundle the .NET Agent and the required New Relic Lambda Extension.
- In most cases, the instrumentation of the AWS Lambda function is automatic.
- The .NET Agent relies on the New Relic Lambda extension for sending data in AWS Lambda functions.
- Layers can be configured using the New Relic Lambda CLI tool, a Serverless Framework plugin, or manually.
- Metric names and timings will differ because the way the function is instrumented has fundamentally changed.
- Any dashboard, alerts, or queries that are based on the old metrics will need to be updated after migrating.
Removing NewRelic.OpenTracing.AmazonLambda.Tracer and OpenTracing
The NewRelic.OpenTracing.AmazonLambda.Tracer
package must be removed before using the .NET Agent and any changes made to your AWS Lambda functions to support it must be undone.
- Setting up the
NewRelic.OpenTracing.AmazonLambda.Tracer
package requires creating a newFunctionHandler
that calls the originalFunctionHandler
, wrapping it to enable instrumentation. Before removing theNewRelic.OpenTracing.AmazonLambda.Tracer
you will need to undo that call to make the clean up go more smoothly. - The .NET Agent does not support using OpenTracing APIs to pass custom data. Any changes to your code that relied on OpenTracing APIs, whether directly or via the
NewRelic.OpenTracing.AmazonLambda.Tracer
package, need to be removed or migrated to use .NET Agent APIs. - Remove the
NewRelic.OpenTracing.AmazonLambda.Tracer
package from the your project. Clean up any left over issues related to the removal.
Selecting a layer installation method
After you've removed the NewRelic.OpenTracing.AmazonLambda.Tracer
package the next step is to select which method you will use to install and configure the .NET AWS Lambda layer. As mentioned above there are primarily three options:
- New Relic Lambda CLI
- New Relic Serverless Framework plugin
- Fully manual install
We recommend choosing either the Lambda CLI or the Serverless Framework plugin since they automate most of the configuration. Each have their own dependencies and requirements that need to taken into consideration, some of which will be outlined in the next section. If you already use one of these approaches, we recommend keeping things simple by using the same approach for all of your AWS Lambda functions.
For a complete set of detailed getting started instructions for AWS Lambda monitoring see our enablement guide.
New Relic Lambda CLI
重要
Support for the .NET Agent AWS Lambda layer starts in v0.9.2 of the Lambda CLI.
The Lambda CLI quickstart has an example of the command to update your AWS Lambda function to use the .NET Agent layer. This will automatically detect the runtime of the function and select the appropriate layer. You can find additional setup options in the Lambda CLI repo.
New Relic Serverless Framework plugin
重要
Support for the .NET Agent AWS Lambda layer starts in v5.3.0 of the Serverless Framework plugin.
The Serverless Framework plugin quickstart has the steps required to install the plugin and update the Serverless Framework configuration. You can find additional setup options in the Serverless Framework plugin repo.
Fully manual install
While we don't recommend manually instrumenting your AWS Lambda function, we have information on the steps required to do so here.
- The .NET Agent will automatically instrument your AWS Lambda function, in most cases when installed manually
- The New Relic Lambda Extension is still required for sending data