我正在设置一个Apache Spark
群集来执行实时流式传输计算,并希望通过跟踪批量大小,批处理时间等各种指标来监控部署的性能。我的{{1}程序是用Spark Streaming
问题
提前致谢,
答案 0 :(得分:3)
如果你没有运气1.这将有助于2。:
ssc.addStreamingListener(new JobListener());
// ...
class JobListener implements StreamingListener {
@Override
public void onBatchCompleted(StreamingListenerBatchCompleted batchCompleted) {
System.out.println("Batch completed, Total delay :" + batchCompleted.batchInfo().totalDelay().get().toString() + " ms");
}
/*
snipped other methods
*/
}
取自In Spark Streaming, is there a way to detect when a batch has finished?
batchCompleted.batchInfo()
contains:
numRecords
batchTime
,processsingStartTime
,processingEndTime
schedulingDelay
outputOperationInfos
希望你能从这些房产中得到你需要的东西。