Share via


HealthChecksBuilderAddCheckExtensions.AddCheck Method

Definition

Overloads

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>)

Adds a new health check with the specified name and implementation.

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

Adds a new health check with the specified name and implementation.

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>)

Adds a new health check with the specified name and implementation.

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

Adds a new health check with the specified name and implementation.

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

Adds a new health check with the specified name and implementation.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ AddCheck(Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ builder, System::String ^ name, Microsoft::Extensions::Diagnostics::HealthChecks::IHealthCheck ^ instance, Nullable<Microsoft::Extensions::Diagnostics::HealthChecks::HealthStatus> failureStatus, System::Collections::Generic::IEnumerable<System::String ^> ^ tags);
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable<string> tags);
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder
<Extension()>
Public Function AddCheck (builder As IHealthChecksBuilder, name As String, instance As IHealthCheck, failureStatus As Nullable(Of HealthStatus), tags As IEnumerable(Of String)) As IHealthChecksBuilder

Parameters

name
String

The name of the health check.

instance
IHealthCheck

An IHealthCheck instance.

failureStatus
Nullable<HealthStatus>

The HealthStatus that should be reported when the health check reports a failure. If the provided value is null, then Unhealthy will be reported.

tags
IEnumerable<String>

A list of tags that can be used to filter health checks.

Returns

The IHealthChecksBuilder.

Applies to

AddCheck(IHealthChecksBuilder, String, IHealthCheck, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

Adds a new health check with the specified name and implementation.

public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = default, TimeSpan? timeout = default);
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> * Nullable<TimeSpan> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder
<Extension()>
Public Function AddCheck (builder As IHealthChecksBuilder, name As String, instance As IHealthCheck, Optional failureStatus As Nullable(Of HealthStatus) = Nothing, Optional tags As IEnumerable(Of String) = Nothing, Optional timeout As Nullable(Of TimeSpan) = Nothing) As IHealthChecksBuilder

Parameters

name
String

The name of the health check.

instance
IHealthCheck

An IHealthCheck instance.

failureStatus
Nullable<HealthStatus>

The HealthStatus that should be reported when the health check reports a failure. If the provided value is null, then Unhealthy will be reported.

tags
IEnumerable<String>

A list of tags that can be used to filter health checks.

timeout
Nullable<TimeSpan>

An optional TimeSpan representing the timeout of the check.

Returns

The IHealthChecksBuilder.

Applies to

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

Adds a new health check with the specified name and implementation.

public:
generic <typename T>
 where T : class, Microsoft::Extensions::Diagnostics::HealthChecks::IHealthCheck[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ AddCheck(Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ builder, System::String ^ name, Nullable<Microsoft::Extensions::Diagnostics::HealthChecks::HealthStatus> failureStatus, System::Collections::Generic::IEnumerable<System::String ^> ^ tags);
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck<T> (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable<string> tags) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck;
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder (requires 'T : null and 'T :> Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck)
<Extension()>
Public Function AddCheck(Of T As {Class, IHealthCheck}) (builder As IHealthChecksBuilder, name As String, failureStatus As Nullable(Of HealthStatus), tags As IEnumerable(Of String)) As IHealthChecksBuilder

Type Parameters

T

The health check implementation type.

Parameters

name
String

The name of the health check.

failureStatus
Nullable<HealthStatus>

The HealthStatus that should be reported when the health check reports a failure. If the provided value is null, then Unhealthy will be reported.

tags
IEnumerable<String>

A list of tags that can be used to filter health checks.

Returns

The IHealthChecksBuilder.

Remarks

This method will use GetServiceOrCreateInstance<T>(IServiceProvider) to create the health check instance when needed. If a service of type T is registered in the dependency injection container with any lifetime it will be used. Otherwise an instance of type T will be constructed with access to services from the dependency injection container.

Applies to

AddCheck<T>(IHealthChecksBuilder, String, Nullable<HealthStatus>, IEnumerable<String>, Nullable<TimeSpan>)

Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs
Source:
HealthChecksBuilderAddCheckExtensions.cs

Adds a new health check with the specified name and implementation.

public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck<T> (this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable<string>? tags = default, TimeSpan? timeout = default) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck;
static member AddCheck : Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder * string * Nullable<Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus> * seq<string> * Nullable<TimeSpan> -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder (requires 'T : null and 'T :> Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck)
<Extension()>
Public Function AddCheck(Of T As {Class, IHealthCheck}) (builder As IHealthChecksBuilder, name As String, Optional failureStatus As Nullable(Of HealthStatus) = Nothing, Optional tags As IEnumerable(Of String) = Nothing, Optional timeout As Nullable(Of TimeSpan) = Nothing) As IHealthChecksBuilder

Type Parameters

T

The health check implementation type.

Parameters

name
String

The name of the health check.

failureStatus
Nullable<HealthStatus>

The HealthStatus that should be reported when the health check reports a failure. If the provided value is null, then Unhealthy will be reported.

tags
IEnumerable<String>

A list of tags that can be used to filter health checks.

timeout
Nullable<TimeSpan>

An optional TimeSpan representing the timeout of the check.

Returns

The IHealthChecksBuilder.

Remarks

This method will use GetServiceOrCreateInstance<T>(IServiceProvider) to create the health check instance when needed. If a service of type T is registered in the dependency injection container with any lifetime it will be used. Otherwise an instance of type T will be constructed with access to services from the dependency injection container.

Applies to