Skip to content

Commit

Permalink
add new error as customer error; add option to disable health check
Browse files Browse the repository at this point in the history
  • Loading branch information
jnlycklama committed Feb 6, 2024
1 parent 245e308 commit 329b200
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ namespace Microsoft.Health.Dicom.Blob.Extensions;

internal static class BlobStorageErrorExtensions
{
private static readonly List<BlobErrorCode> Customer400ErrorCodes = new List<BlobErrorCode>
{
BlobErrorCode.UnsupportedHeader
};

private static readonly List<BlobErrorCode> Customer401ErrorCodes = new List<BlobErrorCode>
{
BlobErrorCode.InvalidAuthenticationInfo,
Expand Down Expand Up @@ -44,7 +49,8 @@ internal static class BlobStorageErrorExtensions

public static bool IsConnectedStoreCustomerError(this RequestFailedException rfe)
{
return (rfe.Status == 401 && Customer401ErrorCodes.Any(e => e.ToString().Equals(rfe.ErrorCode, StringComparison.OrdinalIgnoreCase))) ||
return (rfe.Status == 400 && Customer400ErrorCodes.Any(e => e.ToString().Equals(rfe.ErrorCode, StringComparison.OrdinalIgnoreCase))) ||
(rfe.Status == 401 && Customer401ErrorCodes.Any(e => e.ToString().Equals(rfe.ErrorCode, StringComparison.OrdinalIgnoreCase))) ||
(rfe.Status == 403 && Customer403ErrorCodes.Any(e => e.ToString().Equals(rfe.ErrorCode, StringComparison.OrdinalIgnoreCase))) ||
(rfe.Status == 404 && Customer404ErrorCodes.Any(e => e.ToString().Equals(rfe.ErrorCode, StringComparison.OrdinalIgnoreCase))) ||
(rfe.Status == 409 && Customer409ErrorCodes.Any(e => e.ToString().Equals(rfe.ErrorCode, StringComparison.OrdinalIgnoreCase)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ public static IDicomServerBuilder AddBlobDataStores(this IDicomServerBuilder ser
serverBuilder.Services
.AddPersistence<IFileStore, BlobFileStore>();

serverBuilder.Services
.AddHealthChecks()
.AddCheck<DicomConnectedStoreHealthCheck>("DcmHealthCheck");
if (featureConfiguration.EnableExternalStoreHealthCheck)
{
serverBuilder.Services
.AddHealthChecks()
.AddCheck<DicomConnectedStoreHealthCheck>("DcmHealthCheck");
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ public class FeatureConfiguration
/// Disables all async operations
/// </summary>
public bool DisableOperations { get; set; }

/// <summary>
/// Enabled the health check for external store
/// </summary>
public bool EnableExternalStoreHealthCheck { get; set; }
}
3 changes: 2 additions & 1 deletion src/Microsoft.Health.Dicom.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
"EnableFullDicomItemValidation": false,
"EnableOhifViewer": true,
"EnableExternalStore": false,
"DisableOperations": false
"DisableOperations": false,
"EnableExternalStoreHealthCheck": true
},
"Services": {
"DeletedInstanceCleanup": {
Expand Down

0 comments on commit 329b200

Please sign in to comment.