-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WaitFor for Qdrant * Address PR feedback * Address PR feedback * Don't use logger factory. --------- Co-authored-by: Alireza Baloochi <[email protected]>
- Loading branch information
1 parent
865775b
commit f4e3bc3
Showing
6 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
|
||
namespace Aspire.Qdrant.Client; | ||
internal sealed class QdrantHealthCheck : IHealthCheck | ||
{ | ||
private readonly HttpClient _client; | ||
|
||
public QdrantHealthCheck(HttpClient client) | ||
{ | ||
ArgumentNullException.ThrowIfNull(client, nameof(client)); | ||
_client = client; | ||
} | ||
|
||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) | ||
{ | ||
try | ||
{ | ||
var response = await _client.GetAsync("/readyz", cancellationToken).ConfigureAwait(false); | ||
|
||
return response.IsSuccessStatusCode | ||
? HealthCheckResult.Healthy() | ||
: new HealthCheckResult(HealthStatus.Unhealthy); | ||
} | ||
catch (Exception ex) | ||
{ | ||
return new HealthCheckResult(context.Registration.FailureStatus, exception: ex); | ||
} | ||
} | ||
} |
This file contains 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