Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
54

Frontend System Design · Lesson 54 of 86 · 5 min

Error Reporting: Sentry and LogRocket

This is how you explain a production-grade monitoring strategy, not just name-drop tools.

After this, you'll be able to articulate the difference between error aggregation and session replay, explain the trade-offs of using them, and describe a robust implementation that interviewers expect for a large-scale application.

Why console.log fails at scale

In production, you are blind. You can't reproduce user environments, and you can't ask them to open the dev tools. console.log is a fire-and-forget signal into a void. You have no idea if an error is a one-off fluke or a critical failure hitting 10% of your users.

This is the problem that centralized error reporting solves. It moves you from reactive debugging ("a user reported a bug") to proactive monitoring ("we were alerted that a new error is spiking after the last deploy").

Two categories of tools dominate this space:

  1. Error Aggregators (like Sentry): These tools capture, group, and count errors. They answer: What broke? How many users are affected? Is this a new error from the latest release?
  2. Session Replay Tools (like LogRocket): These tools record the user's session. They answer: How did it break? What sequence of clicks, network requests, and state changes led to the error?

You need both. One tells you the scope of the fire, the other gives you the video footage to find the cause.

The error reporting lifecycle

When an error occurs in a properly instrumented app, it's not just the stack trace that gets sent. The SDK bundles it with a wealth of context: the user's ID, browser version, OS, the sequence of events leading up to the crash (breadcrumbs), and any custom tags you've set.

This payload is sent to a service like Sentry, which aggregates it. If it's a new error or an old one that's suddenly spiking, it triggers an alert.

The essential production setup

Your goal is to initialize these tools as early as possible in your application's lifecycle to avoid missing startup errors. The most critical piece of the integration is linking the two services, so an error in Sentry provides a direct link to the exact moment it happened in a LogRocket session replay.

This is done with Sentry's beforeSend hook. You grab the current session URL from LogRocket and attach it to the Sentry event before it goes out.

Here is a minimal, production-ready setup for a React app.

// src/main.tsx (or your app's entry point)
import React from 'react';
import ReactDOM from 'react-dom/client';
import * as Sentry from '@sentry/react';
import LogRocket from 'logrocket';
import App from './App';

// 1. Initialize LogRocket first.
LogRocket.init('YOUR_LOGROCKET_APP_ID');

// 2. Initialize Sentry.
Sentry.init({
  dsn: "YOUR_SENTRY_DSN",
  integrations: [
    new Sentry.BrowserTracing(),
    // Add Sentry.Replay for their own session replay if you use it.
  ],
  environment: import.meta.env.MODE, // e.g., 'development', 'production'
  release: `my-app@${import.meta.env.VITE_APP_VERSION}`, // Assumes version is in env
  tracesSampleRate: 0.1, // Performance monitoring. Adjust in production.
  
  // 3. Link Sentry errors to LogRocket sessions.
  beforeSend(event, hint) {
    // LogRocket.sessionURL will be null if the session is not being recorded.
    if (LogRocket.sessionURL) {
      event.extra = {
        ...event.extra,
        logRocketSessionURL: LogRocket.sessionURL,
      };
    }
    return event;
  },
});

// 4. Identify the user in both services after they log in.
// This would typically be called from an auth hook or callback.
function identifyUser(user: { id: string; email: string; name: string; }) {
  Sentry.setUser({ id: user.id, email: user.email });
  LogRocket.identify(user.id, { name: user.name, email: user.email });
}

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

How to configure this without breaking production

Integrating third-party monitoring scripts is not free. They add to your bundle size, consume network bandwidth, and can impact main-thread performance. You must be deliberate in your configuration.

The trap: Leaking personally identifiable information (PII). Session replay, by default, records everything. This can include names, addresses, and credit card numbers. Accidentally logging this is a major security and privacy violation. Both Sentry and LogRocket have redaction features. Use them. Configure the SDKs to block sensitive form inputs and HTML elements by default.

The trap: Killing performance. Session replay is more expensive than error aggregation. Recording every DOM mutation and network request for every user can impact performance, especially on low-end devices. Use sampling. For LogRocket, you might record 100% of sessions for authenticated users on a paid plan but only 10% for anonymous visitors. For Sentry performance tracing (tracesSampleRate), start with a low number like 0.1 (10%) and adjust based on the value you get and the cost.

The trap: Creating useless noise. The default configuration will report every minor JavaScript warning and network blip. This leads to alert fatigue, where your team starts ignoring notifications. Be aggressive with filtering. Use beforeSend to ignore benign errors from browser extensions or old, unsupported browsers. Use custom tags (Sentry.setTag) to categorize errors by feature area ('checkout', 'user-profile') so you can route alerts to the right team.

In an interview, discussing these trade-offs (privacy vs. debuggability, performance vs. visibility, signal vs. noise) is more important than just naming the tools. It shows you've dealt with these systems in a real-world environment.

How to answer "Design an error monitoring system"

When asked to design a monitoring strategy, structure your answer around the problems you need to solve.

  1. Detection: "First, we need to know when things go wrong. I'd use an error aggregation tool like Sentry. We'd initialize its SDK at the application entry point to capture all unhandled exceptions and promise rejections."
  2. Context & Triage: "A stack trace isn't enough. We need context. I'd configure the SDK to report the release version to correlate errors with deploys. We'd also set user context upon login. This lets us answer questions like 'Is this error only affecting free-tier users?' or 'Did this start with the release that went out this morning?'"
  3. Reproducibility: "For bugs we can't reproduce, we need more detail. I'd integrate a session replay tool like LogRocket. The key is to link the two. I'd use Sentry's beforeSend hook to inject the LogRocket session URL into every Sentry error report. This gives us a one-click path from an aggregated error to a full video replay of the session that caused it."
  4. Mitigation & Trade-offs: "Finally, we have to manage the risks. To protect user privacy, we'd configure both tools to redact all PII from inputs and network payloads. To manage performance and cost, we'd use sampling, especially for session replay, perhaps recording a higher percentage of sessions for high-value user flows."

This answer demonstrates a mature, multi-layered approach that covers the full lifecycle of an error, from detection to resolution, while acknowledging the real-world constraints of privacy, performance, and cost.

Try it

Sign up for a free Sentry account and get a DSN key. Instrument a small local project. Intentionally throw an error inside a button's onClick handler. Use Sentry.captureException inside a try/catch block, and add a custom tag and some extra data. Find the error event in your Sentry dashboard and verify the context is there. This should take about 20 minutes.

Next: You'll learn what to show the user while these errors are happening in the lesson on Graceful Degradation and Fallback UIs.

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Global Error Boundaries in React

Next

Graceful Degradation and Fallback UIs