✅ Supporting multiple routes for health checks in asp.net core
I have a couple monitoring systems that need are calling some api's and I need to support different response types for each monitoring system. Is there a way in asp.net core? Assume I have a number of health probes, for example...
.AddHealthCheck<Db2HealthCheck>()
.AddHealthCheck<SqlHealthCheck>()
.AddHealthCheck<DynamoHealthCheck>()
.AddHealthCheck<CognitoHealthCheck>()
.AddHealthCheck<YadaYadaYada>()
The yadayadayada monitor should only check the YadaYadaYada health check, for example
The Aws monitor should only check the CognitoHealthCheck
The database monitor should oinly check Db2, Dynamo, and SqlHealthCheck
12 Replies
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
now what can be done is adding multiple time the MapHealthCheck with various URI and in each have some logic to get the results each healthcheck can have Tags for example so you could use LINQ on name / type / tags etc ....This is the part I wasn't certain of
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
I've done the one health check endpoint before
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
Thanks @TeBeCo this is exactly what I need
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
I follow a similar pattern for adding some other depdendencies, I like adding the health check there.
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
it's buttoned up nicely that way without a giant wall of DI text
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
Thanks again