Add Kaigen API health check and configuration

- Introduced Kaigen configuration section in appsettings.Oda.json with BaseUrl.
- Added HTTP client for Kaigen API health check in Program.cs.
- Registered KaigenHealthCheck service for monitoring Kaigen API connectivity.
This commit is contained in:
2025-11-19 00:59:49 +07:00
parent 5176e41583
commit 3236edd2bb
3 changed files with 107 additions and 0 deletions

View File

@@ -78,11 +78,16 @@ builder.Services.AddHealthChecks()
var postgreSqlConnectionString = builder.Configuration.GetSection(Constants.Databases.PostgreSql)["ConnectionString"];
var influxUrl = builder.Configuration.GetSection(Constants.Databases.InfluxDb)["Url"];
var web3ProxyUrl = builder.Configuration.GetSection("Web3Proxy")["BaseUrl"];
var kaigenBaseUrl = builder.Configuration.GetSection("Kaigen")["BaseUrl"];
// Add HTTP client for Web3Proxy health check with detailed response
builder.Services.AddHttpClient("Web3ProxyHealthCheck")
.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromSeconds(15); });
// Add HTTP client for Kaigen API health check
builder.Services.AddHttpClient("KaigenHealthCheck")
.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromSeconds(15); });
// Add HTTP client for GMX API health check
builder.Services.AddHttpClient("GmxHealthCheck")
.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromSeconds(10); });
@@ -91,6 +96,10 @@ builder.Services.AddHttpClient("GmxHealthCheck")
builder.Services.AddSingleton<Web3ProxyHealthCheck>(sp =>
new Web3ProxyHealthCheck(sp.GetRequiredService<IHttpClientFactory>(), web3ProxyUrl));
// Register KaigenHealthCheck with the kaigenBaseUrl
builder.Services.AddSingleton<KaigenHealthCheck>(sp =>
new KaigenHealthCheck(sp.GetRequiredService<IHttpClientFactory>(), kaigenBaseUrl));
// Add SQL Loop Detection Service with Sentry integration
// Configure SQL monitoring settings
builder.Services.Configure<SqlMonitoringSettings>(builder.Configuration.GetSection("SqlMonitoring"));
@@ -149,6 +158,7 @@ builder.Services.AddHealthChecks()
.AddCheck<CandleDataHealthCheck>("candle-data", tags: ["database", "candles"])
.AddCheck<CandleDataDetailedHealthCheck>("candle-data-detailed", tags: ["database", "candles-detailed"])
.AddCheck<GmxConnectivityHealthCheck>("gmx-connectivity", tags: ["api", "external"])
.AddCheck<KaigenHealthCheck>("kaigen-api", tags: ["api", "external"])
.AddCheck<OrleansHealthCheck>("orleans-cluster", tags: ["orleans", "cluster"]);
builder.Host.UseSerilog((hostBuilder, loggerConfiguration) =>