/** * getStreamBox. * @param visualization visualization * @return getStreamBox */ public static Map<String, Object> getStreamBox(Object visualization) { Map<String, Object> visualizationData = (Map<String, Object>) visualization; Map<String, Object> result = new HashMap(); Map<String, Object> temp = (Map<String, Object>) visualizationData.get("inputs"); result.put("stream", temp.get("stream")); result.put("sani-stream", temp.get("sani-stream")); result.put("checked", !Utils.isSystemId((String) temp.get("stream"))); return result; }
/** * filter system streams from stats. * * @param stream2stat { stream id -> value } * @param includeSys whether to filter system streams * @return filtered stats */ private static <K, V> Map<K, V> filterSysStreams2Stat(Map<K, V> stream2stat, boolean includeSys) { LOG.trace("Filter Sys Streams2Stat {}", stream2stat); if (!includeSys) { for (Iterator itr = stream2stat.keySet().iterator(); itr.hasNext(); ) { Object key = itr.next(); if (key instanceof String && Utils.isSystemId((String) key)) { itr.remove(); } } } return stream2stat; }
/** * Get the coponenet type for a give id. * @param topology the topology this is a part of. * @param compId the id of the component. * @return the type as a String "BOLT" or "SPOUT". */ public static String componentType(StormTopology topology, String compId) { if (compId == null) { return null; } Map<String, Bolt> bolts = topology.get_bolts(); if (Utils.isSystemId(compId) || bolts.containsKey(compId)) { return ClientStatsUtil.BOLT; } return ClientStatsUtil.SPOUT; }
/** * filter system streams from stats. * * @param stats { win -> stream id -> value } * @param includeSys whether to filter system streams * @return filtered stats */ private static <K, V> Map<String, Map<K, V>> filterSysStreams(Map<String, Map<K, V>> stats, boolean includeSys) { LOG.trace("Filter Sys Streams {}", stats); if (!includeSys) { for (Iterator<String> itr = stats.keySet().iterator(); itr.hasNext(); ) { String winOrStream = itr.next(); Map<K, V> stream2stat = stats.get(winOrStream); for (Iterator subItr = stream2stat.keySet().iterator(); subItr.hasNext(); ) { Object key = subItr.next(); if (key instanceof String && Utils.isSystemId((String) key)) { subItr.remove(); } } } } return stats; }
Integer port = (Integer) value.get(1); String comp = task2component.get(start); if ((compId == null || compId.equals(comp)) && (includeSys || !Utils.isSystemId(comp))) { hostPorts.add(Lists.newArrayList(host, port));
private static Set<String> validateIds(Map<String, ? extends Object> componentMap) throws InvalidTopologyException { Set<String> keys = componentMap.keySet(); for (String id : keys) { if (Utils.isSystemId(id)) { throw new WrappedInvalidTopologyException(id + " is not a valid component id."); } } for (Object componentObj : componentMap.values()) { ComponentCommon common = getComponentCommon(componentObj); Set<String> streamIds = common.get_streams().keySet(); for (String id : streamIds) { if (Utils.isSystemId(id)) { throw new WrappedInvalidTopologyException(id + " is not a valid stream id."); } } } return keys; }
if ((compId == null || compId.equals(id)) && (includeSys || !Utils.isSystemId(id))) { m.put("exec-id", entry.getKey()); m.put("comp-id", id);
/** * getBoltExecutors. * @param executorSummaries executorSummaries * @param stormTopology stormTopology * @param sys sys * @return getBoltExecutors. */ public static Map<String, List<ExecutorSummary>> getBoltExecutors(List<ExecutorSummary> executorSummaries, StormTopology stormTopology, boolean sys) { Map<String, List<ExecutorSummary>> result = new HashMap(); for (ExecutorSummary executorSummary : executorSummaries) { if (StatsUtil.componentType(stormTopology, executorSummary.get_component_id()).equals("bolt") && (sys || !Utils.isSystemId(executorSummary.get_component_id()))) { List<ExecutorSummary> executorSummaryList = result.getOrDefault(executorSummary.get_component_id(), new ArrayList()); executorSummaryList.add(executorSummary); result.put(executorSummary.get_component_id(), executorSummaryList); } } return result; }
if (boltSummaries.containsKey(boltComponentId) && (sys || !Utils.isSystemId(boltComponentId))) { Map<String, Object> boltMap = new HashMap(); boltMap.put(":type", "bolt");
for (Map.Entry<String, SpoutSpec> entry : spouts.entrySet()) { String compId = entry.getKey(); if (!Utils.isSystemId(compId)) { Component comp = new Component(ComponentType.SPOUT, compId, componentToExecs(compId)); ret.put(compId, comp); for (Map.Entry<String, Bolt> entry : bolts.entrySet()) { String compId = entry.getKey(); if (!Utils.isSystemId(compId)) { Component comp = new Component(ComponentType.BOLT, compId, componentToExecs(compId)); ret.put(compId, comp);
boolean enableMessageTimeout = (Boolean) topoConf.get(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS); boolean isAcker = Acker.ACKER_COMPONENT_ID.equals(componentId); if ((!isAcker && Utils.isSystemId(componentId)) || (!enableMessageTimeout && isSpout) || (!enableMessageTimeout && isAcker)) {
if (!Utils.isSystemId(key)) { Long count = txMap.get(key); totalTransferred += count;
if (!includeSys && Utils.isSystemId(component)) { continue;
for (Map.Entry<String, SpoutSpec> spoutEntry : storm_topo .get_spouts().entrySet()) { if (!Utils.isSystemId(spoutEntry.getKey())) { Component newComp; if (all_comp.containsKey(spoutEntry.getKey())) { for (Map.Entry<String, Bolt> boltEntry : storm_topo.get_bolts() .entrySet()) { if (!Utils.isSystemId(boltEntry.getKey())) { Component newComp; if (all_comp.containsKey(boltEntry.getKey())) {