managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java
/**
   * Helper function to get the status for each node and the alive/not alive status for each master
   * and tserver.
   *
   * @param universe The universe to process alive status for.
   * @param metricQueryResult The result of the query for node, master, and tserver status of the
   *                          universe.
   * @return The response object containing the status of each node in the universe.
   */
Helper function to get the status for each node and the alive/not alive status for each master
and tserver.

@param universe The universe to process alive status for.
@param metricQueryResult The result of the query for node, master, and tserver status of the
universe.
@return The response object containing the status of each node in the universe.
Helper function to get the status for each node and the alive / not alive status for each master and tserver . @param universe The universe to process alive status for . @param metricQueryResult The result of the query for node master and tserver status of the universe . @return The response object containing the status of each node in the universe .
private static ObjectNode constructUniverseAliveStatus(Universe universe,
                                                         JsonNode metricQueryResult) {
    ObjectNode response = Json.newObject();
    if (metricQueryResult.has("error")) {
      for (NodeDetails nodeDetails : universe.getNodes()) {
        nodeDetails.state = NodeDetails.NodeState.Unreachable;
        ObjectNode result = Json.newObject()
                .put("tserver_alive", false)
                .put("master_alive", false)
                .put("node_status", nodeDetails.state.toString());
        response.set(nodeDetails.nodeName, result);
      }
    } else {
      JsonNode nodeJson = metricQueryResult.get(UNIVERSE_ALIVE_METRIC);
      for (NodeDetails nodeDetails : universe.getNodes()) {
        ObjectNode result = getNodeAliveStatus(nodeDetails, nodeJson);
        response.set(nodeDetails.nodeName, result);
      }
    }
    return response;
  }
private static ObjectNode constructUniverseAliveStatus ( Universe universe , JsonNode metricQueryResult ) { ObjectNode response = Json . newObject ( ) ; if ( metricQueryResult . has ( "error" ) ) { for ( NodeDetails nodeDetails : universe . getNodes ( ) ) { nodeDetails . state = NodeDetails . NodeState . Unreachable ; ObjectNode result = Json . newObject ( ) . put ( "tserver_alive" , false ) . put ( "master_alive" , false ) . put ( "node_status" , nodeDetails . state . toString ( ) ) ; response . set ( nodeDetails . nodeName , result ) ; } } else { JsonNode nodeJson = metricQueryResult . get ( UNIVERSE_ALIVE_METRIC ) ; for ( NodeDetails nodeDetails : universe . getNodes ( ) ) { ObjectNode result = getNodeAliveStatus ( nodeDetails , nodeJson ) ; response . set ( nodeDetails . nodeName , result ) ; } } return response ; }
Helper function to get the status for each node and the alive/not alive status for each master
 and tserver.
Helper function to get the status for each node and the alive / not alive status for each master and tserver .
// If error detected, update state and exit. Otherwise, get and return per-node liveness.