-
Notifications
You must be signed in to change notification settings - Fork 597
Add Health Check tags to client integrations #8877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@eerhardt, I want to do similar things for other clients at this PR, but before that, I want to see your feedback about these changes. |
@@ -136,7 +136,8 @@ private static void AddRedisClient( | |||
// That is why we don't invoke it here, but capture the state (in a closure) | |||
// and let the health check invoke it and handle the exception (if any). | |||
connectionMultiplexerFactory: sp => serviceKey is null ? sp.GetRequiredService<IConnectionMultiplexer>() : sp.GetRequiredKeyedService<IConnectionMultiplexer>(serviceKey), | |||
healthCheckName)); | |||
healthCheckName, | |||
tags: settings.HealthCheckTags)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I almost wonder if we want/need a more general way to affect the HealthCheckRegistration. It has other properties on it that a user may want to set:
- Timeout
- Delay
- Period
Any thoughts @sebastienros on if we need to be able to configure these things? Or would we tell someone to just turn ours off, and add their own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Timeout property has been configured for some clients:
aspire/src/Components/Aspire.Qdrant.Client/AspireQdrantExtensions.cs
Lines 86 to 99 in 1b7c9f7
if (!settings.DisableHealthChecks) | |
{ | |
var healthCheckName = serviceKey is null ? "Qdrant.Client" : $"Qdrant.Client_{connectionName}"; | |
builder.TryAddHealthCheck(new HealthCheckRegistration( | |
healthCheckName, | |
sp => new QdrantHealthCheck(serviceKey is null ? | |
sp.GetRequiredService<QdrantClient>() : | |
sp.GetRequiredKeyedService<QdrantClient>(serviceKey)), | |
failureStatus: null, | |
tags: null, | |
timeout: settings.HealthCheckTimeout | |
)); | |
} |
Lines 104 to 117 in 1b7c9f7
if (!settings.DisableHealthChecks) | |
{ | |
var healthCheckName = serviceKey is null ? "Elastic.Clients.Elasticsearch" : $"Elastic.Clients.Elasticsearch_{connectionName}"; | |
builder.TryAddHealthCheck(new HealthCheckRegistration( | |
healthCheckName, | |
sp => new ElasticsearchHealthCheck(serviceKey is null ? | |
sp.GetRequiredService<ElasticsearchClient>() : | |
sp.GetRequiredKeyedService<ElasticsearchClient>(serviceKey)), | |
failureStatus: null, | |
tags: null, | |
timeout: settings.HealthCheckTimeout > 0 ? TimeSpan.FromMilliseconds(settings.HealthCheckTimeout.Value) : null | |
)); | |
} |
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #2138
Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template