Chapter 5. Monitoring, Metrics, and APM
The CI and deployment pipeline tests give us confidence that our change will work in Production. This confidence comes from a combination of functional testing, covering the user-facing behavior of the system, and technical/performance testing, covering operational aspects of the system. However, after we have released our code to Production, how do we verify that the state of your system is still good and has not degraded? This is where monitoring comes in.
Performance Counters Are Insufficient
Windows provides Performance Counters to allow monitoring of server health. These standard counters will provide information such as memory and CPU usage and some generic .NET framework information such as number of exceptions thrown and time spent in garbage collection. However, these do not tell you if your app is working as expected, only whether the machine is under any load, and custom performance counters are tricky to work with.
Record Application Metrics
Open source tooling can be used very effectively for gathering application metrics. StatsD and Graphite are a common pairing; hosted on Linux, they are cost-effective to set up.
StatsD listens for statistics, like counters and timers, sent over UDP or TCP, and sends aggregates to the Graphite backend. Graphite (Figure 5-1) provides querying and graphing tools to visualize the metrics. Many open source .NET clients exist that make it simpler to add StatsD metrics to your applications; they ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access