FabricClient.HealthClient.GetPartitionHealthAsync Method

Definition

Overloads

GetPartitionHealthAsync(Guid, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

GetPartitionHealthAsync(PartitionHealthQueryDescription, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

GetPartitionHealthAsync(Guid, ApplicationHealthPolicy, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

GetPartitionHealthAsync(Guid)

Asynchronously gets the health of a Service Fabric partition.

GetPartitionHealthAsync(PartitionHealthQueryDescription)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

GetPartitionHealthAsync(Guid, ApplicationHealthPolicy)

Asynchronously gets the health of a Service Fabric partition.

GetPartitionHealthAsync(Guid, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth> GetPartitionHealthAsync (Guid partitionId, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetPartitionHealthAsync : Guid * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth>
Public Function GetPartitionHealthAsync (partitionId As Guid, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of PartitionHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

timeout
TimeSpan

The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.

cancellationToken
CancellationToken

The optional cancellation token that the operation is observing. It can be used to send a notification that the operation should be canceled. Note that cancellation is advisory and that the operation may still be completed even if it is canceled.

Returns

Task<PartitionHealth>

The health of a Service Fabric partition.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the user provided timeout to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetPartitionHealthAsync(PartitionHealthQueryDescription, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth> GetPartitionHealthAsync (System.Fabric.Description.PartitionHealthQueryDescription queryDescription, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetPartitionHealthAsync : System.Fabric.Description.PartitionHealthQueryDescription * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth>
Public Function GetPartitionHealthAsync (queryDescription As PartitionHealthQueryDescription, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of PartitionHealth)

Parameters

queryDescription
PartitionHealthQueryDescription

The query description.

timeout
TimeSpan

The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.

cancellationToken
CancellationToken

The optional cancellation token that the operation is observing. It can be used to send a notification that the operation should be canceled. Note that cancellation is advisory and that the operation may still be completed even if it is canceled.

Returns

Task<PartitionHealth>

The health of a Service Fabric partition.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the user provided timeout to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetPartitionHealthAsync(Guid, ApplicationHealthPolicy, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth> GetPartitionHealthAsync (Guid partitionId, System.Fabric.Health.ApplicationHealthPolicy healthPolicy, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetPartitionHealthAsync : Guid * System.Fabric.Health.ApplicationHealthPolicy * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth>
Public Function GetPartitionHealthAsync (partitionId As Guid, healthPolicy As ApplicationHealthPolicy, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of PartitionHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

healthPolicy
ApplicationHealthPolicy

The application health policy used to evaluate the entity health.

timeout
TimeSpan

The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.

cancellationToken
CancellationToken

The optional cancellation token that the operation is observing. It can be used to send a notification that the operation should be canceled. Note that cancellation is advisory and that the operation may still be completed even if it is canceled.

Returns

Task<PartitionHealth>

The health of a Service Fabric partition.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the user provided timeout to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetPartitionHealthAsync(Guid)

Asynchronously gets the health of a Service Fabric partition.

public System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth> GetPartitionHealthAsync (Guid partitionId);
member this.GetPartitionHealthAsync : Guid -> System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth>
Public Function GetPartitionHealthAsync (partitionId As Guid) As Task(Of PartitionHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

Returns

Task<PartitionHealth>

The health of a Service Fabric partition.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the specified time to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Remarks

The following example gets the health of a partition.

```csharp public static bool GetPartitionHealth(string clusterConnection) { PartitionHealth partitionHealth;

// Connect to the cluster. FabricClient fabricClient = new FabricClient(clusterConnection);

// Get the partition health. try { partitionHealth = fabricClient.HealthManager.GetPartitionHealthAsync(new Guid("a7206315-e53b-4d05-b59c-e210caa28893")).Result; } catch (Exception e) { Console.WriteLine("Error: " + e.Message);

if (e.InnerException != null) Console.WriteLine(" Inner Exception: " + e.InnerException.Message);

return false; }

// Display the partition health information. Console.WriteLine("Partition Health:"); Console.WriteLine(" Partition ID: " + partitionHealth.PartitionId); Console.WriteLine(" Aggregated Health State: " + partitionHealth.AggregatedHealthState);

// List the health events. Console.WriteLine(" Health Events:"); IList

Applies to

GetPartitionHealthAsync(PartitionHealthQueryDescription)

Asynchronously gets the health of a Service Fabric partition by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth> GetPartitionHealthAsync (System.Fabric.Description.PartitionHealthQueryDescription queryDescription);
member this.GetPartitionHealthAsync : System.Fabric.Description.PartitionHealthQueryDescription -> System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth>
Public Function GetPartitionHealthAsync (queryDescription As PartitionHealthQueryDescription) As Task(Of PartitionHealth)

Parameters

queryDescription
PartitionHealthQueryDescription

The query description.

Returns

Task<PartitionHealth>

The health of a Service Fabric partition.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the specified time to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetPartitionHealthAsync(Guid, ApplicationHealthPolicy)

Asynchronously gets the health of a Service Fabric partition.

public System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth> GetPartitionHealthAsync (Guid partitionId, System.Fabric.Health.ApplicationHealthPolicy healthPolicy);
member this.GetPartitionHealthAsync : Guid * System.Fabric.Health.ApplicationHealthPolicy -> System.Threading.Tasks.Task<System.Fabric.Health.PartitionHealth>
Public Function GetPartitionHealthAsync (partitionId As Guid, healthPolicy As ApplicationHealthPolicy) As Task(Of PartitionHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

healthPolicy
ApplicationHealthPolicy

The application health policy used to evaluate the entity health.

Returns

Task<PartitionHealth>

The health of a Service Fabric partition.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the specified time to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to