use of com.thinkbiganalytics.jobrepo.query.model.FeedHealth in project kylo by Teradata.
the class FeedHealthUtil method parseToList.
public static List<FeedHealth> parseToList(List<ExecutedFeed> latestOpFeeds, Map<String, Long> avgRunTimes) {
List<FeedHealth> list = new ArrayList<FeedHealth>();
Map<String, FeedHealth> map = new HashMap<String, FeedHealth>();
if (latestOpFeeds != null) {
for (ExecutedFeed feed : latestOpFeeds) {
String feedName = feed.getName();
FeedHealth feedHealth = map.get(feedName);
if (feedHealth == null) {
feedHealth = new DefaultFeedHealth();
feedHealth.setFeed(feedName);
if (avgRunTimes != null) {
feedHealth.setAvgRuntime(avgRunTimes.get(feedName));
}
list.add(feedHealth);
map.put(feedName, feedHealth);
}
feedHealth.setLastOpFeed(feed);
}
}
return list;
}
use of com.thinkbiganalytics.jobrepo.query.model.FeedHealth in project kylo by Teradata.
the class FeedModelTransform method feedHealth.
/**
* Transform the FeedHealth domain object to the REST friendly FeedHealth object
*
* @return the transformed FeedHealth object
*/
public static FeedHealth feedHealth(FeedSummary domain) {
FeedHealth feedHealth = new DefaultFeedHealth();
feedHealth.setUnhealthyCount(domain.getFailedCount());
feedHealth.setHealthyCount(domain.getCompletedCount());
feedHealth.setFeed(domain.getFeedName());
feedHealth.setFeedId(domain.getFeedId() != null ? domain.getFeedId().toString() : null);
feedHealth.setLastOpFeed(executedFeed(domain));
feedHealth.setStream(domain.isStream());
feedHealth.setRunningCount(domain.getRunningCount());
return feedHealth;
}
use of com.thinkbiganalytics.jobrepo.query.model.FeedHealth in project kylo by Teradata.
the class FeedsRestController method getFeedHealthForFeed.
@GET
@Path("/health/{feedName}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Gets the detailed health status of the specified feed.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the health.", response = FeedStatus.class), @ApiResponse(code = 404, message = "The feed does not exist.", response = RestResponseStatus.class) })
public FeedStatus getFeedHealthForFeed(@Context HttpServletRequest request, @PathParam("feedName") String feedName) {
this.accessController.checkPermission(AccessController.SERVICES, OperationsAccessControl.ACCESS_OPS);
return metadataAccess.read(() -> {
final FeedHealth feedHealth = getFeedHealthCounts(request, feedName);
if (feedHealth != null) {
return FeedModelTransform.feedStatus(Lists.newArrayList(feedHealth));
}
final OpsManagerFeed feed = opsFeedManagerFeedProvider.findByName(feedName);
if (feed != null) {
return FeedModelTransform.feedStatus(feed);
} else {
throw new NotFoundException();
}
});
}
use of com.thinkbiganalytics.jobrepo.query.model.FeedHealth in project kylo by Teradata.
the class FeedHealthSummaryCache method getUserFeedHealth.
public SearchResult getUserFeedHealth(Long time, FeedSummaryFilter feedSummaryFilter, RoleSetExposingSecurityExpressionRoot userContext) {
SearchResult<com.thinkbiganalytics.jobrepo.query.model.FeedSummary> searchResult = new SearchResultImpl();
List<FeedHealth> feedSummaryHealth = null;
// get the entire list back and filter it for user access
List<? extends FeedSummary> list = getFeedSummaryList(time).stream().filter(filter(feedSummaryFilter, userContext)).collect(Collectors.toList());
feedSummaryHealth = list.stream().sorted(feedSummaryFilter.getSort() != null ? getComparator(feedSummaryFilter.getSort()) : byName).skip(feedSummaryFilter.getStart()).limit(feedSummaryFilter.getLimit() > 0 ? feedSummaryFilter.getLimit() : Integer.MAX_VALUE).map(f -> FeedModelTransform.feedHealth(f)).collect(Collectors.toList());
// Transform it to FeedSummary objects
FeedStatus feedStatus = FeedModelTransform.feedStatus(feedSummaryHealth);
Long total = new Long(list.size());
searchResult.setData(feedStatus.getFeedSummary());
searchResult.setRecordsTotal(total);
searchResult.setRecordsFiltered(total);
return searchResult;
}
use of com.thinkbiganalytics.jobrepo.query.model.FeedHealth in project kylo by Teradata.
the class FeedModelTransform method feedHealth.
/**
* Transform the FeedHealth domain object to the REST friendly FeedHealth object
*
* @return the transformed FeedHealth object
*/
public static FeedHealth feedHealth(com.thinkbiganalytics.metadata.api.feed.FeedHealth domain) {
FeedHealth feedHealth = new DefaultFeedHealth();
feedHealth.setUnhealthyCount(domain.getFailedCount());
feedHealth.setHealthyCount(domain.getCompletedCount());
feedHealth.setFeed(domain.getFeedName());
feedHealth.setFeedId(domain.getFeedId() != null ? domain.getFeedId().toString() : null);
feedHealth.setLastOpFeed(executedFeed(domain));
feedHealth.setStream(domain.isStream());
feedHealth.setRunningCount(domain.getRunningCount());
return feedHealth;
}
Aggregations