Skip to content
This repository has been archived by the owner on Dec 8, 2018. It is now read-only.

Ability to throttle calls to IHealthCheck #515

Closed
alecor191 opened this issue Oct 27, 2018 · 3 comments
Closed

Ability to throttle calls to IHealthCheck #515

alecor191 opened this issue Oct 27, 2018 · 3 comments
Labels

Comments

@alecor191
Copy link

With Preview2 we implemented several health checks. Some were really cheap to execute and others were a bit more expensive. Services are running in a Kubernetes cluster and the health check endpoints are called quite frequently (every couple of seconds).

We implemented a decorator IHealthCheck that can be configured with a throttling interval. I.e. depending on how "expensive" the underlying health check is, we can configure the maximum frequency an IHealthCheck implementation can be invoked.

As in Preview3 a couple more IHealthCheck implementations were added (like DbContextHealthCheck), I was wondering if there is a way to configure the max. frequency of an IHealthCheck implementation.

IOW if e.g. I want a DbContextHealthCheck to be called at most once per minute, is there a way to configure/ensure this?

@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @alecor191.
@rynowak thoughts?

@mkArtakMSFT
Copy link
Member

Not even sure whether this is something we should do at all. Leaving it up to you, @rynowak.

@rynowak
Copy link
Member

rynowak commented Oct 31, 2018

If you feel like you really need to do this, I'd recommend using HealthCheckRegistration.Factory to plug in a decorator https://github.com/aspnet/Diagnostics/blob/release/2.2/src/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions/HealthCheckRegistration.cs#L91

You can access these via the options type https://github.com/aspnet/Diagnostics/blob/4259b65c1619380a0fc14c1b906269fbf5ae0c82/src/Microsoft.Extensions.Diagnostics.HealthChecks/HealthCheckServiceOptions.cs

I'm not sure that we'll add anything like this as a built-in feature, but the ability to decorate a health check is already there.

@rynowak rynowak closed this as completed Oct 31, 2018
@rynowak rynowak removed this from the 3.0.0-preview1 milestone Oct 31, 2018
@rynowak rynowak removed their assignment Oct 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants