惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
H
Help Net Security
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
B
Blog
C
Check Point Blog
T
Tailwind CSS Blog
云风的 BLOG
云风的 BLOG
D
Docker
Recent Announcements
Recent Announcements
Vercel News
Vercel News
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
月光博客
月光博客
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
The Register - Security
The Register - Security
V
Visual Studio Blog
F
Full Disclosure
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Latest news
Latest news
PCI Perspectives
PCI Perspectives
Cisco Talos Blog
Cisco Talos Blog
博客园 - Franky
D
DataBreaches.Net
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
T
Tenable Blog
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis Monitor Aruba Central in Datadog How we centralize and remediate risks with Datadog Case Management Accelerate incident response with Datadog and ServiceNow Monitor your application and network load balancer logs Understanding Karpenter architecture for Kubernetes autoscaling Tools for collecting metrics and logs from Karpenter Monitor Karpenter with Datadog What your product data is actually saying Key metrics for monitoring Karpenter Securing Datadog’s platform in the AI age: The role of observability data Four ways engineering teams use the Datadog MCP Server to power AI agents Approaching your observability migration with the right mindset Meet the new Bits AI SRE: Deeper reasoning, twice as fast Key learnings from the 2026 State of DevSecOps study Use plain English to query your multi-cloud infrastructure in Resource Catalog Simplifying troubleshooting across the user journey with Datadog Synthetic Monitoring Protect your OCI resources with Datadog Cloud Security This Month in Datadog - February 2026 Amazon EC2 security: How misconfigured and public AMIs expand your cloud attack surface Enable end-to-end visibility into your Java apps with a single command Measure and improve mobile app startup performance with Datadog RUM Evaluating our AI Guard application to improve quality and control cost Identify untested code across every level of your codebase Make use of guardrail metrics and stop babysitting your releases Monitor Versa Networks SD-WAN performance in Datadog Improve performance and reliability with APM Recommendations Remediate transitive vulnerabilities faster with Datadog Software Composition Analysis Generate audit-ready vulnerability and compliance reports with Datadog Sheets Monitor Fortinet FortiManager performance in Datadog Improve test coverage across codebases with Datadog Code Coverage Move fast, don’t break things: Consistent testing standards at scale Enrich logs with ServiceNow CMDB context before routing to any SIEM or logging tool Monitor Lustre with Datadog Make faster, better product decisions with Datadog Product Analytics Surface and remediate runtime posture issues with Workload Protection Findings Protect agentic AI applications with Datadog AI Guard How to optimize JavaScript code with CSS Trace Google Pub/Sub workloads in Cloud Run with Datadog Detect human names in logs with ML in Sensitive Data Scanner How we cut our NLQ agent debugging time from hours to minutes with LLM Observability Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring Datadog acquires Propolis Unify and correlate frontend and backend data with retention filters Scale compliance across global frameworks with Datadog Cloud Security Monitor Arista VeloCloud SD-WAN performance with Datadog Building reliable dashboard agents with Datadog LLM Observability Simplify log collection and aggregation for MSSPs with Datadog Observability Pipelines Mitigation for Node.js denial-of-service vulnerability affecting Datadog APM Automate flaky test fixes with the Bits AI Dev Agent and Test Optimization How we built an AI SRE agent that investigates like a team of engineers Datadog integrations 2025 recap: Observability for AI, security, and hybrid cloud Design effective executive dashboards with Datadog Implement dbt data quality checks with dbt-expectations Bring faster visibility into AWS Lambda functions with remote instrumentation Troubleshoot faster with the GitLab Source Code integration in Datadog How Cambia Health Solutions saved $30,000 monthly with Cloud Cost Management and the Datadog Resource Catalog Normalize any logs for Cloud SIEM with Datadog's OCSF processor Optimizing Datadog at scale: Cost-efficient observability at Zendesk Detect, diagnose, and resolve network issues easily with CNM Network Health Connect engineering errors to user impact in early-stage products Cilium configuration for Kubernetes operations at scale Designing feedback loops for progressive delivery Ship features faster and safer with Datadog Feature Flags Choosing the right OpenTelemetry Collector distribution Route your monitor alerts with Datadog monitor notification rules Automate Cloud SIEM investigations with Bits AI Security Analyst Cloud threat detection: How to identify risky activity across control and data planes Collecting Kafka performance metrics Monitoring Kafka with Datadog Monitoring Kafka performance metrics
Get better RUM data with our custom React components
2021-11-17 · via Datadog | The Monitor blog
Thomas Sobolik

Thomas Sobolik

Since its release in 2013, React.js has become one of the most popular solutions for building dynamic, highly interactive web app frontends. React’s declarative nature and component-based architecture make it easier to build and maintain single-page applications.

While single-page React apps can provide powerful user experiences, they also introduce potential monitoring challenges. For example, because single-page apps make it easier to dynamically generate new views to facilitate seamless navigation, you might find yourself with greater volumes of route change data that’s more difficult to glean insights from. And with more application logic processed on the frontend, it’s important to collect as much context around errors as possible. Finally, if you’re leveraging React to create more dynamic UI elements, it’s paramount to track user actions appropriately, including all the context you need to track, triage, and troubleshoot issues.

To help navigate these challenges, Datadog’s Real User Monitoring team has built a set of React components you can adapt and integrate into your applications to get more granular data—and therefore better insights—from your instrumented React apps. In this post, we’ll show you how to use these components to:

Consolidate your view paths

React Router lets you generate routes dynamically as your application renders. This simplifies development because you don’t need to declare static routes beforehand, which helps you easily compose, for example, multiple sets of valid routes for different devices or screen sizes.

