Share via


ResourceBuilderExtensions.WithHttpProbe Method

Definition

Overloads

WithHttpProbe<T>(IResourceBuilder<T>, ProbeType, Func<EndpointReference>, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>)

Source:
ResourceBuilderExtensions.cs

Adds a HTTP probe to the resource.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithHttpProbe<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, Aspire.Hosting.ApplicationModel.ProbeType type, Func<Aspire.Hosting.ApplicationModel.EndpointReference>? endpointSelector, string? path = default, int? initialDelaySeconds = default, int? periodSeconds = default, int? timeoutSeconds = default, int? failureThreshold = default, int? successThreshold = default) where T : Aspire.Hosting.ApplicationModel.IResourceWithEndpoints, Aspire.Hosting.ApplicationModel.IResourceWithProbes;
static member WithHttpProbe : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints and 'T :> Aspire.Hosting.ApplicationModel.IResourceWithProbes)> * Aspire.Hosting.ApplicationModel.ProbeType * Func<Aspire.Hosting.ApplicationModel.EndpointReference> * string * Nullable<int> * Nullable<int> * Nullable<int> * Nullable<int> * Nullable<int> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints and 'T :> Aspire.Hosting.ApplicationModel.IResourceWithProbes)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints and 'T :> Aspire.Hosting.ApplicationModel.IResourceWithProbes)
<Extension()>
Public Function WithHttpProbe(Of T As {IResourceWithEndpoints, IResourceWithProbes}) (builder As IResourceBuilder(Of T), type As ProbeType, endpointSelector As Func(Of EndpointReference), Optional path As String = Nothing, Optional initialDelaySeconds As Nullable(Of Integer) = Nothing, Optional periodSeconds As Nullable(Of Integer) = Nothing, Optional timeoutSeconds As Nullable(Of Integer) = Nothing, Optional failureThreshold As Nullable(Of Integer) = Nothing, Optional successThreshold As Nullable(Of Integer) = Nothing) As IResourceBuilder(Of T)

Type Parameters

T

Type of resource.

Parameters

builder
IResourceBuilder<T>

Resource builder.

type
ProbeType

Type of the probe.

endpointSelector
Func<EndpointReference>

The selector used to get endpoint reference.

path
String

The path to be used.

initialDelaySeconds
Nullable<Int32>

The initial delay before calling the probe endpoint for the first time.

periodSeconds
Nullable<Int32>

The period between each probe.

timeoutSeconds
Nullable<Int32>

Number of seconds after which the probe times out.

failureThreshold
Nullable<Int32>

Number of failures in a row before considers that the overall check has failed.

successThreshold
Nullable<Int32>

Minimum consecutive successes for the probe to be considered successful after having failed.

Returns

A reference to the IResourceBuilder<T>.

Remarks

This method allows you to specify a probe and implicit adds an http health check to the resource based on probe parameters.

For example add a probe to a resource in this way:
var service = builder.AddProject<Projects.MyService>("service")
    .WithHttpProbe(ProbeType.Liveness, "/health");

Is the same of writing:

var service = builder.AddProject<Projects.MyService>("service")
    .WithHttpProbe(ProbeType.Liveness, "/health")
    .WithHttpHealthCheck("/health");

Applies to

WithHttpProbe<T>(IResourceBuilder<T>, ProbeType, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, String)

Source:
ResourceBuilderExtensions.cs

Adds a HTTP probe to the resource.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithHttpProbe<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, Aspire.Hosting.ApplicationModel.ProbeType type, string? path = default, int? initialDelaySeconds = default, int? periodSeconds = default, int? timeoutSeconds = default, int? failureThreshold = default, int? successThreshold = default, string? endpointName = default) where T : Aspire.Hosting.ApplicationModel.IResourceWithEndpoints, Aspire.Hosting.ApplicationModel.IResourceWithProbes;
static member WithHttpProbe : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints and 'T :> Aspire.Hosting.ApplicationModel.IResourceWithProbes)> * Aspire.Hosting.ApplicationModel.ProbeType * string * Nullable<int> * Nullable<int> * Nullable<int> * Nullable<int> * Nullable<int> * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints and 'T :> Aspire.Hosting.ApplicationModel.IResourceWithProbes)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints and 'T :> Aspire.Hosting.ApplicationModel.IResourceWithProbes)
<Extension()>
Public Function WithHttpProbe(Of T As {IResourceWithEndpoints, IResourceWithProbes}) (builder As IResourceBuilder(Of T), type As ProbeType, Optional path As String = Nothing, Optional initialDelaySeconds As Nullable(Of Integer) = Nothing, Optional periodSeconds As Nullable(Of Integer) = Nothing, Optional timeoutSeconds As Nullable(Of Integer) = Nothing, Optional failureThreshold As Nullable(Of Integer) = Nothing, Optional successThreshold As Nullable(Of Integer) = Nothing, Optional endpointName As String = Nothing) As IResourceBuilder(Of T)

Type Parameters

T

Type of resource.

Parameters

builder
IResourceBuilder<T>

Resource builder.

type
ProbeType

Type of the probe.

path
String

The path to be used.

initialDelaySeconds
Nullable<Int32>

The initial delay before calling the probe endpoint for the first time.

periodSeconds
Nullable<Int32>

The period between each probe.

timeoutSeconds
Nullable<Int32>

Number of seconds after which the probe times out.

failureThreshold
Nullable<Int32>

Number of failures in a row before considers that the overall check has failed.

successThreshold
Nullable<Int32>

Minimum consecutive successes for the probe to be considered successful after having failed.

endpointName
String

The name of the endpoint to be used for the probe.

Returns

A reference to the IResourceBuilder<T>.

Remarks

This method allows you to specify a probe and implicit adds an http health check to the resource based on probe parameters.

For example add a probe to a resource in this way:
var service = builder.AddProject<Projects.MyService>("service")
    .WithHttpProbe(ProbeType.Liveness, "/health");

Is the same of writing:

var service = builder.AddProject<Projects.MyService>("service")
    .WithHttpProbe(ProbeType.Liveness, "/health")
    .WithHttpHealthCheck("/health");

Applies to