What is @datadog/browser-rum-core?
The @datadog/browser-rum-core package is part of Datadog's Real User Monitoring (RUM) solutions, designed to help developers monitor and analyze the performance and user interactions on web applications in real-time. It provides essential tools to capture detailed information about the user's experience, including performance metrics, errors, and user actions.
What are @datadog/browser-rum-core's main functionalities?
User Session Tracking
This feature allows you to track user sessions and capture key interactions and metrics. The provided code initializes the RUM monitoring with necessary configuration such as application ID and client token.
import { startRum } from '@datadog/browser-rum-core';
startRum({
applicationId: 'YOUR_APP_ID',
clientToken: 'YOUR_CLIENT_TOKEN',
site: 'datadoghq.com',
service: 'your-service-name',
// Specify a version number to identify the deployed version of your application
version: '1.0.0'
});
Error Tracking
This feature enables the tracking of errors that occur during a user's session. The code sample demonstrates how to manually log an error along with its severity level.
import { addError } from '@datadog/browser-rum-core';
addError(new Error('Something went wrong'), {
context: {
severity: 'error'
}
});
Performance Monitoring
This feature helps in monitoring the performance of different views within your application. The code sample shows how to mark the start of a new view, which can be used to measure view load times and other related metrics.
import { startView } from '@datadog/browser-rum-core';
startView({ name: 'homepage' });
Other packages similar to @datadog/browser-rum-core
@sentry/browser
Sentry's browser package provides error tracking and performance monitoring similar to @datadog/browser-rum-core. While both offer real-time monitoring and user insights, Sentry places a stronger emphasis on error resolution and developer workflows for debugging.
elastic-apm-rum
Elastic APM's RUM (Real User Monitoring) library is part of the Elastic Stack, focusing on performance monitoring and user behavior analytics. It is similar to @datadog/browser-rum-core but also integrates tightly with other Elastic products for a more unified monitoring solution.