Skip to content

Commit 61628b6

Browse files
Filter health alerts from logging
1 parent 634023e commit 61628b6

41 files changed

Lines changed: 152 additions & 123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

application/CohortManager/src/Functions/CaasIntegration/RetrieveMeshFile/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
},
1111
"logLevel": {
1212
"HealthChecks": "Error",
13-
"HealthChecks.Extensions": "Error"
13+
"HealthChecks.Extensions": "Error",
14+
"Function.health": "Error"
1415
}
1516
}
1617
}

application/CohortManager/src/Functions/CaasIntegration/receiveCaasFile/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"logLevel": {
1313
"HealthChecks": "Error",
14-
"HealthChecks.Extensions": "Error"
14+
"HealthChecks.Extensions": "Error",
15+
"Function.health": "Error"
1516
}
1617
},
1718
"concurrency": {

application/CohortManager/src/Functions/CohortDistributionServices/DistributeParticipant/host.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"isEnabled": true,
88
"excludedTypes": "Request"
99
},
10-
"enableLiveMetricsFilters": true,
11-
"logLevel": {
12-
"HealthChecks": "Error",
13-
"HealthChecks.Extensions": "Error"
14-
}
10+
"enableLiveMetricsFilters": true
11+
},
12+
"logLevel": {
13+
"HealthChecks": "Error",
14+
"HealthChecks.Extensions": "Error",
15+
"Function.health": "Error"
1516
}
1617
},
1718
"concurrency": {

application/CohortManager/src/Functions/CohortDistributionServices/RetrieveCohortDistribution/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"logLevel": {
1313
"HealthChecks": "Error",
14-
"HealthChecks.Extensions": "Error"
14+
"HealthChecks.Extensions": "Error",
15+
"Function.health": "Error"
1516
}
1617
}
1718
}

application/CohortManager/src/Functions/CohortDistributionServices/RetrieveCohortRequestAudit/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"logLevel": {
1313
"HealthChecks": "Error",
14-
"HealthChecks.Extensions": "Error"
14+
"HealthChecks.Extensions": "Error",
15+
"Function.health": "Error"
1516
}
1617
}
1718
}

application/CohortManager/src/Functions/CohortDistributionServices/TransformDataService/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"logLevel": {
1313
"HealthChecks": "Error",
14-
"HealthChecks.Extensions": "Error"
14+
"HealthChecks.Extensions": "Error",
15+
"Function.health": "Error"
1516
}
1617
}
1718
}
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NHS.CohortManager.DemographicServices;
22

3-
using System.Net;
43
using System.Threading.Tasks;
4+
using HealthChecks.Extensions;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Http;
77
using Microsoft.Extensions.Diagnostics.HealthChecks;
@@ -18,15 +18,6 @@ public HealthCheckFunction(HealthCheckService healthCheckService)
1818
[Function("health")]
1919
public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req)
2020
{
21-
var healthReport = await _healthCheckService.CheckHealthAsync();
22-
23-
var response = req.CreateResponse(healthReport.Status == HealthStatus.Healthy ? HttpStatusCode.OK : HttpStatusCode.ServiceUnavailable);
24-
await response.WriteAsJsonAsync(new
25-
{
26-
status = healthReport.Status.ToString(),
27-
details = healthReport.Entries
28-
});
29-
30-
return response;
21+
return await HealthCheckServiceExtensions.CreateHealthCheckResponseAsync(req, _healthCheckService);
3122
}
3223
}

application/CohortManager/src/Functions/DemographicServices/DemographicDurableFunction/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
},
1111
"logLevel": {
1212
"HealthChecks": "Error",
13-
"HealthChecks.Extensions": "Error"
13+
"HealthChecks.Extensions": "Error",
14+
"Function.health": "Error"
1415
}
1516
},
1617
"extensions": {

application/CohortManager/src/Functions/DemographicServices/ManageNemsSubscription/host.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"logLevel": {
1313
"HealthChecks": "Error",
14-
"HealthChecks.Extensions": "Error"
14+
"HealthChecks.Extensions": "Error",
15+
"Function.health": "Error"
1516
}
1617
}
1718
}
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NHS.CohortManager.DemographicServices;
22

3-
using System.Net;
43
using System.Threading.Tasks;
4+
using HealthChecks.Extensions;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Http;
77
using Microsoft.Extensions.Diagnostics.HealthChecks;
@@ -18,15 +18,6 @@ public HealthCheckFunction(HealthCheckService healthCheckService)
1818
[Function("health")]
1919
public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req)
2020
{
21-
var healthReport = await _healthCheckService.CheckHealthAsync();
22-
23-
var response = req.CreateResponse(healthReport.Status == HealthStatus.Healthy ? HttpStatusCode.OK : HttpStatusCode.ServiceUnavailable);
24-
await response.WriteAsJsonAsync(new
25-
{
26-
status = healthReport.Status.ToString(),
27-
details = healthReport.Entries
28-
});
29-
30-
return response;
21+
return await HealthCheckServiceExtensions.CreateHealthCheckResponseAsync(req, _healthCheckService);
3122
}
3223
}

0 commit comments

Comments
 (0)