示例#1
0
  public static void printBoltStat(String topologyId) {
    try {
      Client client = ThriftClient.getClient();
      TopologyInfo topologyInfo = client.getTopologyInfo(topologyId);

      Iterator<ExecutorSummary> executorSummaryIterator = topologyInfo.get_executors_iterator();
      while (executorSummaryIterator.hasNext()) {
        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()) {
            printLine();
            BoltStats boltStats = executorSpecificStats.get_bolt();
            System.out.println("component id of bolt : " + componentId);
            System.out.println(
                "transferred : " + getAllTimeStat(executorStats.get_transferred(), ALL_TIME));
            System.out.println(
                "total tuples emitted : " + getAllTimeStat(executorStats.get_emitted(), ALL_TIME));
            System.out.println("acked : " + getBoltStats(boltStats.get_acked(), ALL_TIME));
            System.out.println("failed : " + getBoltStats(boltStats.get_failed(), ALL_TIME));
            System.out.println("executed : " + getBoltStats(boltStats.get_executed(), ALL_TIME));
            printLine();
          }
        }
      }
    } catch (Exception ex) {
      throw new RuntimeException("Error occurred while fetching the spout information!");
    }
  }
示例#2
0
 public static void main(String[] args) throws IOException {
   BoltStat.printBoltStat("storm_topology-1-1436326975");
   ThriftClient.close();
 }