Share via


FabricClient.HealthClient.GetDeployedApplicationHealthAsync Method

Definition

Overloads

GetDeployedApplicationHealthAsync(DeployedApplicationHealthQueryDescription)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

GetDeployedApplicationHealthAsync(Uri, String)

Asynchronously gets the health of a deployed Service Fabric application on the specified node.

GetDeployedApplicationHealthAsync(DeployedApplicationHealthQueryDescription, TimeSpan, CancellationToken)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

GetDeployedApplicationHealthAsync(Uri, String, ApplicationHealthPolicy)

Asynchronously gets the health of a deployed Service Fabric application on the specified node.

GetDeployedApplicationHealthAsync(Uri, String, TimeSpan, CancellationToken)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

GetDeployedApplicationHealthAsync(Uri, String, ApplicationHealthPolicy, TimeSpan, CancellationToken)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

GetDeployedApplicationHealthAsync(DeployedApplicationHealthQueryDescription)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth> GetDeployedApplicationHealthAsync (System.Fabric.Description.DeployedApplicationHealthQueryDescription queryDescription);
member this.GetDeployedApplicationHealthAsync : System.Fabric.Description.DeployedApplicationHealthQueryDescription -> System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth>
Public Function GetDeployedApplicationHealthAsync (queryDescription As DeployedApplicationHealthQueryDescription) As Task(Of DeployedApplicationHealth)

Parameters

queryDescription
DeployedApplicationHealthQueryDescription

The query description.

Returns

The task representing the asynchronous operation.

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

GetDeployedApplicationHealthAsync(Uri, String)

Asynchronously gets the health of a deployed Service Fabric application on the specified node.

public System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth> GetDeployedApplicationHealthAsync (Uri applicationName, string nodeName);
member this.GetDeployedApplicationHealthAsync : Uri * string -> System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth>
Public Function GetDeployedApplicationHealthAsync (applicationName As Uri, nodeName As String) As Task(Of DeployedApplicationHealth)

Parameters

applicationName
Uri

The URI of the Service Fabric application.

nodeName
String

The node name where the Service Fabric application is deployed.

Returns

The health of a deployed Service Fabric application.

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:

FabricHealthEntityNotFound.

InvalidNameUri is returned when applicationName is not a valid Service Fabric Name.

CommunicationError is returned when a communication error caused the operation to fail.

InvalidCredentialType.

InvalidX509FindType.

InvalidX509StoreLocation.

InvalidX509StoreName.

InvalidX509Thumbprint.

InvalidProtectionLevel.

InvalidX509Store.

InvalidSubjectName.

InvalidAllowedCommonNameList.

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 deployed application.

