use of com.thinkbiganalytics.metadata.rest.jobrepo.nifi.NiFiFeedProcessorErrorsContainer in project kylo by Teradata.
the class NifiFeedProcessorStatisticsRestControllerV2 method findFeedProcessorErrors.
@GET
@Path("/{feedName}/processor-errors")
@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 findFeedProcessorErrors(@PathParam("feedName") String feedName, @QueryParam("from") Long fromMillis, @QueryParam("to") Long toMillis, @QueryParam("after") Long timestamp) {
this.accessController.checkPermission(AccessController.SERVICES, OperationsAccessControl.ACCESS_OPS);
final DateTime endTime = getToDateTime(toMillis);
final DateTime startTime = getFromDateTime(fromMillis);
NiFiFeedProcessorErrorsContainer container = new NiFiFeedProcessorErrorsContainer(startTime, endTime);
List<? extends NifiFeedProcessorErrors> errors = null;
if (nifiStatsJmsReceiver.isPersistErrors()) {
errors = metadataAccess.read(() -> {
if (timestamp != null && timestamp != 0L) {
return statsProvider.findFeedProcessorErrorsAfter(feedName, new DateTime(timestamp));
} else {
return statsProvider.findFeedProcessorErrors(feedName, startTime, endTime);
}
});
} else {
if (timestamp != null && timestamp != 0L) {
errors = nifiStatsJmsReceiver.getErrorsForFeed(feedName, timestamp);
} else {
errors = nifiStatsJmsReceiver.getErrorsForFeed(feedName, startTime.getMillis(), endTime.getMillis());
}
}
List<com.thinkbiganalytics.metadata.rest.jobrepo.nifi.NifiFeedProcessorStatsErrors> errorsModel = NifiFeedProcessorStatsTransform.toErrorsModel(errors);
container.setErrors(errorsModel);
return Response.ok(container).build();
}
Aggregations