@VisibleForTesting
    Map<String, String> getPendingWorkflowToOwnerAppMap(List<WorkflowDef> workflowDefs) {
        final Map<String, List<WorkflowDef>> groupedWorkflowDefs =
                workflowDefs.stream().collect(Collectors.groupingBy(WorkflowDef::getName));

        Map<String, String> workflowNameToOwnerMap = new HashMap<>();
        groupedWorkflowDefs.forEach(
                (key, value) -> {
                    final WorkflowDef workflowDef =
                            value.stream()
                                    .max(Comparator.comparing(WorkflowDef::getVersion))
                                    .orElseThrow(NoSuchElementException::new);

                    workflowNameToOwnerMap.put(key, workflowDef.getOwnerApp());
                });
        return workflowNameToOwnerMap;
    }
Pending workflow data does not contain information about version. We only need the owner app
and workflow name, and we only need to query for the workflow once.
core/src/main/java/com/netflix/conductor/metrics/WorkflowMonitor.java