Monitoring 101 for React Developers

Rate this content
Bookmark

If finding errors in your frontend project is like searching for a needle in a code haystack, then Sentry error monitoring can be your metal detector. Learn the basics of error monitoring with Sentry. Whether you are running a React, Angular, Vue, or just “vanilla” JavaScript, see how Sentry can help you find the who, what, when and where behind errors in your frontend project. 


Workshop level: Intermediate

This workshop has been presented at React Summit US 2023, check out the latest edition of this React Conference.

FAQ

Participants can access all necessary resources, including the GitHub repository and additional links, through the links provided in the workshop's presentation deck. These resources are shared during the workshop and also on the Discord channel.

The workshop covers several key features of Sentry including project setup, source maps configuration, event context addition, custom tags, alerts setup, issue assignments, and the use of Sentry's newer features like distributed tracing and session replay.

The session replay feature in Sentry records the DOM of user sessions, showing exactly how users interact with an application. This includes mouse movements and clicks, navigation between pages, and user interactions at the time of errors. It helps developers understand user behavior and identify issues in the application.

Distributed tracing is a debugging method used to track the performance of requests across various services within an application. It helps in identifying performance bottlenecks by providing a visual representation of the request flow through different parts of the system, including the duration of each process.

To start using Sentry, participants are shown how to create a new Sentry project, configure source maps to pinpoint issues directly in the source code, and set up various monitoring settings such as alerts for specific error thresholds and issue assignments based on code ownership.

Sentry masks sensitive data in session replays to protect personal identifiable information (PII). This ensures that while developers can see user interactions and understand application issues, the actual content of the data entered or displayed in the application is obscured.

The Workshop Monitoring 101 for React Developers is designed to help React developers learn how to monitor their applications using Sentry. It covers setting up a Sentry project, configuring source maps, adding event context and custom tags, setting up alerts, and utilizing features like distributed tracing and session replay.

Lazar Nikolov
Lazar Nikolov
Sarah Guthals
Sarah Guthals
107 min
07 Nov, 2023

Comments

Sign in or register to post your comment.
  • Leonardo Faife
    Leonardo Faife
    n/a
    How long will the workshop be? Im in class until 1:15pm
  • Vinita Ramnani
    Vinita Ramnani
    Hewlett Packard Enterprise
    Will this be recorded and shared with the people who signed up for the workshop?
Video Summary and Transcription
Welcome to Workshop Monitoring 101 for React Developers. Learn how to create a Sentry project, handle errors, use collaboration tools, set up alerts, and explore distributed tracing. Set up source maps and wizards to get additional information about errors. Add event context and custom tags to identify users triggering events. Configure custom tags in Sentry to aggregate and filter errors. Explore alerts, issue assignments, and integrations with GitHub. Implement distributed tracing to follow the execution of requests and identify performance bottlenecks. Connect the client-side and back-end using Sentry's trace ID and transaction. Use session replay to debug applications and improve user experience.

1. Introduction to Workshop

Short description:

Welcome to Workshop Monitoring 101 for React Developers. We'll guide you through building a simple app for flashcards using React. Learn how to create a Sentry project, handle errors, use collaboration tools, set up alerts, and explore distributed tracing. Join the Discord for Q&A and enjoy the workshop!

Welcome, everyone. Hey, how's it going? If you haven't already, join the Discord. That's where we will have Q&A. so we've got myself sarah and lazar here who are going we're going to split off so i'll do the first half of the workshop and he'll be in discord and then we'll swap yeah and we will take a short break at the one hour mark and there's a that's to join the um the discord but we have a specific thread for this workshop.

Let's go. Alright. Welcome everyone. Again, this is the Workshop Monitoring 101 for React Developers. I'm Sarah. And I'm Lazar. And we are advocates here at Sentry. I'm normally based out of Washington State, but I'm visiting Toronto today so that we can give this workshop together. We're also going to ViewConf on Friday if anyone else is going. So we'll see you there.

