chore: remove obsolete ChartServiceHealthCheck and ChartService config (chart now generated internally)
This commit is contained in:
@@ -33,37 +33,3 @@ public class DatabaseHealthCheck : IHealthCheck
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica connettività al servizio chart esterno.
|
||||
/// </summary>
|
||||
public class ChartServiceHealthCheck : IHealthCheck
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly string _baseUrl;
|
||||
|
||||
public ChartServiceHealthCheck(IHttpClientFactory httpClientFactory, IConfiguration config)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_baseUrl = config["ChartService:BaseUrl"] ?? "";
|
||||
}
|
||||
|
||||
public async Task<HealthCheckResult> CheckHealthAsync(
|
||||
HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_baseUrl))
|
||||
return HealthCheckResult.Degraded("ChartService:BaseUrl non configurato.");
|
||||
|
||||
try
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient("ChartService");
|
||||
var response = await client.GetAsync(_baseUrl, cancellationToken);
|
||||
return response.IsSuccessStatusCode
|
||||
? HealthCheckResult.Healthy("Chart service raggiungibile.")
|
||||
: HealthCheckResult.Degraded($"Chart service risponde con status {response.StatusCode}.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return HealthCheckResult.Degraded("Chart service non raggiungibile.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user