Tracing: Frontend Issues With Backend Solutions

Rate this content
Bookmark

Frontend issues that affect your users are often triggered by backend problems. In this workshop, you’ll learn how to identify issues causing slow web pages and poor Core Web Vitals using tracing.


Then, try it for yourself by setting up Sentry in a ready-made Next.js project to discover performance issues including slow database queries in an interactive pair-programming session.


You’ll leave the workshop being able to:

- Find backend issues that might be slowing down your frontend apps

- Setup tracing with Sentry in a Next.js project

- Debug and fix poor performance issues using tracing


This will be a live 2-hour event where you’ll have the opportunity to code along with us and ask us questions.

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

FAQ

Sentry supports over 100 languages and frameworks, allowing for extensive integration and use across various tech stacks.

Yes, Sentry is fair source and can be self-hosted if desired.

Benefits of using Sentry for debugging include detailed trace views, performance insights, AI suggestions for fixes, and integration with tools like GitHub to streamline the debugging process.

You need Visual Studio Code or any editor of your choice, Python, Docker, and a GitHub account to participate in the workshop.

Sentry offers features like contextualization, prioritization, and tracing of issues, performance insights, session replays, and AI-powered features like autofix and the Sentry Copilot extension.

The workshop is hosted by Sarah Guthals, who leads Developer Relations at Sentry, and her colleague, Lazar.

Session replay in Sentry provides video-like reproductions of user sessions to help developers understand what actions led to an error, with privacy measures like obfuscating text and images in place.

You can sign up for Sentry and receive three months free with unlimited spans and transactions by using the code provided in the workshop or visiting the link shared by the hosts.

The main focus of the workshop is to provide a deep dive into monitoring and debugging using Sentry, including a live demo of a flashcard app with a Next.js frontend and a Django backend.

Sentry obfuscates all text and images on the client-side before sending any data to Sentry servers, ensuring that sensitive information or PII is not exposed.

Lazar Nikolov
Lazar Nikolov
Sarah Guthals
Sarah Guthals
112 min
14 Nov, 2024

Comments

Sign in or register to post your comment.
  • Dulanka Gunathilaka
    Dulanka Gunathilaka
    This workshop offers a comprehensive introduction to Sentry, guiding attendees through its setup and usage for efficient debugging. Topics such as database population, performance tracing, and session replay will be explored, along with integrating Sentry into Django projects and optimizing CI/CD processes. The session also covers advanced features like issue identification, source map configuration, and custom instrumentation. A great opportunity to dive into Sentry’s powerful debugging and monitoring capabilities!
Video Summary and Transcription
Welcome to the two-hour workshop where we will introduce Sentry, a monitoring platform, and demonstrate how to debug with it. We will walk through the project structure and set up Sentry for debugging. The workshop covers topics such as populating the database, configuring Sentry for better debugging, tracing performance, and session replay. We will also explore CI/CD, Python setup, and Django project integration with Sentry. The workshop emphasizes the importance of setting sample rates appropriately and covers issue identification, source map configuration, and analyzing errors with source maps. Additionally, it covers topics such as bug fixes, custom instrumentation, troubleshooting performance issues, and trace exploration. The workshop concludes with an overview of the features of Sentry, including trace view, session replay, user feedback widget, and AI capabilities. Attendees are encouraged to reach out for further questions.

1. Introduction to Sentry and Debugging

Short description:

Welcome to the two-hour workshop! We will have instructions for you to follow along using Visual Studio code, Python, and Docker. We'll introduce Sentry, a monitoring platform, and show you how to debug with it. The platform helps you contextualize, prioritize, and trace issues. We encourage you to not just observe, but to debug. Any questions about monitoring or debugging? Let's see it in action. We'll debug a flashcard app with a Next.js frontend and a Python Django backend. Clone the repository and start your Docker container. Let's get started!

You are welcome to follow along. It's a two-hour workshop. We will take a short break in the middle. We will have instructions for you to be able to follow along. Since you're here a little bit early, if you want to just make sure that you at least have, we're going to be using Visual Studio code. You can use whatever editor you want, Python and Docker. So if you make sure you have those things and a GitHub account, then we should be good to go.

And I'll apologize if my voice gets a little raspy. I got sick yesterday. I don't know from where. My kiddo went back to school after five days of not being there and must have picked something up. So, you know, what are you going to do? So we're going to go ahead and get started. We've got kind of a slow ramp-up. So if folks are joining, thank you. If folks are joining a little bit kind of on a rolling basis, that should totally be fine. But welcome. My name is Sarah Guthals and I lead DevRel at Sentry. We're going to give you a quick introduction to Sentry and then we're going to get into a live demo where you get to follow along. Like I said, I'm based out of Washington State, a little outside of Redmond. And this is my colleague, Lazar. Hey, everyone. I'm at the office today, which is pretty cool. Nice. I am also at an office, but it is my home office. All right. So let's go ahead and get started.

