The Ultimate Guide to Live Debugging
Building software requires a constant balance between adding features and quality assurance. Every line of code you write is potentially buggy, so every new part you add harbors the potential for crashing your application—or at least annoying your users.
There are multiple steps throughout the development process where bugs can be found, and the later you find them, the more costly it is to get rid of them. A bug in your testing environment only affects you, the developer, and fixing it might be as simple as deleting a line you’ve just typed. A bug in production, however, can impact thousands of users, costing them time and money and in turn affecting a company’s bottom line.
Correlating a production problem to a line of code is complicated, and production environments are often quite different from development environments. You receive an error report and somehow reproduce it in your local environment.
Wouldn’t it be nice if you could run a debugger on the production environment and have it connected to the codebase in your editor?
What Is Live Debugging?
Live debugging tools connect your live production environment to your codebase, to the code you see in your IDE. On the software end, it offers a live debugging library for your production environment that tracks which line your software currently executes and checks the state of all variables. On the IDE end, after installing an extension, it lets you set tracepoints—the live debugging equivalent of breakpoints in traditional debugging. While breakpoints stop execution at a specific line of code, tracepoints take a snapshot of the state of your system at that line.
Figure 1: Live debugging schema
Live debugging is a remote debugging technique, because it involves connecting your local IDE with a server running somewhere else.
How Does Live Debugging Differ from APM?
Application performance management (APM) is more of a statistical approach to monitoring. The APM system gathers system metrics like latency or error rate, and shows you how your application has behaved over time. An APM system will notify you if the limits you’ve defined for your application have been exceeded, allowing you to better pinpoint the problem.
A live debugging solution, on the other hand, is like a surgical instrument. If your APM (or even worse, a user) alerts about an issue, a live debugging tool can be used to correlate the problem to a specific line of code by setting tracepoints and running the steps that led to the error.
How Does Live Debugging Differ from Error Trackers?
An error tracker is basically a slimmed-down APM that focuses on errors in your application. It logs all the errors your application throws while running in production, correlates them with different deployed versions of your application, and notifies you about its findings.
The goal of an error tracker is to ensure no bugs go undetected, while the purpose of a live debugger is to locate and fix these problems.
With these two different goals in mind, the best option is to use APMs or error trackers in tandem with live debugging. Using an error tracker or APM in combination with live debugging gives you the best of both worlds—the former allows you to monitor your production environment and alerts of any issues, while the latter allows you to implement fixes based on these insights.
What Problems Does Live Debugging Solve?
With the growing reliance on cloud computing and distributed microservice architectures, quality assurance is becoming increasingly complex. In today’s IT landscape, to mirror a production environment on the developer’s computer is no longer feasible. Live debugging does away with this complexity and delivers only the information necessary for debugging.
Issues often arise along the borders of these distributed systems: The connection points are where things tend to go wrong. This can lead developers down a never-ending rabbit hole, requiring them to gather all the APM and error-tracking information scattered across their organization’s monitoring landscape. Live debugging tools, however, allow developers to consolidate all that information within their IDE.
When one service sends a request to another, the data used in the request and response often ends up in the variables of the sending service. A tracepoint provides a snapshot of those variables and lets you see how the data of both systems has affected the behavior.
Live debugging is about error remediation. It provides you with detailed, real-time insights, allowing you to discover and fix bugs faster. Live debugging won’t warn you of potential or actual problems—it’s a precision tool you use to fix one bug at a time.
How Does Sidekick Compare to Other Remote Debugging Solutions?
Manufacturers like Microsoft and Google tend to offer remote debugging solutions in their portfolios. So what makes Sidekick unique?
Microsoft’s main IDE product, Visual Studio, comes with a remote debugging feature for .NET languages and C++. You install a remote tools suite and connect your IDE with your servers. Unlike Sidekick, however, these tools don’t offer tracepoints. So if you start remote debugging, your remote environment will be blocked when you hit a breakpoint.
On top of this, Microsoft’s remote debugger connects directly from the development computer to the remote server, which can lead to all kinds of network problems: Is the correct port forwarded? Does your firewall block access?
Sidekick’s live debugging works via a proxy server, meaning your development computer doesn’t have to connect to your production environment over an obscure port configuration.
The same is true for IntelliJ IDEA remote debugging. Neither Visual Studio’s nor IntelliJ’s remote debugging solutions target production environments; instead they focus on staging and development deployments. Sidekick’s live debugging is all about getting production data from the actual systems your customers use every day.
Debugging Your Production Environment in Real Time
Debugging your production environment real time is the only surefire way to see how your software will behave with real users. While remote debugging systems provide insights from your staging deployments, live debugging with Sidekick is the only way to gather production data with unintrusive mechanisms like tracepoints.
Sidekick hosts all the services necessary to manage the connections, so you can easily connect your IDE without having to meddle with network configurations and firewalls.
Sidekick helps you debug your production applications with zero code changes faster than ever without stopping execution. Get started today.