Publish ASP. NET Core health checks to AppMetrics

AppMetrics is a library that allows you to track different metrics in a .Net application, it can be everything from how many users are signing up to active socket connections. The metrics can then either be pushed or pulled using different storage solutions such as Prometheus.

If you want to include health checks in your metrics and don’t use AppMetrics Health which has built in support for reporting to AppMetrics you can use Microsoft.AspNetCore.Diagnostics.HealthChecks and the reporting service I wrote, which is based of AppMetrics Health’s HealthReporterBackgroundService:

This is a snippet of my actual implementation as I’m using NodaTime and abstractions for the Timer to make it easier to test, but I hope it’ll serve as a good base for your own implementation.

I opened a discussion issue for it here so at some point it will hopefully be a part of AppMetrics.

– Jonas