10 Cross-cutting concerns: monitoring and logging

 

This chapter covers:

  • Monitoring in a microservice system
  • Exploring structured logging
  • Distributed tracing across microservices
  • Logging unhandled exceptions

In this chapter, you’ll start to learn how ASP.NET Core helps us tackle some important cross—cutting concerns: monitoring, logging, and tracing. All three are needed across all microservices, and they play an important role in making a microservice system operations-friendly. Once your system is in production, you need to know whether all your microservices are up, which is why you need to monitor them. In addition, as discussed in chapter 7, you need good logging to be able to diagnose the system.

Here, you’ll configure middleware in the context of one microservice. Then, in chapter 12, you’ll take that configuration and put it into NuGet packages, ready to be reused easily across all your microservices.

10.1 Monitoring needs in microservices

 
 
 

10.2 Logging needs in microservices

 
 

10.2.1 Tracing requests across microservices

 
 

10.2.2 Structured logging with Serilog

 
 
 
 

10.3 Implementing the monitoring endpoints

 
 
 

10.3.1 Implementing the /health/live monitoring endpoint

 
 
 
 

10.3.2 Implementing the /health/startup monitoring endpoint

 
 

10.4 Implementing structured logging

 
 

10.4.1 Adding a trace id to all log messages

 
 
 

10.4.2 Trace id is included in outgoing HTTP requests

 
 

10.4.3 Logging unhandled exception

 

10.5 Implementing monitoring and logging in Kubernetes

 
 
 

10.5.1 Configure monitoring in Kubernetes

 

10.6 Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest