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

@apminsight/next

v1.1.0

Published

This is the official Next.js framework instrumentation for the APM Insight Node.js agent.

Downloads

1,276

Readme

APM Insight Next.js instrumentation

This is the official Next.js framework instrumentation for the APM Insight Node.js agent.

The Site24x7 Node.js agent uses the APM Insight Next.js package to monitor the application key metrics and Next.js-specific metrics in the back-end. If you want to monitor the front-end metrics such as web vitals, AJAX calls, and pageviews, you need to inject the RUM script into the header or footer of the index page or a common page of your application. These metrics can help improve your application's performance and identify bottlenecks in the application.

Note:

  • The minimum supported Next.js version is 12.0.9.
  • The APM Insight Next.js package does not provide any instrumentation for actions that occur during the build or in client-side code.

Before you can use Next.js module, you need to install the Site24x7 Node.js agent.

Table of contents:

  • Installation
  • Configuration
  • Set configuration values
  • Performance Metrics

Installation

This package is not bundled with the agent and must be installed separately. However, the package depends on the agent, so you will get all the agent's capabilities while loading this package.

  • Run the following command in your Next.js project to install the APM Insight Node.js (APM) agent and APM Insight middleware for Next.js.
   npm install apminsight @apminsight/next
  • When the command is completed successfully, the dependencies will be listed in your package.json file.
   "dependencies": {
   "@apminsight/next": "^1.0.0",
   "apminsight": "^3.1.2",
   "next": "latest",
    },

Configuration

Method 1: Next, modify your dev and start npm scripts by updating the scripts section of the package.json file. Allow your application to run with the Node’s -r option, which will preload @apminsight/next middleware.

NODE_OPTIONS='-r @apminsight/next' next start

The scripts section should look like the following:

"scripts": {
"dev": "NODE_OPTIONS='-r @apminsight/next' next",
"build": "next build",
"start": "NODE_OPTIONS='-r @apminsight/next' next start"
},

Method 2: If you have no control over how your program is executed, you can load the @apminsight/next module before any other module. However, we recommend you avoid using this method at all costs. We discovered that bundling when running the next build causes issues and makes your bundle unnecessarily large.

require('@apminsight/next')
/* ... the rest of your program ... */

Method 3: For Custom Next.js servers: If you're using Next as a custom server, you're probably not running your application using the Next CLI. In that case, we recommend executing the Next.js instrumentation as shown below.

node -r @apminsight/next your-start-file.js

Set configuration values

If you want to configure in the file, follow the steps below:

  • Create a new file named apminsightnode.json and place it in the directory where you run the application.
  • Add the below code snippet in the file.
	{"licenseKey" : "<license-key>",
	"appName" : "<application-name>",
	"port" : <application-port> }

If you are using proxy:

    {"licenseKey" : "<license-key>",
	"appName" : "<application-name>",
	"port" : <application-port>,
	"proxyServerHost" : "<proxy-server>",
	"proxyServerPort" : <proxy-port>,
	"proxyAuthUser" : "<proxy-user-name>",
	"proxyAuthPassword" : "<proxy-password>"}

Note: You can also configure the values as environment variables.

Performance metrics

To view the metrics in the client:

  • Log in to your Site24x7 web client
  • Navigate to APM > your Node.js application.
  • Select the time frame for which you need the metrics. For which you can see your application’s server-side data flowing into the application monitor.