monitor nodejs applications
Monitor and optimize your Node.js application performance with a Site24x7 APM Insight agent. This agent provides you information on your application's response time, throughput, database operations, and errors. Track these metrics over time to identify where to optimize them for enhanced performance.
Before you can use an APM Insight agent to monitor metrics, you need a [Site24x7 account.][1]
To install APM Insight Node.js agent, follow the below given instructions.
npm i apminsight --save
{"licenseKey" : "",
"appName" : "",
"port" : }
`
If you use proxy connections, enter this code instead.
`
{"licenseKey" : "",
"appName" : "",
"port" : ,
"proxyServerHost" : "",
"proxyServerPort" : ,
"proxyAuthUser" : "",
"proxyAuthPassword" : ""}
`
* You can set configuration values as environment variables using the following keys:
licenseKey - APMINSIGHT_LICENSE_KEY
appName - APMINSIGHT_APP_NAME
port - APMINSIGHT_PORT
proxyServerHost - APMINSIGHT_PROXYSERVER_HOST
proxyServerPort - APMINSIGHT_PROXYSERVER_PORT
proxyAuthUser - APMINSIGHT_PROXYAUTH_USER
proxyAuthPassword - APMINSIGHT_PROXYAUTH_PASSWORD
* Include the given code in the first line of your Node.js application start file, before any other require statements. If using Common JS:
`
require('apminsight');
`
If using ES:
`
import apminsight from 'apminsight';
`
If using TypeScript:
`
import AgentAPI from 'apminsight';
AgentAPI.config();
`
You can alternatively follow any of the methods below, which are common across all JavaScript types.
Using environmental variable:
`
export NODE_OPTIONS="-r apminsight"
`
Include the require statement in the start script or when you start your application.
`
node -r apminsight my-start-file.js
``* Optional: For additional Node.js runtime-level statistics, ensure the [@apminsight/native-stats][2] package is installed.
* Restart your application and perform a few transactions to view data in the APM Insight client.
* Average Response time: The Average response time gives you an overview of the time taken by your app to respond to a request.
* Components overview: [View external components connected with your application][4], as well as the number of ongoing and failed requests. The response time taken by each component is also tracked and shown here.
* Web transactions: Transactions for a chosen time period are shown here along with their recent traces, including error transactions, error components, response time, throughput and HTTP components.
* Database operations: Database operations shows all database operations along with their count and throughput time.
* Trace details: Shows detailed timeline of method calls, database queries and other external compomonents.
* RUM integration: [Integrate your Node.js application with Site24x7 real user monitoring][5] (RUM) to get real-time data, including browser details, JS errors, Ajax calls, and region-specific performance of your application.
[1]: https://www.site24x7.com/application-performance-monitoring.html
[2]: https://www.npmjs.com/package/@apminsight/native-stats
[3]: https://www.site24x7.com/help/apm/nodejs-agent/Install-Node.js-Agent.html#below4.x
[4]: https://www.site24x7.com/application-dependency-maps.html
[5]: https://www.site24x7.com/help/apm/rum.html