FabricClient.HealthClient.GetPartitionHealthAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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:
CommunicationError is returned when a communication error caused the operation to fail.
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
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:
CommunicationError is returned when a communication error caused the operation to fail.
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
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:
CommunicationError is returned when a communication error caused the operation to fail.
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
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:
CommunicationError is returned when a communication error caused the operation to fail.
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.
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<HealthEvent> healthEvents = partitionHealth.HealthEvents;
foreach (HealthEvent healthEvent in healthEvents)
{
Console.WriteLine(" Health Event:");
Console.WriteLine(" Last Modified: " + healthEvent.LastModifiedUtcTimestamp);
Console.WriteLine(" Source UTC Timestamp: " + healthEvent.SourceUtcTimestamp);
Console.WriteLine(" Is Expired: " + healthEvent.IsExpired);
Console.WriteLine(" Health Information:");
Console.WriteLine(" Description: " + healthEvent.HealthInformation.Description);
Console.WriteLine(" Source ID: " + healthEvent.HealthInformation.SourceId);
Console.WriteLine(" Health State: " + healthEvent.HealthInformation.HealthState);
Console.WriteLine(" Property: " + healthEvent.HealthInformation.Property);
Console.WriteLine(" Remove When Expired: " + healthEvent.HealthInformation.RemoveWhenExpired);
Console.WriteLine(" Sequence Number: " + healthEvent.HealthInformation.SequenceNumber);
Console.WriteLine(" Time to Live: " + healthEvent.HealthInformation.TimeToLive);
}
// List the replica health states.
Console.WriteLine(" Replica Health States:");
IList<ReplicaHealthState> replicaHealthStates = partitionHealth.ReplicaHealthStates;
foreach (ReplicaHealthState replicaHealthState in replicaHealthStates)
{
Console.WriteLine(" ID: " + replicaHealthState.Id);
Console.WriteLine(" Kind: " + replicaHealthState.Kind);
Console.WriteLine(" Aggregated Health State: " + replicaHealthState.AggregatedHealthState);
Console.WriteLine(" Partition ID: " + replicaHealthState.PartitionId);
}
// List the unhealthy evaluations.
Console.WriteLine(" Unhealthy Evaluations:");
IList<HealthEvaluation> healthEvaluationList = partitionHealth.UnhealthyEvaluations;
foreach (HealthEvaluation healthEvaluation in healthEvaluationList)
{
Console.WriteLine(" Kind: " + healthEvaluation.Kind);
Console.WriteLine(" Aggregated Health State: " + healthEvaluation.AggregatedHealthState);
Console.WriteLine(" Description: " + healthEvaluation.Description);
}
Console.WriteLine();
return true;
}
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
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:
CommunicationError is returned when a communication error caused the operation to fail.
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
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:
CommunicationError is returned when a communication error caused the operation to fail.
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.