Monitoring route changes is essential for getting a full picture of user traffic on your site, including things like page view counts, how long users spend on a page, and common user flows. Collecting route change data at the URL level—that is, by marking a route change each time the URL is updated—can be sufficient for capturing all browser activity, but it can lead to messy data that’s difficult to parse for insights. For example, on an e-commerce site, you might have a product view with a unique URL for each product ID (e.g., /tables/product/:id). In your RUM data, this would create a separate view path for potentially thousands of different products. If you wanted to compare, for example, page view counts between your product and checkout views, you’d have to aggregate all of these product view paths to get a valid comparison.

Dashboard with unconsolidated view paths

With the React Router component, you can define a convention for your view paths so that a new RUM view is created each time the router is invoked. This ensures that your RUM data aligns with the way you define pages in your application. Because this component inherits the same props available on its counterpart in the original React Router library, your implementation doesn’t need to change much. Just use the <RumRoute /> component in your route change definitions, like so:

import {

BrowserRouter as Router,

} from 'react-router-dom';

import { Menu } from './Menu';

import { Cart } from './Cart';

import { Department } from './Department';

export function App() {

return (

<div className="App">

<Router>

<Menu>

<RumRoute path="/">

<Home />

</RumRoute>

<RumRoute path="/department/:name/product/:id">

<Department />

</RumRoute>

<RumRoute path="/cart">

<Cart />

</RumRoute>

</Menu>

</Router>

</div>

);

}

Now, your view names are simplified and follow the conventions you define in your routing structure. This enables you to easily make apples-to-apples comparisons between relevant view categories and ensures that your view path names in RUM precisely follow their definitions in your router.

Dashboard with consolidated view paths

Get more context around errors

When adding error handling to your React apps, you want to appropriately catch each error, log relevant context for debugging, and prevent the rest of your application from crashing. In vanilla JavaScript, this is traditionally accomplished using try-catch blocks. But to implement this in a way that preserves React’s declarative architecture, Facebook added the Error Boundary feature to React 16 in 2017.

Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, both during rendering and within the lifecycles of any nested components. Using error boundaries, you can wrap a component (or group of related components) with a safe fallback that:

  • Properly dismounts to a user-friendly error message UI instead of displaying the component tree that crashed
  • Emits the full context of the error, including the whole stacktrace within the boundary

To get this important context into your React error logs so you can send them to Datadog for analysis and monitor them in Error Tracking, we built an Error Boundary component that works like the one shipped with React 16+, with the added benefit of automatically forwarding all its log data to Datadog. Simply wrap the parent component of the UI object you want to handle errors for using the <ErrorBoundary /> element.

import { Cart } from './Cart';

export function Checkout() {

return (

<div className="Checkout">

<Menu />

<ErrorBoundary

fallback={(error) => <div>Unable to load shopping cart: {error.message}</div>}

>

<Cart />

</ErrorBoundary>

</div>

);

}

When performing root-cause analysis of an issue in Error Tracking, for example, you now have a stacktrace of the error and a breadcrumbs trail identifying each component above the one that failed on the hierarchy and within your defined error boundary. This provides much more context into what path the user took that resulted in the error, as well as key state information to help you resolve the bug.

Detailed error context in RUM Error Tracking

Add more context to user actions

By tracking user actions you can get a complete picture of what page elements a user clicked on or submitted input to and how long each of these actions took. This helps you quantify feature adoption, understand the performance of key UI elements, and identify the steps that led to a specific browser error. Datadog RUM tracks user clicks by default. But in a React application, where UI elements are often comprised of multiple nested components, it’s useful to have deeper context for exactly which components were invoked leading up to the action—especially when the action triggers an error. By instrumenting your components with our new RUM Component Context Provider, you get a full breadcrumb path of the components that the user traversed to form the overall context around the action. You can also define custom attributes to help you label your actions with key data (e.g., including the name of a button pressed, or appending the product ID of an item being purchased).

You can wrap any class components you’d like to instrument with the <RumComponentContextProvider /> component. Or use the <WithRumComponentContext /> HOC for any function components. Any components you wrap will show up in the breadcrumb trail for triggered errors or actions further down the chain. Then, using the included useRumAction and useRumError hooks, you can generate actions and errors in RUM for specific cases of your component logic.

const App = WithRumComponentContext("AppComponent", () => {

const addAction = useRumAction("trackingAppAction");

const addError = useRumError();

return (

<div className="App">

<Button

onClick={() => addError('new Error from root.AppComponent')}

>

Generate Error from root.AppComponent

</Button>

<Button

onClick={() => addAction('new Action from root.AppComponent')}

>

Generate Action from root.AppComponent

</Button>

</div>

);

})

Using the built-in value and label fields as props in your declaration, you can also add custom attributes to help describe what the user is doing. For example, if you’re tracking an “Add to Wishlist” button on an e-commerce site, you can add Saved to wishlist as a label to ensure that this context is preserved when viewing the action within Datadog.

In Datadog RUM, you can easily view this data in the “Custom Attributes” of the action. You can also see a detailed performance waterfall, user info (such as device, browser, location), related backend traces and logs, and more. This way, you get all the context you need to understand the path your user took through the UI, as well as how your application performed in response.

Custom attributes for extra context around actions and errors

Tune up your React data collection

With Datadog RUM’s React support, it’s easy to enrich your React app’s recorded route changes, user actions, and errors with comprehensive context to help you understand user behavior and track, triage, and debug issues. All three components are open source, and can easily be integrated with your existing applications. See our Github repository to view the source code, as well as detailed setup instructions. For more information about Datadog RUM, see our documentation. Or, if you’re brand new to Datadog, get started with a 14-day free trial.