11using LantanaGroup . Link . LinkAdmin . BFF . Application . Clients ;
2- using LantanaGroup . Link . LinkAdmin . BFF . Application . Models ;
32using LantanaGroup . Link . LinkAdmin . BFF . Application . Models . Health ;
3+ using Microsoft . Extensions . Diagnostics . HealthChecks ;
44
55namespace LantanaGroup . Link . LinkAdmin . BFF . Presentation . Endpoints . System . Hanlders ;
66
77public static class GetSystemHealth
88{
99 public static async Task < IResult > Handle ( HttpContext context ,
10+ HealthCheckService healthCheckService ,
1011 AccountService accountService ,
1112 AuditService auditService ,
1213 CensusService censusService ,
@@ -17,7 +18,8 @@ public static async Task<IResult> Handle(HttpContext context,
1718 SubmissionService submissionService ,
1819 TenantService tenantService ,
1920 MeasureEvalService measureEvalService ,
20- ValidationService validationService )
21+ ValidationService validationService ,
22+ TerminologyService terminologyService )
2123 {
2224
2325 var dotNetHealthCheckTasks = new List < Task < LinkServiceHealthReport > >
@@ -30,7 +32,24 @@ public static async Task<IResult> Handle(HttpContext context,
3032 queryDispatchService . LinkServiceHealthCheck ( context . RequestAborted ) ,
3133 reportService . LinkServiceHealthCheck ( context . RequestAborted ) ,
3234 submissionService . LinkServiceHealthCheck ( context . RequestAborted ) ,
33- tenantService . LinkServiceHealthCheck ( context . RequestAborted )
35+ tenantService . LinkServiceHealthCheck ( context . RequestAborted ) ,
36+ terminologyService . LinkServiceHealthCheck ( context . RequestAborted )
37+ } ;
38+
39+ // Get Admin BFF health
40+ var bffHealthReport = await healthCheckService . CheckHealthAsync ( context . RequestAborted ) ;
41+ var bffLinkReport = new LinkServiceHealthReport
42+ {
43+ Service = "Admin BFF" ,
44+ Status = bffHealthReport . Status ,
45+ TotalDuration = bffHealthReport . TotalDuration ,
46+ Entries = bffHealthReport . Entries . ToDictionary (
47+ x => x . Key ,
48+ x => new LinkServiceHealthReportEntry
49+ {
50+ Status = x . Value . Status ,
51+ Duration = x . Value . Duration
52+ } )
3453 } ;
3554
3655 //if we upgrade to .NET 9, we can use Task.WhenEach
@@ -45,6 +64,7 @@ public static async Task<IResult> Handle(HttpContext context,
4564 validationHealthSummary . CacheConnection = LinkServiceHealthStatus . NotApplicable ;
4665
4766 var healthSummary = results . Select ( LinkServiceHealthReportExtensions . FromDomain ) . ToList ( ) ;
67+ healthSummary . Add ( LinkServiceHealthReportExtensions . FromDomain ( bffLinkReport ) ) ;
4868 healthSummary . Add ( measureEvalHealthSummary ) ;
4969 healthSummary . Add ( validationHealthSummary ) ;
5070
0 commit comments