Xabaril / AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package
Apache License 2.0
3.98k stars 771 forks source link

Would be useful if UIResponseWriter had more extensibility #2178

Open terjew opened 3 months ago

terjew commented 3 months ago

What would you like to be added: Some way of overriding or extending the json settings used to serialize the UI Report. Eg. make a new static function taking a Lazy<JsonSerializerOptions> as argument and returning a Func<HttpContext, HealthReport, Task>.

Why is this needed: UIResponseWriter fills almost all of my needs when it comes to giving detailed responses to health checks from my services, even when I am not using the rest of the Health Check UI. However, the fact that it doesn't "pretty-print" the json (writes it indented) makes it slightly less usable, and I couldn't find any way to override the json settings without replacing the entire class.

It's a tiny feature, but it would make it possible to re-use this otherwise very useful functionality in other health check cases.