Skip to content

Commit a714ba2

Browse files
authored
Storage service extension for health check service (#46)
* Add health check for MinIO * Update packages & licenses Signed-off-by: Victor Chang <vicchang@nvidia.com>
1 parent 9568db4 commit a714ba2

30 files changed

+461
-448
lines changed

.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ header:
1313
- '**/*.ruleset'
1414
- 'src/.sonarlint/**'
1515
- 'src/coverlet.runsettings'
16+
- 'src/Monai.Deploy.Storage.sln'
1617

1718
comment: on-failure
1819

doc/dependency_decisions.yml

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,22 @@
44
- :who: mocsharp
55
:why: Apache-2.0 (https://github.com/aws/aws-sdk-net/raw/master/License.txt)
66
:versions:
7-
- 3.7.12
8-
:when: 2022-08-16 18:10:42.589246033 Z
9-
- - :approve
10-
- AWSSDK.Core
11-
- :who: mocsharp
12-
:why: Apache-2.0 (https://github.com/aws/aws-sdk-net/raw/master/License.txt)
13-
:versions:
14-
- 3.7.12.21
15-
:when: 2022-08-16 18:11:12.923214877 Z
7+
- 3.7.12.26
8+
:when: 2022-08-29 18:11:12.923214877 Z
169
- - :approve
1710
- AWSSDK.S3
1811
- :who: mocsharp
1912
:why: Apache-2.0 (https://github.com/aws/aws-sdk-net/raw/master/License.txt)
2013
:versions:
21-
- 3.7.9.39
22-
:when: 2022-08-16 18:11:13.354973002 Z
14+
- 3.7.9.44
15+
:when: 2022-08-29 18:11:13.354973002 Z
2316
- - :approve
2417
- AWSSDK.SecurityToken
2518
- :who: mocsharp
2619
:why: Apache-2.0 (https://github.com/aws/aws-sdk-net/raw/master/License.txt)
2720
:versions:
28-
- 3.7.1.165
21+
- 3.7.1.190
2922
:when: 2022-08-16 18:11:13.781079769 Z
30-
- - :approve
31-
- AWSSDK.SecurityToken
32-
- :who: mocsharp
33-
:why: Apache-2.0 (https://github.com/aws/aws-sdk-net/raw/master/License.txt)
34-
:versions:
35-
- 3.7.1.185
36-
:when: 2022-08-16 18:11:14.209852227 Z
3723
- - :approve
3824
- Ardalis.GuardClauses
3925
- :who: mocsharp
@@ -81,15 +67,8 @@
8167
- :who: mocsharp
8268
:why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE)
8369
:versions:
84-
- 17.3.0
70+
- 17.3.1
8571
:when: 2022-08-16 18:11:17.245887971 Z
86-
- - :approve
87-
- Microsoft.CodeCoverage
88-
- :who: mocsharp
89-
:why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE)
90-
:versions:
91-
- 17.3.0
92-
:when: 2022-08-16 18:11:17.665958106 Z
9372
- - :approve
9473
- Microsoft.Extensions.Configuration
9574
- :who: mocsharp
@@ -160,6 +139,20 @@
160139
:versions:
161140
- 6.0.0
162141
:when: 2022-08-16 18:11:22.090772006 Z
142+
- - :approve
143+
- Microsoft.Extensions.Diagnostics.HealthChecks
144+
- :who: mocsharp
145+
:why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt)
146+
:versions:
147+
- 6.0.8
148+
:when: 2022-08-29 18:11:22.090772006 Z
149+
- - :approve
150+
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions
151+
- :who: mocsharp
152+
:why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt)
153+
:versions:
154+
- 6.0.8
155+
:when: 2022-08-29 18:11:22.090772006 Z
163156
- - :approve
164157
- Microsoft.Extensions.FileProviders.Abstractions
165158
- :who: mocsharp
@@ -207,8 +200,8 @@
207200
- :who: mocsharp
208201
:why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT)
209202
:versions:
210-
- 6.0.0
211-
:when: 2022-08-16 18:11:25.167886026 Z
203+
- 6.0.1
204+
:when: 2022-08-29 18:11:25.167886026 Z
212205
- - :approve
213206
- Microsoft.Extensions.Logging.Configuration
214207
- :who: mocsharp
@@ -270,15 +263,8 @@
270263
- :who: mocsharp
271264
:why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE)
272265
:versions:
273-
- 17.3.0
266+
- 17.3.1
274267
:when: 2022-08-16 18:11:29.155295778 Z
275-
- - :approve
276-
- Microsoft.NET.Test.Sdk
277-
- :who: mocsharp
278-
:why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE)
279-
:versions:
280-
- 17.3.0
281-
:when: 2022-08-16 18:11:29.588968034 Z
282268
- - :approve
283269
- Microsoft.NETCore.Platforms
284270
- :who: mocsharp
@@ -312,14 +298,14 @@
312298
- :who: mocsharp
313299
:why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE)
314300
:versions:
315-
- 17.3.0
301+
- 17.3.1
316302
:when: 2022-08-16 18:11:32.293966383 Z
317303
- - :approve
318304
- Microsoft.TestPlatform.TestHost
319305
- :who: mocsharp
320306
:why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE)
321307
:versions:
322-
- 17.3.0
308+
- 17.3.1
323309
:when: 2022-08-16 18:11:33.162650175 Z
324310
- - :approve
325311
- Microsoft.Win32.Primitives

