Skip to content

Commit a91f91b

Browse files
added missing health check endpoint in AuditWriter
1 parent c548d67 commit a91f91b

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

application/CohortManager/src/Functions/AuditServices/AuditWriter/AuditWriter.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Azure.Functions.Worker" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" />
1213
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" />
1314
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" />
1415
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace NHS.CohortManager.AuditServices;
2+
3+
using System.Threading.Tasks;
4+
using HealthChecks.Extensions;
5+
using Microsoft.Azure.Functions.Worker;
6+
using Microsoft.Azure.Functions.Worker.Http;
7+
using Microsoft.Extensions.Diagnostics.HealthChecks;
8+
9+
public class HealthCheckFunction
10+
{
11+
private readonly HealthCheckService _healthCheckService;
12+
13+
public HealthCheckFunction(HealthCheckService healthCheckService)
14+
{
15+
_healthCheckService = healthCheckService;
16+
}
17+
18+
[Function("health")]
19+
public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req)
20+
{
21+
return await HealthCheckServiceExtensions.CreateHealthCheckResponseAsync(req, _healthCheckService);
22+
}
23+
}

0 commit comments

Comments
 (0)