Today what we're going to do is actually give you from start to finish we have a very simple app that we built for flashcards, right? So answering the question, testing your knowledge on things. Shuffling the cards is a really important aspect of learning. And it's built with an XJS. And so we have a very basic app that's built. It's open source. We'll give you the links to all of this, including the links to this deck, which has all the links to everything else. So if you're missing anything, don't worry. And we'll also share them in the Discord during and or after. We're going to walk you through actually creating a Sentry project, seeing those errors get sent, how to use collaboration tools, how to set up proper alerts and then how to do some interesting stuff with things like distributed tracing as i mentioned we'll take a short break at the hour mark but also please feel free to get up and take a break if you need to and then again um when one of us is presenting the other one will be monitoring the chats and discord so if you have any questions feel free to to pop them in there

2. Monitoring Overview and Project Setup

Short description:

Welcome to Workshop Monitoring 101 for React Developers. We'll guide you through building a simple app for flashcards using React. Learn how to create a Sentry project, handle errors, use collaboration tools, set up alerts, and explore distributed tracing. Join the Discord for Q&A and enjoy the workshop!

So here's our agenda. Part one will be me. We're just going to kind of get up and running. I'm going to give you a quick overview of monitoring. I don't want this to be just a lecture. I want this to be more engaging and kind of actually opening up VS code and Century app and everything like that. So just a quick overview. We're going to actually set up a project with Sentry, configure source maps, event context, custom tags. All of these words will make sense eventually, alerts and issue assignments. And then, like I said, Lazar gets kind of the more interesting bit, in my opinion. It's a little bit more fun because he gets to dive into distributed tracing and session replay, which are two of our, I guess, newer features, but also just kind of more in-depth features for applications that might be larger than the splashcard app that we have. Yep. So let's go ahead and get started. I'm going to switch over. Not to this one. Oh, that was this one. I meant to leave this one open and then do this. Perfect. Okay. So, as I mentioned, we've got this flashcard app. If you want to share the link, maybe, in the chats or in the Discord. Very simple, and I've got here my VSCode open. We have it open in here. If you need me to zoom in for anything, let me know. But I'm trying to monitor to make sure that it's all set up properly. Actually, I just realized I totally skipped over the, what is monitoring? I don't think it's like I told you, I don't want to do a long lecture on what is monitoring. OK, but let's do a very quick overview of what is monitoring, because I didn't mean to just totally skip over that. OK, so essentially, as you all probably have experienced, you build an app or you're part of a team that builds an app where there might be a poor user experience. Sometimes this is due to actual like errors within your application. Sometimes this is due to an API call that you made, and maybe the service that you're using on the other side of that API call is having issues. Regardless of why, a user experiences something not great. That user becomes frustrated, and oftentimes developers are too late to resolve the issue when it would maybe make that big of a difference. For example, maybe all of a sudden you just get a bunch of notifications on Twitter that your app's busted. And that's all you get. And there's not a lot of information, but a bunch of people are just saying that it's not working and they're basically leaving, not using it anymore. Monitoring tries to essentially, and this is specifically for sentry monitoring, stop that from happening. so there might be a poor user experience some users may still get to twitter before you log into your sentry alert but sentry detects the issue there's also ways that you can set up some thresholds to make sure that if it just happens once maybe like you just lost one package it's not that like the end of the world but if it happens you know 10 times or 100 times then we want to alert the team. So Sentry detects an issue, and the developers actually get a pointer into the actual problem. So it's not just user feedback apps busted, but instead it is a breadcrumbs. It's a full trace of what was happening. Like I said, Lazar is going to go into distributed tracing, so you can go from front end to back end and to other services. and if you set up things like source maps which we'll go into you can actually get the exact line of code that is likely the trigger of the issue and if you have code owners set up which I'll also go into you can automatically tag the appropriate developer to resolve the issue instead of just having it go through this long triage process where I get this issue and I'm Like, this is not my code. I have no clue how to resolve this. Or maybe it was my code. I originally wrote it, but I'm not the owner of its health long-term. That's someone else. And so the ideal scenario here is that most users never know that there was an issue in the first place. So this is kind of like our tagline. Tagline specifically Century focuses on the developers who are building or monitoring the apps and how we can best support developers in taking action on those broken lines of code crashes and busted API calls. We really do focus on that developer first monitoring solution to give you, like I said, an actionable answer to what the problem is, not just a clue for where the problem could potentially be. Now we will go into the demo. So you can follow this short link for the GitHub repo. We're going to. I already have this cloned on my machine. Exactly. Well, actually, the main branch has Sentry set up, but there is a branch called No Sentry. I'm not necessarily expecting that you all run this on your local machines now. But if you want to do this later at some point, we do have a PlanetScale account and a database with it. You can use a different one if you want. There might be some additional configuration you need to do. We already have a Sentry account. It is just a regular account. It's not like a Sentry employee account. We do that on purpose to give you a more accurate representation of what you would see. And then we did add instructions to the Readme, so you can follow along there at a different time. So I'm going to show you how to set up that React project with Sentry. We're going to configure our source maps, add event context and custom. tags, and then jump into alerts and issue assignments. Now we can actually get started. So like I said, this is the repository and I've already cloned it here.

