use of com.thinkbiganalytics.nifi.provenance.model.stats.AggregatedFeedProcessorStatisticsV2 in project kylo by Teradata.
the class GroupedStatsUtil method groupStatsByProcessor.
/**
* Group stats together by processor for a given feed
*
* @param feedName feed name
* @param groupedStats Map of processorIdentity to list of stats for that processor
*/
public static AggregatedFeedProcessorStatistics groupStatsByProcessor(String feedName, Map<GroupedStatsIdentity, List<GroupedStats>> groupedStats) {
Long sendJmsTimeMillis = 3000L;
String collectionId = UUID.randomUUID().toString();
// Create a random id for the starting processor.
// the starting feed processor id is not needed as we already know the feed name associated with these stats
String startingProcessorId = UUID.randomUUID().toString();
AggregatedFeedProcessorStatisticsV2 feedProcessorStatistics = new AggregatedFeedProcessorStatisticsV2(startingProcessorId, collectionId, sendJmsTimeMillis);
feedProcessorStatistics.setFeedName(feedName);
for (Map.Entry<GroupedStatsIdentity, List<GroupedStats>> stats : groupedStats.entrySet()) {
String processorName = stats.getKey().getProcessorName();
String processorId = stats.getKey().getProcessorId();
Map<String, AggregatedProcessorStatistics> processorStatsMap = feedProcessorStatistics.getProcessorStats();
if (!processorStatsMap.containsKey(processorName)) {
processorStatsMap.put(processorName, new AggregatedProcessorStatisticsV2(processorId, processorName, collectionId));
}
AggregatedProcessorStatistics processorStatistics = processorStatsMap.get(processorName);
for (GroupedStats s : stats.getValue()) {
GroupedStatsUtil.addStats1(processorStatistics.getStats(GroupedStats.DEFAULT_SOURCE_CONNECTION_ID), s);
}
/*
AggregatedProcessorStatistics
processorStatistics =
feedProcessorStatistics.getProcessorStats()
.computeIfAbsent(processorName, k -> new AggregatedProcessorStatisticsV2(processorId, k, collectionId));
stats.getValue().stream().forEach( s -> GroupedStatsUtil.add(processorStatistics.getStats(GroupedStats.DEFAULT_SOURCE_CONNECTION_ID), s));
*/
}
return feedProcessorStatistics;
}
Aggregations