Completato check conteggio record DB

This commit is contained in:
Samuele Locatelli
2024-04-23 17:06:09 +02:00
parent 88b4e8686d
commit fbdddc0eee
6 changed files with 65 additions and 88 deletions
+7 -6
View File
@@ -28,7 +28,7 @@ var builder = WebApplication.CreateBuilder(args);
Microsoft.Extensions.Configuration.ConfigurationManager configuration = builder.Configuration;
// AspNetCore Identity setup
var connectionString = builder.Configuration.GetConnectionString("Identity.DB");
var connectionString = configuration.GetConnectionString("Identity.DB");
// REDIS setup
string connStringRedis = configuration.GetConnectionString("Redis");
@@ -62,14 +62,15 @@ if (connectionString.Contains("Server"))
}
// healthchecks
builder.Services.AddHealthChecks()
.AddSqlServer(connectionString, healthQuery: "SELECT 1;", name: "sql", failureStatus: HealthStatus.Degraded, tags: new string[] { "DB", "MsSql" })
.AddSqlServer(connectionString, healthQuery: "SELECT 1;", name: "SqlServer", failureStatus: HealthStatus.Degraded, tags: new string[] { "DB", "MsSql" })
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => WebDoorCreator.UI.Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => WebDoorCreator.UI.Health.Checks.PingCheck(redisSrvAddr))
//.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) // 512 MB max allocated memory
// 512 MB max allocated memory
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded)
.AddRedis(connStringRedis, "Redis", failureStatus: HealthStatus.Degraded)
//.AddAsyncCheck($"MsSql Root User", () => WebDoorCreator.UI.Health.Checks.DbUserRoot("MsSql"))
//.AddAsyncCheck($"MsSql Identity", () => WebDoorCreator.UI.Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
//.AddAsyncCheck($"MsSql PlantLog", () => WebDoorCreator.UI.Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME))
.AddAsyncCheck($"Config Table", () => WebDoorCreator.UI.Health.Checks.ConfigCount(configuration))
.AddAsyncCheck($"Orders Table", () => WebDoorCreator.UI.Health.Checks.OrdersCount(configuration))
.AddAsyncCheck($"Doors Table", () => WebDoorCreator.UI.Health.Checks.DoorsCount(configuration))
;
builder.Services