public static bool GetDeployedApplicationsHealth(string clusterConnection)
            {
                //DeployedApplicationHealth deployedApplicationHealth;
                //ApplicationHealth applicationHealth;
                Uri applicationName = new Uri("fabric:/myapp/todo");

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

                Console.WriteLine("Deployed Application Health:");

                try
                {
                    // Determine the nodes where the application has been deployed.
                    ApplicationHealth applicationHealth = fabricClient.HealthManager.GetApplicationHealthAsync(applicationName).Result;

                    // Get the deployed application health for each node.
                    IList<DeployedApplicationHealthState> deployedAppHealthStateList = applicationHealth.DeployedApplicationHealthStates;
                    foreach (DeployedApplicationHealthState deployedAppHealthState in deployedAppHealthStateList)
                    {
            DeployedApplicationHealth deployedApplicationHealth = fabricClient.HealthManager.GetDeployedApplicationHealthAsync(applicationName, 
                deployedAppHealthState.NodeName).Result;

            // Display the deployed application health information for each node.

            Console.WriteLine("  Application {0}: {1}", deployedApplicationHealth.ApplicationName, deployedApplicationHealth.AggregatedHealthState);
            Console.WriteLine("    Node Name: " + deployedApplicationHealth.NodeName);

            // List the deployed application health states.
            Console.WriteLine("    Deployed applications:");
            IList<DeployedServicePackageHealthState> deployedSPHealthStateList = deployedApplicationHealth.DeployedServicePackageHealthStates;
            foreach (DeployedServicePackageHealthState deployedSPHealthState in deployedSPHealthStateList)
            {
                Console.WriteLine("      Application: " + deployedSPHealthState.ApplicationName);
                Console.WriteLine("        Aggregated Health State: " + deployedSPHealthState.AggregatedHealthState);
                Console.WriteLine("        Node Name: " + deployedSPHealthState.NodeName);
                Console.WriteLine("        Service Manifest Name: " + deployedSPHealthState.ServiceManifestName);
            }

            // List the health events.
            Console.WriteLine("    Health Events:");
            IList<HealthEvent> healthEvents = deployedApplicationHealth.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 unhealthy evaluations.
            Console.WriteLine("    Unhealthy Evaluations:");
            IList<HealthEvaluation> healthEvaluationList = deployedApplicationHealth.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();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error: " + e.Message);

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

                    return false;
                }

                return true;
            }

Applies to

GetDeployedApplicationHealthAsync(DeployedApplicationHealthQueryDescription, TimeSpan, CancellationToken)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

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

Parameters

queryDescription
DeployedApplicationHealthQueryDescription

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 task representing the asynchronous operation.

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

GetDeployedApplicationHealthAsync(Uri, String, ApplicationHealthPolicy)

Asynchronously gets the health of a deployed Service Fabric application on the specified node.

public System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth> GetDeployedApplicationHealthAsync (Uri applicationName, string nodeName, System.Fabric.Health.ApplicationHealthPolicy healthPolicy);
member this.GetDeployedApplicationHealthAsync : Uri * string * System.Fabric.Health.ApplicationHealthPolicy -> System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth>
Public Function GetDeployedApplicationHealthAsync (applicationName As Uri, nodeName As String, healthPolicy As ApplicationHealthPolicy) As Task(Of DeployedApplicationHealth)

Parameters

applicationName
Uri

The URI of the Service Fabric application.

nodeName
String

The node name where the Service Fabric application is deployed.

healthPolicy
ApplicationHealthPolicy

The application health policy used to evaluate entity health.

Returns

The health of a deployed Service Fabric application.

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:

FabricHealthEntityNotFound.

InvalidNameUri is returned when applicationName is not a valid Service Fabric Name.

CommunicationError is returned when a communication error caused the operation to fail.

InvalidCredentialType.

InvalidX509FindType.

InvalidX509StoreLocation.

InvalidX509StoreName.

InvalidX509Thumbprint.

InvalidProtectionLevel.

InvalidX509Store.

InvalidSubjectName.

InvalidAllowedCommonNameList.

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

GetDeployedApplicationHealthAsync(Uri, String, TimeSpan, CancellationToken)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth> GetDeployedApplicationHealthAsync (Uri applicationName, string nodeName, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetDeployedApplicationHealthAsync : Uri * string * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth>
Public Function GetDeployedApplicationHealthAsync (applicationName As Uri, nodeName As String, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of DeployedApplicationHealth)

Parameters

applicationName
Uri

The URI of the Service Fabric application.

nodeName
String

The node name where the Service Fabric application is deployed.

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 task representing the asynchronous operation.

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:

FabricHealthEntityNotFound.

InvalidNameUri is returned when applicationName is not a valid Service Fabric Name.

CommunicationError is returned when a communication error caused the operation to fail.

InvalidCredentialType.

InvalidX509FindType.

InvalidX509StoreLocation.

InvalidX509StoreName.

InvalidX509Thumbprint.

InvalidProtectionLevel.

InvalidX509Store.

InvalidSubjectName.

InvalidAllowedCommonNameList.

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

GetDeployedApplicationHealthAsync(Uri, String, ApplicationHealthPolicy, TimeSpan, CancellationToken)

Asynchronously gets the health of a deployed Service Fabric application on the specified node by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth> GetDeployedApplicationHealthAsync (Uri applicationName, string nodeName, System.Fabric.Health.ApplicationHealthPolicy healthPolicy, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetDeployedApplicationHealthAsync : Uri * string * System.Fabric.Health.ApplicationHealthPolicy * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.DeployedApplicationHealth>
Public Function GetDeployedApplicationHealthAsync (applicationName As Uri, nodeName As String, healthPolicy As ApplicationHealthPolicy, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of DeployedApplicationHealth)

Parameters

applicationName
Uri

The URI of the Service Fabric application.

nodeName
String

The node name where the Service Fabric application is deployed.

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 task representing the asynchronous operation.

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:

FabricHealthEntityNotFound.

InvalidNameUri is returned when applicationName is not a valid Service Fabric Name.

CommunicationError is returned when a communication error caused the operation to fail.

InvalidCredentialType.

InvalidX509FindType.

InvalidX509StoreLocation.

InvalidX509StoreName.

InvalidX509Thumbprint.

InvalidProtectionLevel.

InvalidX509Store.

InvalidSubjectName.

InvalidAllowedCommonNameList.

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