Exemplo n.º 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!");
    }
  }
Exemplo n.º 2
0
 @Override
 protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot)
     throws org.apache.thrift.TException {
   switch (setField_) {
     case BOLT:
       BoltStats bolt = (BoltStats) value_;
       bolt.write(oprot);
       return;
     case SPOUT:
       SpoutStats spout = (SpoutStats) value_;
       spout.write(oprot);
       return;
     default:
       throw new IllegalStateException("Cannot write union with unknown field " + setField_);
   }
 }
Exemplo n.º 3
0
 @Override
 protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID)
     throws org.apache.thrift.TException {
   _Fields setField = _Fields.findByThriftId(fieldID);
   if (setField != null) {
     switch (setField) {
       case BOLT:
         BoltStats bolt;
         bolt = new BoltStats();
         bolt.read(iprot);
         return bolt;
       case SPOUT:
         SpoutStats spout;
         spout = new SpoutStats();
         spout.read(iprot);
         return spout;
       default:
         throw new IllegalStateException(
             "setField wasn't null, but didn't match any of the case statements!");
     }
   } else {
     throw new TProtocolException("Couldn't find a field with field id " + fieldID);
   }
 }
Exemplo n.º 4
0
 @Override
 protected Object standardSchemeReadValue(
     org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field)
     throws org.apache.thrift.TException {
   _Fields setField = _Fields.findByThriftId(field.id);
   if (setField != null) {
     switch (setField) {
       case BOLT:
         if (field.type == BOLT_FIELD_DESC.type) {
           BoltStats bolt;
           bolt = new BoltStats();
           bolt.read(iprot);
           return bolt;
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
           return null;
         }
       case SPOUT:
         if (field.type == SPOUT_FIELD_DESC.type) {
           SpoutStats spout;
           spout = new SpoutStats();
           spout.read(iprot);
           return spout;
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
           return null;
         }
       default:
         throw new IllegalStateException(
             "setField wasn't null, but didn't match any of the case statements!");
     }
   } else {
     org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
     return null;
   }
 }