Mastering Apache Storm by Ankit Jain

Mastering Apache Storm by Ankit Jain

Author:Ankit Jain [Jain, Ankit]
Language: eng
Format: azw3
Tags: COM062000 - COMPUTERS / Data Modeling and Design, COM018000 - COMPUTERS / Data Processing, COM021030 - COMPUTERS / Databases / Data Mining
Publisher: Packt Publishing
Published: 2017-08-16T04:00:00+00:00


Create a class BoltStatistics in the com.stormadvance package to get the statistics of the bolts. The class BoltStatistics contains a method printBoltStatistics(String topologyId) to print the information of all the bolts served by a given topology:

public class BoltStatistics { private static final String DEFAULT = "default"; private static final String ALL_TIME = ":all-time"; public void printBoltStatistics(String topologyId) { try { ThriftClient thriftClient = new ThriftClient(); // Get the Nimbus thrift server client Client client = thriftClient.getClient(); // Get the information of given topology TopologyInfo topologyInfo = client.getTopologyInfo(topologyId); Iterator<ExecutorSummary> executorSummaryIterator = topologyInfo.get_executors_iterator(); while (executorSummaryIterator.hasNext()) { // get the executor ExecutorSummary executorSummary = executorSummaryIterator.next(); ExecutorStats executorStats = executorSummary.get_stats(); if (executorStats != null) { ExecutorSpecificStats executorSpecificStats = executorStats.get_specific(); String componentId = executorSummary.get_component_id(); if (executorSpecificStats.is_set_bolt()) { BoltStats boltStats = executorSpecificStats.get_bolt();



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.