Summary
In this chapter, we explored .NET diagnostics and monitoring capabilities supported by the platform and frameworks. ASP.NET Core context propagation is enabled by default and logging providers can use it to correlate logs. We need a log management system to be able to store logs from multiple instances of a service and efficiently query them.
dotnet-monitor
allows the streaming of logs on demand from specific instances of your service, and the scraping of event counters with Prometheus to get a basic idea about service health. It can also be used for low-level performance analysis and can be run in production.
Then, we enabled OpenTelemetry auto-instrumentation for the HTTP stack and Entity Framework. HTTP and DB traces enable basic debugging capabilities, providing generic information on what happened for each remote call. You can search for traces based on attributes and query them using your tracing backend. With tracing, we can easily find a problematic service or...