总任务持续时间(ms)是通过以下代码计算的:
long durationMs = context.getTransferDuration(TimeUnit.MILLISECONDS);
在NiFi中,该值存储在状态管理器的以下位置:
/nifi-api/controller-services/{service-id}/state/local/transfer.total.duration.millis
您可以使用以下Java代码获取此值:
StateManager stateManager = context.getStateManager();
Map<String, String> state = stateManager.getState(Scope.LOCAL).toMap();
long totalDurationMs = Long.parseLong(state.get("transfer.total.duration.millis"));