A couple of housekeeping. As I mentioned, the chat is open. Feel free to let us know where you're tuning in from if you haven't already. Let us know any questions that you have and just kind of impressions or comments or things that you might have there as well. Okay. So what are we going to do? We're going to do a quick monitoring deep dive. We're going to show you this app that we, well, we, Lazar has built, which has a Next.js front end and a Django back end. We're going to debug this app together. You can just follow along and watch. All of this is freely available. So you're welcome to try it now or try it later. And then we're going to give you time to actually try it on your own and kind of share what you've learned. Okay. So let's get started.

First of all, you know, Sentry is a monitoring platform. However, we want to kind of push what that means. What monitoring, APM, observability, like all of these terms, just like the words themselves, imply a sense of passiveness, and that's definitely not what we are trying to build. What we are always trying to build is something that is more proactive, not even just active, but proactive. So we want to encourage you to not just observe, but to debug. And what does this really mean? The way I like to think about it is that platforms that support developers throughout their debugging workflow should help you in three key areas. They should help you contextualize, prioritize, and trace. So what do we mean by this? Well, contextualize. Understand the context about what went wrong. Is it happening on every single browser or is it only happening on Chrome? Is it happening on every single device or only on Android? Is it affecting, like, you know, every, like is your app completely crashed or is it only affecting this niche area of the app that not a lot of people are using? This kind of information helps you contextualize, helps you understand where the problem might be, and helps you understand the next step, whether you should prioritize the problem. And in addition to that information, prioritizing is not just knowing kind of how important a problem is in and of itself, but knowing how important a problem is compared to all of the other problems. So do you have other problems that are escalating that are affecting your checkout versus one that might be affecting some smaller niche area of your application or your website? Do you have a bug or a slowdown that is affecting one of your key user groups and the ones that are maybe paying more and so you want to prioritize those fixes faster? Or is it affecting folks that are on a free plan that maybe are just kind of giving it a trial? Obviously, in an ideal world, we would fix all of the bugs as quickly as possible and have a perfectly running app, but that's not the reality of what we're faced with every day. And then once you've been able to kind of understand what the problem is and prioritize based off of that those insights whether or not you should fix it, we want to take action. The contextualize and prioritize is kind of that more passive, you know, observe or monitor kind of feel. The trace is really where that active piece comes in where we are actively debugging.

So rather than sifting through mountains of logs or looking at user feedback that just says it's broken and you're like I know, but can you give me more information? Can you give me a screenshot? Can you tell me kind of anything that will help me be able to figure this out? We want to help you be able to trace down to the root cause of the issue. Ideally, that line of code or that database query that's causing that issue. Be able to make that fix quickly, deploy that fix quickly, and make sure that that doesn't regress again in the future. So again, we have kind of three main areas, contextualize, prioritize, and trace. And this is what it means to have a platform or a tool that helps you debug.

Any questions about monitoring or debugging, please feel free to add them into the chat. Otherwise, I think what's more important is that we actually see this in action, because I can tell you all day what's going on. Let's actually see what's going on, though. Right? So we're going to debug some bad code. Again, to get started, make sure that you have Docker and Python, some kind of editor. We're going to clone this repository. We'll throw links in the chat. And then you need to start your Docker container. Now, I'm going to do this with you. So, you know, you don't need to, like, super rush, but we're going to do this together. We're going to get this going, and we're going to try it out.

This application that we are debugging is a flashcard app. Like I said, it's got a Next.js frontend and a Python Django backend. So let's give this a try. This is the repository. This is open source. It's our flashcard repository. And I'm just going to grab this here. And I'm going to open up VS Code. And I'm going to go ahead and clone this. So we're going to go here and clone repository from GitHub. Awesome. And you know what, we're just going to put it in documents for now. Sounds good. Okay. So we're going to clone this, and now I've got it on my local machine. So hopefully you've done the same. Let's take a look at what we have here. Lazar, you built this.

2. Project Overview and Debugging Setup

Short description:

Let's walk through the project structure. There's a monorepo with two projects: API (Python Django) and web (Next.js). A compose file ties everything together, starting Postgres, running migrations, and booting up the API and web projects. The projects have their own Dockerfiles. A debugging platform is useful for fixing bugs, on-call incidents, and onboarding. We'll learn the codebase together and use Sentry. Clone the repository, run Docker compose, and check the running app. We'll install Sentry to assist with debugging. We'll explore the app and populate the database. Sentry is most useful in production. Let's see if we encounter any bugs.

