Created
September 10, 2019 14:47
-
-
Save ntakouris/446f60c1aa6b9ff7ea0f94ad488de98c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.UseHealthChecks("/health", new HealthCheckOptions | |
{ | |
ResponseWriter = async (context, report) => | |
{ | |
context.Response.ContentType = "application/json"; | |
var response = new HealthCheckResponse | |
{ | |
Status = report.Status.ToString(), | |
Checks = report.Entries.Select(x => new HealthCheck | |
{ | |
Component = x.Key, | |
Status = x.Value.Status.ToString(), | |
Description = x.Value.Description | |
}), | |
Duration = report.TotalDuration | |
}; | |
await context.Response.WriteAsync(JsonConvert.SerializeObject(response)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment