Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including aws-lambda-newrelic with all npm packages installed. Try it out:

var awsLambdaNewrelic = require("aws-lambda-newrelic")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

aws-lambda-newrelic v1.0.2

AWS Lambda integration with New Relic sending Custom Events

Lambda Newrelic Integration

When you create your a AWS Lambda and you need to send customEvents to Insights, you can use this library to make this task easy.

Installation

npm install --save aws-lambda-newrelic

How to Use

This packet have a function called insertCustomEvent, this function receive 3 parameters:

  • eventName: a string to define the name to the Custom Event.
  • data: JSON object structure.
  • callback: a callback function to receive (error, data).

Additional, this newrelic integration need to use two environment variables:

  • NEWRELIC_KEY: NewRelic Insert Key
  • NEWRELIC_ACCOUNT: NewRelic Account to insert

Example

  const lambdaNewRelic = require('aws-lambda-newrelic');
 
  exports.handler = (event, context, callback) => {
    // method needs at least 3 parameters
    // eventName, data, callback
    lambdaNewRelic.insertCustomEvent('TestEvent', {"name": "Alex Mejicanos"}, (error, data) => {});
    
    callback(null, 'Its Ok');
  };
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free