Lazar, you built this. Do you want to walk us through a little bit about what we have in this repository? Yeah. So at the root, we only have one folder, which is the packages folder. Think of this as a monorepo, but it's not. It is a structure that holds two different types of projects. One is the API, which is in Python Django. And the other one is the web, which is in Next.js. We also have a compose file at the root of the project. There we go. And this basically ties everything together. It's going to start a Postgres database for us. It's going to run some migration scripts for us to set up the database after we run it for the first time. And then it's going to boot up the API project, which is the Django one, and also the web project, which is the Next.js one. So technically, we are starting three different servers and one migration script with this. And the home folders for the projects are API and web. Each of them have their own Dockerfile, which I made it work so that even if we change anything, it should technically restart the container. If not, it's a matter of re-running the last command that we run. So, yeah, this is how the project is set up and we can dive into specific details later when we are going to get into code.

And here's the thing. When is a platform that helps you debug useful? Obviously, when you're just trying to fix a bug. But more importantly, maybe when you're on call and a critical bug comes in or a performance slowdown comes in and you haven't actually touched this part of the code before. You're not a part of that team, let's say. Even if you're not going to actively debug it, you need to understand who you need to tag in next. That's one instance. Another instance is if you're onboarding. So, I haven't explored this version of the Flashcard app a lot before. We had previous versions. This time we're using a Django backend and Lazad has completely rewrote and refactored this. So, this is a fairly new code base for me. So, we're going to be learning this code base together and we're going to be leveraging Sentry to be able to do that.

Okay. So, great. I've got my repository cloned. Yes. And I do have Docker running. There it is. I mean, nothing's running, but I have it open. So, let's go ahead and open up a terminal. And if I recall correctly, on your readme, you have this as well, right? We just have to run Docker compose. Wow. It was the first command in the getting started section. There it is. Yep. I just totally missed it because my brain said, that's a different color. I'm not going to look at it. Compose up dash dash build. Perfect. Yep. So, we're going to run this command right here in the terminal NBS code. And we're just going to see kind of what's going on. The dash dash build, we have here the arguments might not always be required. But I just added it for good measure because sometimes the hot reload doesn't work and it doesn't pick up the changes. So, some of the changes might not be reloaded. If I add the, when I added the dash dash build, everything was working perfectly. So, yeah, have that in mind. Yep. All right. So, we have it running. We have it running. Booted up. Did we actually check it out? Oh, this was from when I was testing it before. Oh, let me just go ahead and, so, I'm going to, go ahead. I was going to say, these are in dev mode. So, it's going to be pretty slow because we are running basically npm run dev, at least for the next JS site. So, it is going to be slower. If we build it and run it, it's going to be much faster, or is it? We'll see. I hope so. Because that was pretty darn slow. Okay. Now, we don't have Sentry installed in this yet at all. We're going to do that together. So, if we do run into bugs, we're going to see what we can try to figure out, but it's probably not going to be a lot. Especially since, you know, you all who are attending and myself, we're not super familiar with this entire code base. So, Lazad might be able to see something happening and say, oh, I know exactly where to fix that. We're not necessarily going to be able to do that. So, looks like we've got some categories. We've got flashcards. We can manage them. We can practice them. And then we have this nice handy dandy populate database because, you know, in this case, we are just kind of doing a local demo app. Sentry is most useful, though, when you actually have it in production and you're using it out in the wild. So, we're going to populate the database, assuming someone has already populated kind of their flashcards. We can also just create one by clicking on this. Oh, maybe not. Hmm. Okay. Interesting. Actually, I think I know. Maybe because we don't have, oh, no, I don't know. See, maybe we've got some bugs.

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 🤐)
AI for React Developers
React Advanced 2024React Advanced 2024
142 min
AI for React Developers
Featured Workshop
Eve Porcello
Eve Porcello
Knowledge of AI tooling is critical for future-proofing the careers of React developers, and the Vercel suite of AI tools is an approachable on-ramp. In this course, we’ll take a closer look at the Vercel AI SDK and how this can help React developers build streaming interfaces with JavaScript and Next.js. We’ll also incorporate additional 3rd party APIs to build and deploy a music visualization app.
Topics:- Creating a React Project with Next.js- Choosing a LLM- Customizing Streaming Interfaces- Building Routes- Creating and Generating Components - Using Hooks (useChat, useCompletion, useActions, etc)
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up
From Todo App to B2B SaaS with Next.js and Clerk
React Summit US 2023React Summit US 2023
153 min
From Todo App to B2B SaaS with Next.js and Clerk
Top Content
WorkshopFree
Dev Agrawal
Dev Agrawal
If you’re like me, you probably have a million side-project ideas, some that could even make you money as a micro SaaS, or could turn out to be the next billion dollar startup. But how do you know which ones? How do you go from an idea into a functioning product that can be put into the hands of paying customers without quitting your job and sinking all of your time and investment into it? How can your solo side-projects compete with applications built by enormous teams and large enterprise companies?
Building rich SaaS products comes with technical challenges like infrastructure, scaling, availability, security, and complicated subsystems like auth and payments. This is why it’s often the already established tech giants who can reasonably build and operate products like that. However, a new generation of devtools are enabling us developers to easily build complete solutions that take advantage of the best cloud infrastructure available, and offer an experience that allows you to rapidly iterate on your ideas for a low cost of $0. They take all the technical challenges of building and operating software products away from you so that you only have to spend your time building the features that your users want, giving you a reasonable chance to compete against the market by staying incredibly agile and responsive to the needs of users.
In this 3 hour workshop you will start with a simple task management application built with React and Next.js and turn it into a scalable and fully functioning SaaS product by integrating a scalable database (PlanetScale), multi-tenant authentication (Clerk), and subscription based payments (Stripe). You will also learn how the principles of agile software development and domain driven design can help you build products quickly and cost-efficiently, and compete with existing solutions.
Create a Visually Editable Next.js Website Using React Bricks, With Blog and E-commerce
React Summit 2023React Summit 2023
139 min
Create a Visually Editable Next.js Website Using React Bricks, With Blog and E-commerce
Top Content
WorkshopFree
Matteo Frana
Matteo Frana
- React Bricks: why we built it, what it is and how it works- Create a free account- Create a new project with Next.js and Tailwind- Explore the directory structure- Anatomy of a Brick- Create a new Brick (Text-Image)- Add a title and description with RichText visual editing- Add an Image with visual editing- Add Sidebar controls to edit props (padding and image side)- Nesting Bricks using the Repeater component- Create an Image gallery brick- Publish on Netlify or Vercel- Page Types and Custom fields- Access Page meta values- Internationalization- How to reuse content across pages: Stories and Embeds- How to create an E-commerce with Products’ data from an external database and landing pages created visually in React Bricks- Advanced enterprise features: flexible permissions, locked structure, custom visual components

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

