concept monitoring middleware in category .net
appears as: monitoring middleware

This is an excerpt from Manning's book Microservices in .NET Core: with examples in Nancy.
Figure 9.4. You can put monitoring endpoints in a piece of OWIN middleware in front of Nancy. When a request to the /_monitor/shallow endpoint comes in, the monitoring middleware gives a 204 No Content response. When a request to the /_monitor/deep endpoint comes in, the monitoring middleware calls a function that performs a health check and then responds with 204 No Content if the health check succeeded. Other requests pass through the monitoring middleware and on to Nancy.
![]()
You implement the monitoring endpoints in OWIN middleware because doing so lets you keep the monitoring concerns separated from the business logic of the microservice. Furthermore, because you’ll put the middleware in a NuGet package and reuse it in many microservices, it’s nice that it has minimal dependencies and therefore doesn’t dictate the technology choices made in the microservices that use the middleware. Later in this chapter, you’ll implement the monitoring middleware and see how each microservice can provide its own implementation of the health check done in the /_monitor/deep endpoint.
Add the implementation of the /_monitor/deep endpoint to the monitoring middleware.