use of com.thinkbiganalytics.metadata.api.jobrepo.nifi.NifiFeedProcessorStats in project kylo by Teradata.
the class NifiStatsJmsReceiver method createSummaryStats.
private List<NifiFeedProcessorStats> createSummaryStats(AggregatedFeedProcessorStatisticsHolder holder, final List<AggregatedFeedProcessorStatistics> unregisteredEvents) {
List<NifiFeedProcessorStats> nifiFeedProcessorStatsList = new ArrayList<>();
holder.getFeedStatistics().values().stream().forEach(feedProcessorStats -> {
Long collectionIntervalMillis = feedProcessorStats.getCollectionIntervalMillis();
String feedProcessorId = feedProcessorStats.getStartingProcessorId();
String feedName = getFeedName(feedProcessorStats);
if (StringUtils.isNotBlank(feedName)) {
String feedProcessGroupId = provenanceEventFeedUtil.getFeedProcessGroupId(feedProcessorId);
feedProcessorStats.getProcessorStats().values().forEach(processorStats -> {
processorStats.getStats().values().stream().forEach(stats -> {
NifiFeedProcessorStats nifiFeedProcessorStats = toSummaryStats(stats);
nifiFeedProcessorStats.setFeedName(feedName);
nifiFeedProcessorStats.setProcessorId(processorStats.getProcessorId());
nifiFeedProcessorStats.setCollectionIntervalSeconds((collectionIntervalMillis / 1000));
if (holder instanceof AggregatedFeedProcessorStatisticsHolderV2) {
nifiFeedProcessorStats.setCollectionId(((AggregatedFeedProcessorStatisticsHolderV2) holder).getCollectionId());
}
String processorName = provenanceEventFeedUtil.getProcessorName(processorStats.getProcessorId());
if (processorName == null) {
processorName = processorStats.getProcessorName();
}
nifiFeedProcessorStats.setProcessorName(processorName);
nifiFeedProcessorStats.setFeedProcessGroupId(feedProcessGroupId);
nifiFeedProcessorStatsList.add(nifiFeedProcessorStats);
});
});
} else {
unregisteredEvents.add(feedProcessorStats);
}
});
return nifiFeedProcessorStatsList;
}
use of com.thinkbiganalytics.metadata.api.jobrepo.nifi.NifiFeedProcessorStats in project kylo by Teradata.
the class NifiFeedProcessorStatisticsRestControllerV2 method findStats.
@GET
@Path("/{feedName}/processor-duration")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Returns the list of stats for each processor within the given timeframe relative to now")
@ApiResponses(@ApiResponse(code = 200, message = "Returns the list of stats for each processor within the given timeframe relative to now", response = com.thinkbiganalytics.metadata.rest.jobrepo.nifi.NifiFeedProcessorStats.class, responseContainer = "List"))
public Response findStats(@PathParam("feedName") String feedName, @QueryParam("from") Long fromMillis, @QueryParam("to") Long toMillis) {
this.accessController.checkPermission(AccessController.SERVICES, OperationsAccessControl.ACCESS_OPS);
final DateTime endTime = getToDateTime(toMillis);
final DateTime startTime = getFromDateTime(fromMillis);
return metadataAccess.read(() -> {
NiFiFeedProcessorStatsContainer statsContainer = new NiFiFeedProcessorStatsContainer(startTime, endTime);
List<? extends NifiFeedProcessorStats> list = statsProvider.findFeedProcessorStatisticsByProcessorName(feedName, statsContainer.getStartTime(), statsContainer.getEndTime());
List<? extends NifiFeedProcessorErrors> errors = statsProvider.findFeedProcessorErrors(feedName, statsContainer.getStartTime(), statsContainer.getEndTime());
List<com.thinkbiganalytics.metadata.rest.jobrepo.nifi.NifiFeedProcessorStats> model = NifiFeedProcessorStatsTransform.toModel(list);
statsContainer.setStats(model);
return Response.ok(statsContainer).build();
});
}
Aggregations