aspnet / Diagnostics

[Archived] Diagnostics middleware for reporting info and handling exceptions and errors in ASP.NET Core, and diagnosing Entity Framework Core migrations errors. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
213 stars 108 forks source link

[Feature request] HealthCheckResult and health checks execution time #491

Closed unaizorrilla closed 6 years ago

unaizorrilla commented 6 years ago

There is any plan to include the execution time ( or the whole execution time ) of health checks in the HealthCheckResult?

This data can be usefull for other stories like HealthCheck tracking results. PR can be accepted?

mkArtakMSFT commented 6 years ago

Thanks for contacting us, @unaizorrilla. @glennc, @rynowak thoughts? Including the execution time into the result seems like a reasonable ask to me. I would actually even think that the execution time would be useful per HealthReportEntry.

rynowak commented 6 years ago

Sure, we can this, this seems reasonable.

unaizorrilla commented 6 years ago

PR can be accepted?

rynowak commented 6 years ago

Sure

rynowak commented 6 years ago

Feel free to send a PR - if you don't get it together by lets say Weds next week then I will just do it so that it gets into preview3.

What I had in mind for this was to add public TimeSpan Duration { get; } property to HealthReportEntry and a public TimeSpan TotalDuration { get; } to HealthReport.

We already collect this data for logging, so this will be pretty easy: https://github.com/aspnet/Diagnostics/blob/release/2.2/src/Microsoft.Extensions.Diagnostics.HealthChecks/DefaultHealthCheckService.cs#L49 https://github.com/aspnet/Diagnostics/blob/release/2.2/src/Microsoft.Extensions.Diagnostics.HealthChecks/DefaultHealthCheckService.cs#L83

rynowak commented 6 years ago

Thanks!