Peter
Peter

Reputation: 2414

Serverless service not populating into New Relic APM dashboard

I added the New Relic plugin serverless-newrelic-lambda-layers to my Serverless application.

I'm seeing outputs in CloudWatch but I'm not seeing my Service in the APM dashboard. Also, I don't understand the messages linked to serverless_mode

Anyone knows why?

[NR_EXT] New Relic Lambda Extension starting up

[NR_EXT] Extension telemetry processing disabled

{
    "v": 0,
    "level": 30,
    "name": "newrelic_bootstrap",
    "hostname": "xxx.xxx.xxx.xxx",
    "pid": 15,
    "time": "2021-01-29T22:05:22.473Z",
    "msg": "Cross application tracing is explicitly disabled in serverless_mode."
}

{
    "v": 0,
    "level": 30,
    "name": "newrelic_bootstrap",
    "hostname": "xxx.xxx.xxx.xxx",
    "pid": 15,
    "time": "2021-01-29T22:05:22.473Z",
    "msg": "The native-metrics module is disabled by default when serverless_mode is enabled.  If desired, enable the native-metrics module via config file or environment variable."
}

EXTENSION   Name: newrelic-lambda-extension State: Ready    Events: [INVOKE,SHUTDOWN]

[1,"NR_LAMBDA_MONITORING","..."]

Upvotes: 1

Views: 1051

Answers (2)

Bushman
Bushman

Reputation: 61

Basic answer is you need to install a Layer that then can can be used by an extension that listens and forwards your events for you. Yes, it will not work as it does with your node.js Javascript running on your laptop as there are restrictions imposed by AWS. You need to install a layer into your AWS lambda. For me, I installed NewRelicNodeJS14X. Read the instructions and you can see a link that will give you choices for your code. https://github.com/newrelic/newrelic-lambda-extension Is the page for the extension that has been developed per the AWS standard described here - https://aws.amazon.com/blogs/compute/using-aws-lambda-extensions-to-send-logs-to-custom-destinations/

I actually only needed to add the Layer and then added the environment variables - NEW_RELIC_ACCOUNT_ID, NEW_RELIC_LAMBDA_HANDLER, and NEW_RELIC_LICENSE_KEY. Note that I did not need to follow the other instructions about - "You'll also need to make the New Relic license key available to the extension. Use the New Relic Lambda CLI to install the managed secret, and then add the permission for the secret to your Lambda execution role." or anything else!

I am actually a bit reluctant to keep going with this solution though and have since switch to a much simpler method. You can simply make an HTTP post method to their events path endpoint and even add an array of events, so as to be able to batch these up! The 1234567 needs to be replaced with your account ID. The abcdefg needs to be replaced with your insert key. Create one here (https://insights.newrelic.com/accounts/your-account-id/manage/api_keys), and note that this is not the place you would think of going to create the key, such as the clicking on your account and going to API Keys! The POST will insert a timestamp for you on the event. This same mechanism works for metrics and logs (https://developer.newrelic.com/collect-data/collect-data-from-any-source/)

curl -i -X POST https://insights-collector.newrelic.com/v1/accounts/1234567/events
-H "Content-Type: application/json"
-H "x-insert-key: abcdefg"
-d '[ { "eventType": "LoginEvent", "message": "This is great!", "service": "LT Master Lambda" } ]'

Upvotes: 0

Salman
Salman

Reputation: 1907

"Cross application tracing is explicitly disabled in serverless_mode."

This error message suggests its related to distributed tracing turned on/off. You have to check the cross application tracing feature which relies HTTP headors to exchange information & can cause some run time warnings/errors.

Upvotes: 0

Related Questions