use of org.apache.storm.stats.BoltExecutorStats in project storm by apache.
the class BoltOutputCollectorImpl method ack.
@Override
public void ack(Tuple input) {
long ackValue = ((TupleImpl) input).getAckVal();
Map<Long, Long> anchorsToIds = input.getMessageId().getAnchorsToIds();
for (Map.Entry<Long, Long> entry : anchorsToIds.entrySet()) {
executor.sendUnanchored(taskData, Acker.ACKER_ACK_STREAM_ID, new Values(entry.getKey(), Utils.bitXor(entry.getValue(), ackValue)), executor.getExecutorTransfer());
}
long delta = tupleTimeDelta((TupleImpl) input);
if (isDebug) {
LOG.info("BOLT ack TASK: {} TIME: {} TUPLE: {}", taskId, delta, input);
}
BoltAckInfo boltAckInfo = new BoltAckInfo(input, taskId, delta);
boltAckInfo.applyOn(taskData.getUserContext());
if (delta != 0) {
((BoltExecutorStats) executor.getStats()).boltAckedTuple(input.getSourceComponent(), input.getSourceStreamId(), delta);
}
}
use of org.apache.storm.stats.BoltExecutorStats in project storm by apache.
the class BoltOutputCollectorImpl method fail.
@Override
public void fail(Tuple input) {
Set<Long> roots = input.getMessageId().getAnchors();
for (Long root : roots) {
executor.sendUnanchored(taskData, Acker.ACKER_FAIL_STREAM_ID, new Values(root), executor.getExecutorTransfer());
}
long delta = tupleTimeDelta((TupleImpl) input);
if (isDebug) {
LOG.info("BOLT fail TASK: {} TIME: {} TUPLE: {}", taskId, delta, input);
}
BoltFailInfo boltFailInfo = new BoltFailInfo(input, taskId, delta);
boltFailInfo.applyOn(taskData.getUserContext());
if (delta != 0) {
((BoltExecutorStats) executor.getStats()).boltFailedTuple(input.getSourceComponent(), input.getSourceStreamId(), delta);
}
}
use of org.apache.storm.stats.BoltExecutorStats in project storm by apache.
the class Executor method mkExecutor.
public static Executor mkExecutor(WorkerState workerState, List<Long> executorId, Map<String, String> credentials) {
Executor executor;
WorkerTopologyContext workerTopologyContext = workerState.getWorkerTopologyContext();
List<Integer> taskIds = StormCommon.executorIdToTasks(executorId);
String componentId = workerTopologyContext.getComponentId(taskIds.get(0));
String type = getExecutorType(workerTopologyContext, componentId);
if (StatsUtil.SPOUT.equals(type)) {
executor = new SpoutExecutor(workerState, executorId, credentials);
executor.stats = new SpoutExecutorStats(ConfigUtils.samplingRate(executor.getStormConf()));
} else {
executor = new BoltExecutor(workerState, executorId, credentials);
executor.stats = new BoltExecutorStats(ConfigUtils.samplingRate(executor.getStormConf()));
}
Map<Integer, Task> idToTask = new HashMap<>();
for (Integer taskId : taskIds) {
try {
Task task = new Task(executor, taskId);
executor.sendUnanchored(task, StormCommon.SYSTEM_STREAM_ID, new Values("startup"), executor.getExecutorTransfer());
idToTask.put(taskId, task);
} catch (IOException ex) {
throw Utils.wrapInRuntime(ex);
}
}
executor.idToTask = idToTask;
return executor;
}
Aggregations