What is @elastic/apm-rum?
@elastic/apm-rum is an Elastic APM Real User Monitoring (RUM) agent for JavaScript applications. It helps you monitor the performance of your web applications by collecting and sending performance metrics and errors to the Elastic APM server.
What are @elastic/apm-rum's main functionalities?
Initialize APM
This code initializes the APM agent with the specified service name, server URL, and environment. It sets up the agent to start collecting performance metrics and errors.
const apm = require('@elastic/apm-rum').init({
serviceName: 'my-service',
serverUrl: 'http://localhost:8200',
environment: 'production'
});
Capture Page Load Metrics
This code starts a transaction for capturing page load metrics. It helps in measuring the time taken for the page to load completely.
apm.startTransaction('page-load', 'page-load');
Capture Custom Transactions
This code demonstrates how to capture custom transactions. You can start a transaction, perform some operations, and then end the transaction to measure the time taken for those operations.
const transaction = apm.startTransaction('custom-transaction', 'custom');
// Perform some operations
transaction.end();
Capture Errors
This code captures errors and sends them to the APM server. It helps in monitoring and debugging issues in your application.
try {
// Some code that might throw an error
} catch (error) {
apm.captureError(error);
}
Other packages similar to @elastic/apm-rum
newrelic
New Relic is a comprehensive monitoring tool that provides performance monitoring for web and mobile applications. It offers similar functionalities to @elastic/apm-rum, such as capturing performance metrics and errors, but also includes additional features like infrastructure monitoring and synthetic monitoring.
datadog-rum
Datadog RUM (Real User Monitoring) is a part of the Datadog monitoring suite. It provides similar functionalities to @elastic/apm-rum, including capturing performance metrics and errors. Datadog RUM integrates seamlessly with other Datadog products, offering a unified monitoring solution.
sentry
Sentry is an error tracking and performance monitoring tool. It provides functionalities similar to @elastic/apm-rum, such as capturing errors and performance metrics. Sentry is known for its robust error tracking capabilities and detailed performance insights.
Elastic APM Real User Monitoring (RUM) JavaScript agent
This is the main package for Elastic APM Real User Monitoring.
Documentation
You can find our documentation on our website.
If you are interested in contributing to Elastic APM JavaScript agent, please see our contributing guide.
We'd love to hear your feedback, please take a minute to fill out our survey.
License
This project is MIT licensed.
Made with ♥️ and ☕️ by Elastic and our community.