Page 54 - MSDN Magazine, September 2017
P. 54

ASP.NET CORE
Snapshot Debugging
for Production Apps and
Services in Azure
Nikhil Joglekar
The mantra of DevOps is to “move fast and break things.” However, this requires you to constantly fix the things that break. In production environments, detecting and diagnosing an issue can be costly in terms of time and resources. Issues that only man- ifest in production problems are among the hardest to solve. How often have you run into a problem in production that worked just fine on your development box or had to sift through thousands of logs to try to understand what caused the issue?
Currently, there are several ways you can investigate reported site issues:
Try to reproduce the issue locally. A production environ- ment is a lot more complex than a development environment: It’s often on a larger scale and houses real data in the production database. Getting a local reproduction of the issue might involve copying production data into a staging or testing environment. In the worst-case scenario, it might not be possible to reproduce an issue locally.
Sift through logs to try to find the cause of the issue. Logs will ideally contain details and context around the issue at the exact moment it happens. There’s ample tooling for collecting, aggregating and searching through logs, yet trying to find the exact details to correlate with the reported issue can be like looking for a needle in a haystack. Often, your app logs won’t contain the details necessary to identify the root cause of the problem. In such cases, you’ll have to add additional logs to your app and redeploy to get the details you need.
Call up the customer for more context. If logs and local reproduction prove fruitless, you might have to get directly in touch with the customer who ran into the issue. The customer might have interacted with the app in an unexpected or untested way.
Attach a real debugger as a last-ditch effort. Attaching a debugger into a production environment will let you inspect the state of the app, but setting and hitting a breakpoint will effec- tively stop the app from serving requests while you’re debugging.
These methods each have their pros and cons, yet even the most experienced developers following the loop can find diagnosing production issues time-consuming and difficult. In this article, I’ll introduce the Snapshot Debugger for Azure, a set of new tools in Visual Studio that can drastically reduce the time and pain in dealing with production issues.
Snapshot Debugger was designed from the ground up as a tool safe to debug production services running in Azure. It lets you debug live site issues with almost no impact to the service. Snapshot Debugging brings the ease of using a debugger to a cloud scale. There are three key functionalities in Snapshot Debugger:
This article discusses:
• Debugging live production services in Azure App Services safely • Using Snappoints to debug apps without affecting users
• Using Logpoints to add additional logging to your app Technologies discussed:
Visual Studio, Azure App Services, ASP.NET, Snapshot Debugger, Snappoints, Logpoints
46 msdn magazine

















































































   52   53   54   55   56