Examples of ClusterStatusMonitor


Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

            // }
          }
        }
      }
      // Update cluster status monitor mbean
      ClusterStatusMonitor clusterStatusMonitor =
          (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
      IdealState idealState = cache._idealStateMap.get(view.getResourceName());
      if (idealState != null) {
        if (clusterStatusMonitor != null
            && !idealState.getStateModelDefRef().equalsIgnoreCase(
                DefaultSchedulerMessageHandlerFactory.SCHEDULER_TASK_QUEUE)) {
          clusterStatusMonitor.onExternalViewChange(view,
              cache._idealStateMap.get(view.getResourceName()));
        }
      }

      // compare the new external view with current one, set only on different
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

    HelixDataAccessor dataAccessor = manager.getHelixDataAccessor();
    _cache.refresh(dataAccessor);

    // Update the cluster status gauges
    ClusterStatusMonitor clusterStatusMonitor =
        (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
    if (clusterStatusMonitor != null) {
      Set<String> instanceSet = Sets.newHashSet();
      Set<String> liveInstanceSet = Sets.newHashSet();
      Set<String> disabledInstanceSet = Sets.newHashSet();
      Map<String, Set<String>> disabledPartitions = Maps.newHashMap();
      Map<String, Set<String>> tags = Maps.newHashMap();
      Map<String, LiveInstance> liveInstanceMap = _cache.getLiveInstances();
      for (Map.Entry<String, InstanceConfig> e : _cache.getInstanceConfigMap().entrySet()) {
        String instanceName = e.getKey();
        InstanceConfig config = e.getValue();
        instanceSet.add(instanceName);
        if (liveInstanceMap.containsKey(instanceName)) {
          liveInstanceSet.add(instanceName);
        }
        if (!config.getInstanceEnabled()) {
          disabledInstanceSet.add(instanceName);
        }
        List<String> disabledPartitionsList = config.getDisabledPartitions();
        Set<String> partitionNames =
            disabledPartitionsList != null ? new HashSet<String>(config.getDisabledPartitions())
                : new HashSet<String>();
        disabledPartitions.put(instanceName, partitionNames);
        Set<String> instanceTags = Sets.newHashSet(config.getTags());
        tags.put(instanceName, instanceTags);
      }
      clusterStatusMonitor.setClusterInstanceStatus(liveInstanceSet, instanceSet,
          disabledInstanceSet, disabledPartitions, tags);
    }

    event.addAttribute("ClusterDataCache", _cache);
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

    BestPossibleStateOutput bestPossibleStateOutput =
        compute(cluster, event, resourceMap, currentStateOutput);
    event.addAttribute(AttributeName.BEST_POSSIBLE_STATE.toString(), bestPossibleStateOutput);

    try {
      ClusterStatusMonitor clusterStatusMonitor =
          (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
      if (clusterStatusMonitor != null) {
        clusterStatusMonitor.setPerInstanceResourceStatus(bestPossibleStateOutput,
            cache.getInstanceConfigMap(), resourceMap, cache.getStateModelDefMap());
      }
    } catch (Exception e) {
      LOG.error("Could not update cluster status metrics!", e);
    }
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

    ClusterAccessor clusterAccessor = new ClusterAccessor(clusterId, accessor, _cache);

    Cluster cluster = clusterAccessor.readCluster();

    // Update the cluster status gauges
    ClusterStatusMonitor clusterStatusMonitor =
        (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
    if (clusterStatusMonitor != null) {
      Set<String> instanceSet = Sets.newHashSet();
      Set<String> liveInstanceSet = Sets.newHashSet();
      Set<String> disabledInstanceSet = Sets.newHashSet();
      Map<String, Set<String>> disabledPartitions = Maps.newHashMap();
      Map<String, Set<String>> tags = Maps.newHashMap();
      for (Participant participant : cluster.getParticipantMap().values()) {
        instanceSet.add(participant.getId().toString());
        if (participant.isAlive()) {
          liveInstanceSet.add(participant.getId().toString());
        }
        if (!participant.isEnabled()) {
          disabledInstanceSet.add(participant.getId().toString());
        }
        Set<String> partitionNames = Sets.newHashSet();
        for (PartitionId partitionId : participant.getDisabledPartitionIds()) {
          partitionNames.add(partitionId.toString());
        }
        disabledPartitions.put(participant.getId().toString(), partitionNames);
        tags.put(participant.getId().toString(), participant.getTags());
      }
      clusterStatusMonitor.setClusterInstanceStatus(liveInstanceSet, instanceSet,
          disabledInstanceSet, disabledPartitions, tags);
    }

    event.addAttribute("Cluster", cluster);
    event.addAttribute("ClusterDataCache", _cache);
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

          }
        }
      }

      // Update cluster status monitor mbean
      ClusterStatusMonitor clusterStatusMonitor =
          (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
      IdealState idealState = cache._idealStateMap.get(view.getResourceName());
      if (idealState != null) {
        if (clusterStatusMonitor != null
            && !idealState.getStateModelDefRef().equalsIgnoreCase(
                DefaultSchedulerMessageHandlerFactory.SCHEDULER_TASK_QUEUE)) {
          StateModelDefinition stateModelDef =
              cache.getStateModelDef(idealState.getStateModelDefRef());
          clusterStatusMonitor.setResourceStatus(view,
              cache._idealStateMap.get(view.getResourceName()), stateModelDef);
        }
      } else {
        // Drop the metrics for the dropped resource
        clusterStatusMonitor.unregisterResource(view.getResourceName());
      }

      // compare the new external view with current one, set only on different
      ExternalView curExtView = curExtViews.get(resourceId.stringify());
      if (curExtView == null || !curExtView.getRecord().equals(view.getRecord())) {
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

    ClusterId clusterId = ClusterId.from(manager.getClusterName());
    ClusterAccessor clusterAccessor = new ClusterAccessor(clusterId, accessor);

    Cluster cluster = clusterAccessor.readCluster();

    ClusterStatusMonitor clusterStatusMonitor =
        (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
    if (clusterStatusMonitor != null) {
      // TODO fix it
      // int disabledInstances = 0;
      // int disabledPartitions = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.