Modern Web Debugging
JSNation 2023JSNation 2023
29 min
Modern Web Debugging
Top Content
This Talk discusses modern web debugging and the latest updates in Chrome DevTools. It highlights new features that help pinpoint issues quicker, improved file visibility and source mapping, and ignoring and configuring files. The Breakpoints panel in DevTools has been redesigned for easier access and management. The Talk also covers the challenges of debugging with source maps and the efforts to standardize the source map format. Lastly, it provides tips for improving productivity with DevTools and emphasizes the importance of reporting bugs and using source maps for debugging production code.
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.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
A Practical Guide for Migrating to Server Components
React Advanced 2023React Advanced 2023
28 min
A Practical Guide for Migrating to Server Components
Top Content
Watch video: A Practical Guide for Migrating to Server Components
React query version five is live and we'll be discussing the migration process to server components using Next.js and React Query. The process involves planning, preparing, and setting up server components, migrating pages, adding layouts, and moving components to the server. We'll also explore the benefits of server components such as reducing JavaScript shipping, enabling powerful caching, and leveraging the features of the app router. Additionally, we'll cover topics like handling authentication, rendering in server components, and the impact on server load and costs.
The New Next.js App Router
React Summit 2023React Summit 2023
27 min
The New Next.js App Router
Top Content
Watch video: The New Next.js App Router
Today's Talk is about the Next.js App Router, which has evolved over the years and is now a core feature of Next.js. The Talk covers topics such as adding components, fetching remote data, and exploring layouts. It also discusses submitting form data, simplifying code, and reusing components. The App Router allows for coexistence with the existing pages router and enables data fetching at the layout level using React Server Components.
You Don’t Know How to SSR
DevOps.js Conf 2024DevOps.js Conf 2024
23 min
You Don’t Know How to SSR
The Talk covers the speaker's personal journey into server-side rendering (SSR) and the evolution of web development frameworks. It explores the use of jQuery for animations in SSR, the challenges faced in integrating React with Umbraco, and the creation of a custom SSR framework. The Talk also discusses the benefits of Next.js and the use of serverless artifacts for deployment. Finally, it highlights the features of Astro, including its function per route capability.