QnA

Watch more workshops on topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Concurrent Rendering Adventures in React 18
React Advanced 2021React Advanced 2021
132 min
Concurrent Rendering Adventures in React 18
Top Content
Featured WorkshopFree
Maurice de Beijer
Maurice de Beijer
With the release of React 18 we finally get the long awaited concurrent rendering. But how is that going to affect your application? What are the benefits of concurrent rendering in React? What do you need to do to switch to concurrent rendering when you upgrade to React 18? And what if you don’t want or can’t use concurrent rendering yet?

There are some behavior changes you need to be aware of! In this workshop we will cover all of those subjects and more.

Join me with your laptop in this interactive workshop. You will see how easy it is to switch to concurrent rendering in your React application. You will learn all about concurrent rendering, SuspenseList, the startTransition API and more.
React Hooks Tips Only the Pros Know
React Summit Remote Edition 2021React Summit Remote Edition 2021
177 min
React Hooks Tips Only the Pros Know
Top Content
Featured Workshop
Maurice de Beijer
Maurice de Beijer
The addition of the hooks API to React was quite a major change. Before hooks most components had to be class based. Now, with hooks, these are often much simpler functional components. Hooks can be really simple to use. Almost deceptively simple. Because there are still plenty of ways you can mess up with hooks. And it often turns out there are many ways where you can improve your components a better understanding of how each React hook can be used.You will learn all about the pros and cons of the various hooks. You will learn when to use useState() versus useReducer(). We will look at using useContext() efficiently. You will see when to use useLayoutEffect() and when useEffect() is better.
React, TypeScript, and TDD
React Advanced 2021React Advanced 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Web3 Workshop - Building Your First Dapp
React Advanced 2021React Advanced 2021
145 min
Web3 Workshop - Building Your First Dapp
Top Content
Featured WorkshopFree
Nader Dabit
Nader Dabit
In this workshop, you'll learn how to build your first full stack dapp on the Ethereum blockchain, reading and writing data to the network, and connecting a front end application to the contract you've deployed. By the end of the workshop, you'll understand how to set up a full stack development environment, run a local node, and interact with any smart contract using React, HardHat, and Ethers.js.
Designing Effective Tests With React Testing Library
React Summit 2023React Summit 2023
151 min
Designing Effective Tests With React Testing Library
Top Content
Featured Workshop
Josh Justice
Josh Justice
React Testing Library is a great framework for React component tests because there are a lot of questions it answers for you, so you don’t need to worry about those questions. But that doesn’t mean testing is easy. There are still a lot of questions you have to figure out for yourself: How many component tests should you write vs end-to-end tests or lower-level unit tests? How can you test a certain line of code that is tricky to test? And what in the world are you supposed to do about that persistent act() warning?
In this three-hour workshop we’ll introduce React Testing Library along with a mental model for how to think about designing your component tests. This mental model will help you see how to test each bit of logic, whether or not to mock dependencies, and will help improve the design of your components. You’ll walk away with the tools, techniques, and principles you need to implement low-cost, high-value component tests.
Table of contents- The different kinds of React application tests, and where component tests fit in- A mental model for thinking about the inputs and outputs of the components you test- Options for selecting DOM elements to verify and interact with them- The value of mocks and why they shouldn’t be avoided- The challenges with asynchrony in RTL tests and how to handle them
Prerequisites- Familiarity with building applications with React- Basic experience writing automated tests with Jest or another unit testing framework- You do not need any experience with React Testing Library- Machine setup: Node LTS, Yarn

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Guide to React Rendering Behavior
React Advanced 2022React Advanced 2022
25 min
A Guide to React Rendering Behavior
Top Content
This transcription provides a brief guide to React rendering behavior. It explains the process of rendering, comparing new and old elements, and the importance of pure rendering without side effects. It also covers topics such as batching and double rendering, optimizing rendering and using context and Redux in React. Overall, it offers valuable insights for developers looking to understand and optimize React rendering.
Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Everything Beyond State Management in Stores with Pinia
Vue.js London Live 2021Vue.js London Live 2021
34 min
Everything Beyond State Management in Stores with Pinia
Top Content
State management is not limited to complex applications and transitioning to a store offers significant benefits. Pinia is a centralized state management solution compatible with Vue 2 and Vue 3, providing advanced devtools support and extensibility with plugins. The core API of Pinia is similar to Vuex, but with a less verbose version of stores and powerful plugins. Pinia allows for easy state inspection, error handling, and testing. It is recommended to create one file per store for better organization and Pinia offers a more efficient performance compared to V-rex.
React Compiler - Understanding Idiomatic React (React Forget)
React Advanced 2023React Advanced 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
Watch video: React Compiler - Understanding Idiomatic React (React Forget)
Joe Savona
Mofei Zhang
2 authors
The Talk discusses React Forget, a compiler built at Meta that aims to optimize client-side React development. It explores the use of memoization to improve performance and the vision of Forget to automatically determine dependencies at build time. Forget is named with an F-word pun and has the potential to optimize server builds and enable dead code elimination. The team plans to make Forget open-source and is focused on ensuring its quality before release.
Using useEffect Effectively
React Advanced 2022React Advanced 2022
30 min
Using useEffect Effectively
Top Content
Today's Talk explores the use of the useEffect hook in React development, covering topics such as fetching data, handling race conditions and cleanup, and optimizing performance. It also discusses the correct use of useEffect in React 18, the distinction between Activity Effects and Action Effects, and the potential misuse of useEffect. The Talk highlights the benefits of using useQuery or SWR for data fetching, the problems with using useEffect for initializing global singletons, and the use of state machines for handling effects. The speaker also recommends exploring the beta React docs and using tools like the stately.ai editor for visualizing state machines.
Routing in React 18 and Beyond
React Summit 2022React Summit 2022
20 min
Routing in React 18 and Beyond
Top Content
Routing in React 18 brings a native app-like user experience and allows applications to transition between different environments. React Router and Next.js have different approaches to routing, with React Router using component-based routing and Next.js using file system-based routing. React server components provide the primitives to address the disadvantages of multipage applications while maintaining the same user experience. Improving navigation and routing in React involves including loading UI, pre-rendering parts of the screen, and using server components for more performant experiences. Next.js and Remix are moving towards a converging solution by combining component-based routing with file system routing.