In this part, you’ll learn how to handle some important cross-cutting concerns. The cross-cutting concerns you’ll handle include monitoring, logging, passing trace IDs along with requests between microservices, and security concerns around microservice-to-microservice requests. All these concerns make microservices behave well in production. With them in place, you can gain insight into the health of each microservice and trace business transactions across microservices. In chapter 9, we will leverage features of ASP.NET to help implement monitoring, logging, and tracing concerns.
In chapter 10, we survey different approaches to authentication and authorization and to securing microservices-to-microservice requests, as well as authentications and authorization. As an example, we will leverage Kubernetes to secure requests and to control which microservices are allowed to call each other.
You can implement such concerns in each microservice, or create reusable implementations to use in many microservices. Implementing concerns in each microservice obviously incurs some duplication of effort, but reusing an implementation creates coupling between microservices. How much you want to reuse is, in other words, a tradeoff between keeping microservices independent of each other and avoiding repeated effort. Where you land on this tradeoff is a decision you’ll have to make in the context of your system.