npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jaketig/nuxt-newrelic

v1.0.0

Published

A Nuxt 2 Module to add NewRelic APM / Browser monitoring to your project

Downloads

209

Readme

nuxt-newrelic

A Nuxt 2 Module to add NewRelic APM / Browser monitoring to your project

Setup

  1. Add nuxt-newrelic dependency to your project
npm install @jaketig/nuxt-newrelic
  1. Add nuxt-newrelic to the modules section of nuxt.config.js
export default {
  modules: [
    '@jaketig/nuxt-newrelic'
  ]
}
  1. Add newrelic.js and newrelic_agent.log to .gitignore
newrelic.js
newrelic_agent.log

Configure

Runtime Config

Runtime config allows the use of environment specific variable at startup. Only Private Runtime Config is supported as license keys should not be exposed publicly

export default {
  modules: [
    '@jaketig/nuxt-newrelic'
  ],
  privateRuntimeConfig: {
    newrelic: {
      apm: {
        enabled: true,
        appName: 'YOUR APP NAME HERE',
        licenseKey: 'YOUR LICENSE KEY HERE',
        // additional agent config can be added here
      },
      browser: {
        enabled: false,
        scriptId: 'newrelic',
        accountId: 'YOUR NEW RELIC ACCOUNT ID HERE',
        agentId: 'YOUR NEW RELIC AGENT ID HERE',
        licenseKey: 'YOUR NEW RELIC LICENSE KEY HERE',
        applicationId: 'YOUR NEW RELIC APPLICATION ID HERE'
      }
    }
  },
}

Nuxt Config

Nuxt config values are hardcoded at build time

export default {
  modules: [
    '@jaketig/nuxt-newrelic'
  ],
  newrelic: {
    apm: {
      enabled: true,
      appName: 'YOUR APP NAME HERE',
      licenseKey: 'YOUR LICENSE KEY HERE',
      // additional agent config can be added here
    },
    browser: {
      enabled: false,
      scriptId: 'newrelic',
      accountId: 'YOUR NEW RELIC ACCOUNT ID HERE',
      agentId: 'YOUR NEW RELIC AGENT ID HERE',
      licenseKey: 'YOUR NEW RELIC LICENSE KEY HERE',
      applicationId: 'YOUR NEW RELIC APPLICATION ID HERE'
    }
  }
}

Options

apm (object)

enabled (boolean)

  • Determines if newrelic APM is enabled or not.
  • Defaults to true if production, false if development
  • excluded from newrelic.js config file
export default {
  newrelic: {
    apm: {
      enabled: true
    }
  }
}

app_name (string) required

export default {
  newrelic: {
    apm: {
      app_name: `YOUR APP NAME HERE`       
    }
  }
}

license_key (string) required

export default {
  newrelic: {
    apm: {
      license_key: `YOUR NEWRELIC LICENSE KEY`
    }
  }
}

Additional Properties

Any additional fields included in the apm object will be included in the generated newrelic.js config file. See New Relic docs for all available options.

For example, logging can be disabled:

export default {
  newrelic: {
    apm: {
      logging: {
        enabled: false
      }
    }
  }
}

browser (object)

  • Configures New Relic browser monitoring by adding a script to the page head at build/startup
  • Requires APM to be enabled
  • Does not support functional nuxt/head

enabled (boolean)

  • Determines if newrelic Browser Monitoring is enabled or not.
  • Defaults to false
export default {
  newrelic: {
    browser: {
      enabled: false
    }
  }
}

accountId (string)

  • New Relic account id
  • populated in browser script

agentId (string)

  • New Relic agent id
  • populated in browser script

licenseKey (string)

  • New Relic license key
  • populated in browser script

applicationId (string)

  • New Relic application id
  • populated in browser script

Where do I find the browser settings?

  1. Login to the New Relic portal
  2. Click Add Data
  3. Choose Browser Monitoring
  4. Select Copy/Paste Javascript Code
  5. Complete the Name your App section
  6. Copy the values from the provided script