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

Add support for push-based health checks #490

Closed unaizorrilla closed 6 years ago

unaizorrilla commented 6 years ago

Hi,

Saving/tracking the whole history of health check information is very usefull on many enterprise system.

Moving health status and other related information as metrics to Application Insights , Promethus etc can be a awesome feature to be included on Health Checks.

There is any plan to include this? PR can be accepted?

Regards Unai

mkArtakMSFT commented 6 years ago

Thanks for contacting us, @unaizorrilla. @glennc, is this something we plan to add support for?

rynowak commented 6 years ago

Hi @unaizorrilla - we planned for push based health checks to work by registering a long running service that calls into the health checks service at regular intervals. I think this will work better since you can control the interval, and it doesn't rely on traffic to the health endpoint to function correctly. Also it can be used by apps that aren't doing http at all!

We think that we don't really need to put a feature in the box for this, and I was going to write a sample.

What do you think about this? Have I understood what you're asking for? Should I make the sample and then we can discuss further?

unaizorrilla commented 6 years ago

Hi @rynowak!

We don't talk about the same topic :-) my fault!!

My feature request is not about executing IHealthCheckService periodically with IHostedService, configured liveness / readiness on K8S,availability alerts on AppInsights or something similar.

The "trackers" idea is the same i do on BeatPulse:

https://github.com/xabaril/beatpulse#tracking-pulses

With trackers you can send the HealthCheckReport information to third parties ( Application Insights, Prometheus, etc.) This information is very usefull to create dashboards and KPI with availability service metrics or dependencies response times.

Grafana Availability Sample With Beatpulse

The design for this request can be:

public interface IHealthCheckTracker { Task Track(HealthCheckReport report) }

Regards Unai

rynowak commented 6 years ago

OK, it appears we understand each other but I'm still missing something.

Why is it better to have the latter for feeding data to app insights/prometheus?

If your goal is to capture detailed for correlation and offline analysis then we already feed that into logging. Is this not good enough?

If your goal is try and use health checks as a metric system, wouldn't you want that to be independent of someone visiting the health endpoint?

unaizorrilla commented 6 years ago

"If your goal is try and use health checks as a metric system?"

Yes

"wouldn't you want that to be independent of someone visiting the health endpoint?"

Thanks again! Unai

mkArtakMSFT commented 6 years ago

Thanks for contacting us. We believe that the question you've raised have been answered. If you still feel a need to continue the discussion, feel free to reopen it and add your comments.

rynowak commented 6 years ago

We're implementing push-based health checks so that @unaizorrilla can port his code on top of it. This item tracks that work.