src/Monai.Deploy.Storage.sln

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
<!--
3-
~ Copyright 2022 MONAI Consortium
4-
~
5-
~ Licensed under the Apache License, Version 2.0 (the "License");
6-
~ you may not use this file except in compliance with the License.
7-
~ You may obtain a copy of the License at
8-
~
9-
~ http://www.apache.org/licenses/LICENSE-2.0
10-
~
11-
~ Unless required by applicable law or agreed to in writing, software
12-
~ distributed under the License is distributed on an "AS IS" BASIS,
13-
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
~ See the License for the specific language governing permissions and
15-
~ limitations under the License.
16-
-->
17-
182
# Visual Studio Version 17
193
VisualStudioVersion = 17.1.32210.238
204
MinimumVisualStudioVersion = 10.0.40219.1

src/Plugins/AWSS3/Monai.Deploy.Storage.AWSS3.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
~ Copyright 2022 MONAI Consortium
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,8 +49,8 @@
4949

5050
<ItemGroup>
5151
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
52-
<PackageReference Include="AWSSDK.S3" Version="3.7.9.39" />
53-
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.1.185" />
52+
<PackageReference Include="AWSSDK.S3" Version="3.7.9.44" />
53+
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.1.190" />
5454
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
5555
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
5656
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />

src/Plugins/AWSS3/ServiceRegistration.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ namespace Monai.Deploy.Storage.AWSS3
2121
{
2222
public class ServiceRegistration : ServiceRegistrationBase
2323
{
24-
public ServiceRegistration(string fullyQualifiedAssemblyName) : base(fullyQualifiedAssemblyName)
25-
{
26-
}
27-
2824
public override IServiceCollection Configure(IServiceCollection services)
2925
{
3026
services.AddSingleton<IStorageService, Awss3StorageService>();

src/Plugins/AWSS3/StorageAdminService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ namespace Monai.Deploy.Storage.AWSS3
2525
public class StorageAdminService : IStorageAdminService
2626
{
2727
public Task<Credentials> CreateUserAsync(string username, AccessPermissions permissions, string[] bucketNames) => throw new NotImplementedException();
28+
2829
public Task<Credentials> CreateUserAsync(string username, PolicyRequest[] policyRequests) => throw new NotImplementedException();
30+
2931
public Task RemoveUserAsync(string username) => throw new NotImplementedException();
3032
}
3133
}

src/Plugins/MinIO/ConfigurationKeys.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ namespace Monai.Deploy.Storage.MinIO
1818
{
1919
internal static class ConfigurationKeys
2020
{
21+
public static readonly string StorageServiceName = "minio";
22+
2123
public static readonly string EndPoint = "endpoint";
2224
public static readonly string AccessKey = "accessKey";
2325
public static readonly string AccessToken = "accessToken";
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2022 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using Microsoft.Extensions.DependencyInjection;
18+
using Microsoft.Extensions.Diagnostics.HealthChecks;
19+
using Microsoft.Extensions.Logging;
20+
21+
namespace Monai.Deploy.Storage.MinIO
22+
{
23+
public class HealthCheckBuilder : HealthCheckRegistrationBase
24+
{
25+
public override IHealthChecksBuilder Configure(
26+
IHealthChecksBuilder builder,
27+
HealthStatus? failureStatus = null,
28+
IEnumerable<string>? tags = null,
29+
TimeSpan? timeout = null)
30+
{
31+
builder.Add(new HealthCheckRegistration(
32+
ConfigurationKeys.StorageServiceName,
33+
serviceProvider =>
34+
{
35+
var logger = serviceProvider.GetRequiredService<ILogger<MinIoHealthCheck>>();
36+
var minioClientFactory = serviceProvider.GetRequiredService<IMinIoClientFactory>();
37+
return new MinIoHealthCheck(minioClientFactory, logger);
38+
},
39+
failureStatus,
40+
tags,
41+
timeout));
42+
return builder;
43+
}
44+
}
45+
}

src/Plugins/MinIO/InternalsVisibleTo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
using System.Runtime.CompilerServices;
1818

1919
[assembly: InternalsVisibleTo("Monai.Deploy.Storage.MinIO.Tests")]
20+
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

src/Plugins/MinIO/LoggerMethods.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@ public static partial class LoggerMethods
2828

2929
[LoggerMessage(EventId = 20002, Level = LogLevel.Error, Message = "Error verifying objects in bucket '{bucketName}'.")]
3030
public static partial void VerifyObjectError(this ILogger logger, string bucketName, Exception ex);
31+
32+
[LoggerMessage(EventId = 20003, Level = LogLevel.Error, Message = "Health check failure.")]
33+
public static partial void HealthCheckError(this ILogger logger, Exception ex);
3134
}
3235
}

0 commit comments

Comments
 (0)