From 9f63686328de4e0af3e5cc44784f0d84ac25711f Mon Sep 17 00:00:00 2001 From: Ailton Silva Date: Tue, 5 Dec 2023 08:35:21 -0300 Subject: [PATCH 1/8] feat: add mongodb configuration overloads --- .../MongoDbHealthCheckBuilderExtensions.cs | 120 ++++++++++++++++++ .../MongoDbHealthCheck.cs | 6 + .../DependencyInjection/RegistrationTests.cs | 83 +++++++++++- 3 files changed, 208 insertions(+), 1 deletion(-) diff --git a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs index c1681a210f..157f68b3b5 100644 --- a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs @@ -190,4 +190,124 @@ public static IHealthChecksBuilder AddMongoDb( tags, timeout)); } + + /// + /// Add a health check for MongoDb that list all databases from specified . + /// + /// The . + /// A factory to build MongoClientSettings to be used. + /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddMongoDb( + this IHealthChecksBuilder builder, + Func mongoClientSettingsFactory, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + return builder.Add(new HealthCheckRegistration( + name ?? NAME, + sp => new MongoDbHealthCheck(mongoClientSettingsFactory(sp)), + failureStatus, + tags, + timeout)); + } + + /// + /// Add a health check for MongoDb database that list all collections from specified database on . + /// + /// The . + /// A factory to build MongoClientSettings to be used. + /// The Database name to check. + /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddMongoDb( + this IHealthChecksBuilder builder, + Func mongoClientSettingsFactory, + string mongoDatabaseName, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + return builder.Add(new HealthCheckRegistration( + name ?? NAME, + sp => new MongoDbHealthCheck(mongoClientSettingsFactory(sp), mongoDatabaseName), + failureStatus, + tags, + timeout)); + } + + /// + /// Add a health check for MongoDb that list all databases from specified . + /// + /// The . + /// A factory to build MongoClient to be used. + /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddMongoDb( + this IHealthChecksBuilder builder, + Func mongoClientFactory, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + return builder.Add(new HealthCheckRegistration( + name ?? NAME, + sp => new MongoDbHealthCheck(mongoClientFactory(sp)), + failureStatus, + tags, + timeout)); + } + + /// + /// Add a health check for MongoDb database that list all collections from specified database on . + /// + /// The . + /// A factory to build MongoClientSettings to be used. + /// The Database name to check. + /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddMongoDb( + this IHealthChecksBuilder builder, + Func mongoClientFactory, + string mongoDatabaseName, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + return builder.Add(new HealthCheckRegistration( + name ?? NAME, + sp => new MongoDbHealthCheck(mongoClientFactory(sp), mongoDatabaseName), + failureStatus, + tags, + timeout)); + } } diff --git a/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs b/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs index 5d1d75a41d..2b43f67c97 100644 --- a/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs +++ b/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs @@ -21,6 +21,12 @@ public MongoDbHealthCheck(string connectionString, string? databaseName = defaul } } + public MongoDbHealthCheck(MongoClient client, string? databaseName = default) + : this(client.Settings, databaseName) + { + _mongoClient[_mongoClientSettings.ToString()] = client; + } + public MongoDbHealthCheck(MongoClientSettings clientSettings, string? databaseName = default) { _specifiedDatabase = databaseName; diff --git a/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs index 99dab6119b..59ba52b5c4 100644 --- a/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs @@ -1,3 +1,4 @@ +using Microsoft.Extensions.DependencyInjection; using MongoDB.Driver; namespace HealthChecks.MongoDb.Tests.DependencyInjection; @@ -37,6 +38,45 @@ public void add_health_check_when_properly_configured_mongoClientSettings() check.ShouldBeOfType(); } [Fact] + public void add_health_check_when_properly_configured_mongoClientSettingsFactory() + { + var services = new ServiceCollection(); + + services + .AddSingleton(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring"))) + .AddHealthChecks() + .AddMongoDb(sp => sp.GetRequiredService()); + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + registration.Name.ShouldBe("mongodb"); + check.ShouldBeOfType(); + } + [Fact] + public void add_health_check_when_properly_configured_mongoClientFactory() + { + var services = new ServiceCollection(); + + services + .AddSingleton(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring"))) + .AddSingleton(sp => new MongoClient(sp.GetRequiredService())) + .AddHealthChecks() + .AddMongoDb(sp => sp.GetRequiredService()); + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + registration.Name.ShouldBe("mongodb"); + check.ShouldBeOfType(); + } + [Fact] public void add_named_health_check_when_properly_configured_connectionString() { var services = new ServiceCollection(); @@ -56,7 +96,9 @@ public void add_named_health_check_when_properly_configured_connectionString() public void add_named_health_check_when_properly_configured_mongoClientSettings() { var services = new ServiceCollection(); - services.AddHealthChecks() + + services + .AddHealthChecks() .AddMongoDb(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring")), name: "my-mongodb-group"); using var serviceProvider = services.BuildServiceProvider(); @@ -65,6 +107,45 @@ public void add_named_health_check_when_properly_configured_mongoClientSettings( var registration = options.Value.Registrations.First(); var check = registration.Factory(serviceProvider); + registration.Name.ShouldBe("my-mongodb-group"); + check.ShouldBeOfType(); + } + [Fact] + public void add_named_health_check_when_properly_configured_mongoClientSettingsFactory() + { + var services = new ServiceCollection(); + + services + .AddSingleton(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring"))) + .AddHealthChecks() + .AddMongoDb(sp => sp.GetRequiredService(), name: "my-mongodb-group"); + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + registration.Name.ShouldBe("my-mongodb-group"); + check.ShouldBeOfType(); + } + [Fact] + public void add_named_health_check_when_properly_configured_mongoClientFactory() + { + var services = new ServiceCollection(); + + services + .AddSingleton(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring"))) + .AddSingleton(sp => new MongoClient(sp.GetRequiredService())) + .AddHealthChecks() + .AddMongoDb(sp => sp.GetRequiredService(), name: "my-mongodb-group"); + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + registration.Name.ShouldBe("my-mongodb-group"); check.ShouldBeOfType(); } From 92fd784b644e835efacb2f2e08837e94fcef88b0 Mon Sep 17 00:00:00 2001 From: Ailton Silva Date: Tue, 5 Dec 2023 09:30:22 -0300 Subject: [PATCH 2/8] refactor: change MongoClient to IMongoClient --- .../MongoDbHealthCheckBuilderExtensions.cs | 4 ++-- src/HealthChecks.MongoDb/MongoDbHealthCheck.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs index 157f68b3b5..31d65dc8a3 100644 --- a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs @@ -266,7 +266,7 @@ public static IHealthChecksBuilder AddMongoDb( /// The specified . public static IHealthChecksBuilder AddMongoDb( this IHealthChecksBuilder builder, - Func mongoClientFactory, + Func mongoClientFactory, string? name = default, HealthStatus? failureStatus = default, IEnumerable? tags = default, @@ -296,7 +296,7 @@ public static IHealthChecksBuilder AddMongoDb( /// The specified . public static IHealthChecksBuilder AddMongoDb( this IHealthChecksBuilder builder, - Func mongoClientFactory, + Func mongoClientFactory, string mongoDatabaseName, string? name = default, HealthStatus? failureStatus = default, diff --git a/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs b/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs index 2b43f67c97..a0558bad7a 100644 --- a/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs +++ b/src/HealthChecks.MongoDb/MongoDbHealthCheck.cs @@ -8,7 +8,7 @@ namespace HealthChecks.MongoDb; public class MongoDbHealthCheck : IHealthCheck { private static readonly BsonDocumentCommand _command = new(BsonDocument.Parse("{ping:1}")); - private static readonly ConcurrentDictionary _mongoClient = new(); + private static readonly ConcurrentDictionary _mongoClient = new(); private readonly MongoClientSettings _mongoClientSettings; private readonly string? _specifiedDatabase; @@ -21,7 +21,7 @@ public MongoDbHealthCheck(string connectionString, string? databaseName = defaul } } - public MongoDbHealthCheck(MongoClient client, string? databaseName = default) + public MongoDbHealthCheck(IMongoClient client, string? databaseName = default) : this(client.Settings, databaseName) { _mongoClient[_mongoClientSettings.ToString()] = client; From f52987c9fe376f229d2ba702f331185176864e5c Mon Sep 17 00:00:00 2001 From: Ailton Silva Date: Tue, 5 Dec 2023 09:30:35 -0300 Subject: [PATCH 3/8] refactor: change MongoClient to IMongoClient --- .../DependencyInjection/RegistrationTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs index 59ba52b5c4..12f9ec9f0d 100644 --- a/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs @@ -1,4 +1,3 @@ -using Microsoft.Extensions.DependencyInjection; using MongoDB.Driver; namespace HealthChecks.MongoDb.Tests.DependencyInjection; From 859c8ba9fa328f44d1ea452b9e9b1f2bc51ebe04 Mon Sep 17 00:00:00 2001 From: Ailton Silva Date: Tue, 5 Dec 2023 19:37:41 -0300 Subject: [PATCH 4/8] fix: remove unnecessary MongoDb healthcheck overloads --- .../MongoDbHealthCheckBuilderExtensions.cs | 60 ------------------- .../DependencyInjection/RegistrationTests.cs | 38 ------------ 2 files changed, 98 deletions(-) diff --git a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs index 31d65dc8a3..932ec8fd18 100644 --- a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs @@ -191,66 +191,6 @@ public static IHealthChecksBuilder AddMongoDb( timeout)); } - /// - /// Add a health check for MongoDb that list all databases from specified . - /// - /// The . - /// A factory to build MongoClientSettings to be used. - /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. - /// - /// The that should be reported when the health check fails. Optional. If null then - /// the default status of will be reported. - /// - /// A list of tags that can be used to filter sets of health checks. Optional. - /// An optional representing the timeout of the check. - /// The specified . - public static IHealthChecksBuilder AddMongoDb( - this IHealthChecksBuilder builder, - Func mongoClientSettingsFactory, - string? name = default, - HealthStatus? failureStatus = default, - IEnumerable? tags = default, - TimeSpan? timeout = default) - { - return builder.Add(new HealthCheckRegistration( - name ?? NAME, - sp => new MongoDbHealthCheck(mongoClientSettingsFactory(sp)), - failureStatus, - tags, - timeout)); - } - - /// - /// Add a health check for MongoDb database that list all collections from specified database on . - /// - /// The . - /// A factory to build MongoClientSettings to be used. - /// The Database name to check. - /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. - /// - /// The that should be reported when the health check fails. Optional. If null then - /// the default status of will be reported. - /// - /// A list of tags that can be used to filter sets of health checks. Optional. - /// An optional representing the timeout of the check. - /// The specified . - public static IHealthChecksBuilder AddMongoDb( - this IHealthChecksBuilder builder, - Func mongoClientSettingsFactory, - string mongoDatabaseName, - string? name = default, - HealthStatus? failureStatus = default, - IEnumerable? tags = default, - TimeSpan? timeout = default) - { - return builder.Add(new HealthCheckRegistration( - name ?? NAME, - sp => new MongoDbHealthCheck(mongoClientSettingsFactory(sp), mongoDatabaseName), - failureStatus, - tags, - timeout)); - } - /// /// Add a health check for MongoDb that list all databases from specified . /// diff --git a/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs index 12f9ec9f0d..05b6b34c0b 100644 --- a/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.MongoDb.Tests/DependencyInjection/RegistrationTests.cs @@ -37,25 +37,6 @@ public void add_health_check_when_properly_configured_mongoClientSettings() check.ShouldBeOfType(); } [Fact] - public void add_health_check_when_properly_configured_mongoClientSettingsFactory() - { - var services = new ServiceCollection(); - - services - .AddSingleton(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring"))) - .AddHealthChecks() - .AddMongoDb(sp => sp.GetRequiredService()); - - using var serviceProvider = services.BuildServiceProvider(); - var options = serviceProvider.GetRequiredService>(); - - var registration = options.Value.Registrations.First(); - var check = registration.Factory(serviceProvider); - - registration.Name.ShouldBe("mongodb"); - check.ShouldBeOfType(); - } - [Fact] public void add_health_check_when_properly_configured_mongoClientFactory() { var services = new ServiceCollection(); @@ -110,25 +91,6 @@ public void add_named_health_check_when_properly_configured_mongoClientSettings( check.ShouldBeOfType(); } [Fact] - public void add_named_health_check_when_properly_configured_mongoClientSettingsFactory() - { - var services = new ServiceCollection(); - - services - .AddSingleton(MongoClientSettings.FromUrl(MongoUrl.Create("mongodb://connectionstring"))) - .AddHealthChecks() - .AddMongoDb(sp => sp.GetRequiredService(), name: "my-mongodb-group"); - - using var serviceProvider = services.BuildServiceProvider(); - var options = serviceProvider.GetRequiredService>(); - - var registration = options.Value.Registrations.First(); - var check = registration.Factory(serviceProvider); - - registration.Name.ShouldBe("my-mongodb-group"); - check.ShouldBeOfType(); - } - [Fact] public void add_named_health_check_when_properly_configured_mongoClientFactory() { var services = new ServiceCollection(); From f3442a5c1d1cc0050e9c8c37d2c2a01800935e3f Mon Sep 17 00:00:00 2001 From: Ailton Pinto Date: Wed, 24 Jan 2024 10:49:16 -0300 Subject: [PATCH 5/8] Update src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs Co-authored-by: Adam Sitnik --- .../DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs index 932ec8fd18..1cd52a3191 100644 --- a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs @@ -224,7 +224,8 @@ public static IHealthChecksBuilder AddMongoDb( /// Add a health check for MongoDb database that list all collections from specified database on . /// /// The . - /// A factory to build MongoClientSettings to be used. + /// A factory to build MongoClient to be used. + /// The Database name to check. /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. /// From 5028c12cca5426b53368890ba98d4b9d4b5ce185 Mon Sep 17 00:00:00 2001 From: Ailton Pinto Date: Wed, 24 Jan 2024 10:49:39 -0300 Subject: [PATCH 6/8] Update src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs Co-authored-by: Adam Sitnik --- .../DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs index 1cd52a3191..7d70eb9a67 100644 --- a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs @@ -226,7 +226,7 @@ public static IHealthChecksBuilder AddMongoDb( /// The . /// A factory to build MongoClient to be used. - /// The Database name to check. + /// The name of the database to check. /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. /// /// The that should be reported when the health check fails. Optional. If null then From f54dfa111b9e817904781475eccccfc6e972161d Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Wed, 24 Jan 2024 17:08:49 +0100 Subject: [PATCH 7/8] Apply suggestions from code review --- .../DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs index 7d70eb9a67..39a39b44bb 100644 --- a/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.MongoDb/DependencyInjection/MongoDbHealthCheckBuilderExtensions.cs @@ -225,7 +225,6 @@ public static IHealthChecksBuilder AddMongoDb( /// /// The . /// A factory to build MongoClient to be used. - /// The name of the database to check. /// The health check name. Optional. If null the type name 'mongodb' will be used for the name. /// From e275cb6d40e498663bf911a395dded8892b11bd9 Mon Sep 17 00:00:00 2001 From: Ailton Silva Date: Wed, 24 Jan 2024 15:34:21 -0300 Subject: [PATCH 8/8] feat: update HealthChecks.MongoDb.approved.txt file with new overloads --- .../HealthChecks.MongoDb.approved.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/HealthChecks.MongoDb.Tests/HealthChecks.MongoDb.approved.txt b/test/HealthChecks.MongoDb.Tests/HealthChecks.MongoDb.approved.txt index ef4c3f47fd..88613ac36a 100644 --- a/test/HealthChecks.MongoDb.Tests/HealthChecks.MongoDb.approved.txt +++ b/test/HealthChecks.MongoDb.Tests/HealthChecks.MongoDb.approved.txt @@ -2,6 +2,7 @@ namespace HealthChecks.MongoDb { public class MongoDbHealthCheck : Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { + public MongoDbHealthCheck(MongoDB.Driver.IMongoClient client, string? databaseName = null) { } public MongoDbHealthCheck(MongoDB.Driver.MongoClientSettings clientSettings, string? databaseName = null) { } public MongoDbHealthCheck(string connectionString, string? databaseName = null) { } public System.Threading.Tasks.Task CheckHealthAsync(Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckContext context, System.Threading.CancellationToken cancellationToken = default) { } @@ -12,9 +13,11 @@ namespace Microsoft.Extensions.DependencyInjection public static class MongoDbHealthCheckBuilderExtensions { public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, MongoDB.Driver.MongoClientSettings mongoClientSettings, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongoClientFactory, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongodbConnectionStringFactory, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string mongodbConnectionString, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, MongoDB.Driver.MongoClientSettings mongoClientSettings, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongoClientFactory, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func mongodbConnectionStringFactory, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMongoDb(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string mongodbConnectionString, string mongoDatabaseName, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } }