0

I have integrated a new relic with sails.js 0.12 but in the dashboard of new relic the transaction data is not coming properly it shows me one route like /* which takes the highest response time. I don't understand why this route comes as /*. Please help me with this.enter image description here

SHUBHAM JAIN
  • 44
  • 1
  • 5
  • 1
    Can you write an article or tutorial on how you did new relic with 0.12 - I wanted to do it with 1.0 - readying your article will help me help you. – Noitidart Jul 06 '20 at 04:45

1 Answers1

0

Sure I will tell you everything I did that help you to implement this in you code,

  1. Create an Account with new relic (Signup), It will give you dashboard with 15 days trial.

  2. You will get licence key after signup, We will use in our configuration later.

  3. First we have to insatll NPM package "npm i newrelic --save".

  4. Create newrelic.js file in the root of your project where you place your App.js file.

  5. Copy this cnfiguration and paste in your file created, Here you have to make some changes like app_name and licence key.

    'use strict'

    /**

    • New Relic agent configuration.
    • See lib/config/default.js in the agent distribution for a more complete
    • description of configuration variables and their potential values. / exports.config = { /*
      • Array of application names. / app_name: ['*************'], // ENTER YOU APP NAME, IT WILL SHOW IN NEW RELIC eg. ["MY_APP"] /
      • Your New Relic license key. / license_key: '********************************', // ENTER YOU LICENCE KEY HERE, eg. ['XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX']

    logging: { level: 'info' },

    rules: { ignore : [ '^/socket.io' ] // THIS WILL IGNORE SOCKET.IO BECAUSE NEW RELIC WILL NOT UNDERSTAND THIS AND CHANGE ITS TRANSACTIONS INTO "/*", I WAS ASKING THIS IN MY QUESTION, FINALLY I GOT THIS BY MYSELF :)

    },

    allow_all_headers: true,

    attributes: { exclude: [ 'request.headers.cookie', 'request.headers.authorization', 'request.headers.proxyAuthorization', 'request.headers.setCookie*', 'request.headers.x*', 'response.headers.cookie', 'response.headers.authorization', 'response.headers.proxyAuthorization', 'response.headers.setCookie*', 'response.headers.x*' ] } }

  6. Add new relic module in App.js, Please Place this above all of your code.

    require('newrelic');

  7. After everything just reload your server, and data will populate in New relic dashboard after 5-10 minutes max.

I think this will help you to setup New relic in your Code. If you face any issue. Just comment it.

SHUBHAM JAIN
  • 44
  • 1
  • 5