use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class NifiFeedProcessorStatisticsProvider method findForFeedStatisticsGroupedByTime.
public List<? extends JpaNifiFeedProcessorStats> findForFeedStatisticsGroupedByTime(String feedName, DateTime start, DateTime end) {
QJpaNifiFeedProcessorStats stats = QJpaNifiFeedProcessorStats.jpaNifiFeedProcessorStats;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
JPAQuery query = factory.select(Projections.bean(JpaNifiFeedProcessorStats.class, stats.feedName, stats.bytesIn.sum().as("bytesIn"), stats.bytesOut.sum().as("bytesOut"), stats.duration.sum().as("duration"), stats.jobsStarted.sum().as("jobsStarted"), stats.jobsFinished.sum().as("jobsFinished"), stats.jobDuration.sum().as("jobDuration"), stats.flowFilesStarted.sum().as("flowFilesStarted"), stats.flowFilesFinished.sum().as("flowFilesFinished"), stats.failedCount.sum().as("failedCount"), stats.minEventTime, stats.jobsStarted.sum().divide(stats.collectionIntervalSeconds).castToNum(BigDecimal.class).as("jobsStartedPerSecond"), stats.jobsFinished.sum().divide(stats.collectionIntervalSeconds).castToNum(BigDecimal.class).as("jobsFinishedPerSecond"), stats.collectionIntervalSeconds.as("collectionIntervalSeconds"), stats.jobsFailed.sum().as("jobsFailed"), stats.totalCount.sum().as("totalCount"), stats.count().as("resultSetCount"))).from(stats).innerJoin(feed).on(feed.name.eq(stats.feedName)).where(stats.feedName.eq(feedName).and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, accessController.isEntityAccessControlled())).and(stats.minEventTime.goe(start).and(stats.maxEventTime.loe(end)))).groupBy(stats.feedName, stats.minEventTime, stats.collectionIntervalSeconds).orderBy(stats.minEventTime.asc());
return (List<JpaNifiFeedProcessorStats>) query.fetch();
}
use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class NifiFeedProcessorStatisticsProvider method findFeedProcessorStatisticsByProcessorName.
@Override
public List<? extends JpaNifiFeedProcessorStats> findFeedProcessorStatisticsByProcessorName(String feedName, DateTime start, DateTime end) {
QJpaNifiFeedProcessorStats stats = QJpaNifiFeedProcessorStats.jpaNifiFeedProcessorStats;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
JPAQuery query = factory.select(Projections.bean(JpaNifiFeedProcessorStats.class, stats.feedName, stats.processorName, stats.bytesIn.sum().as("bytesIn"), stats.bytesOut.sum().as("bytesOut"), stats.duration.sum().as("duration"), stats.jobsStarted.sum().as("jobsStarted"), stats.jobsFinished.sum().as("jobsFinished"), stats.jobDuration.sum().as("jobDuration"), stats.flowFilesStarted.sum().as("flowFilesStarted"), stats.flowFilesFinished.sum().as("flowFilesFinished"), stats.totalCount.sum().as("totalCount"), stats.maxEventTime.max().as("maxEventTime"), stats.minEventTime.min().as("minEventTime"), stats.jobsFailed.sum().as("jobsFailed"), stats.failedCount.sum().as("failedCount"), stats.count().as("resultSetCount"))).from(stats).innerJoin(feed).on(feed.name.eq(stats.feedName)).where(stats.feedName.eq(feedName).and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, accessController.isEntityAccessControlled())).and(stats.minEventTime.goe(start).and(stats.maxEventTime.loe(end)))).groupBy(stats.feedName, stats.processorName).orderBy(stats.processorName.asc());
return (List<JpaNifiFeedProcessorStats>) query.fetch();
}
use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class JpaServiceLevelAssessmentProvider method findAll.
@Override
public Page<? extends ServiceLevelAssessment> findAll(String filter, Pageable pageable) {
QJpaServiceLevelAssessment serviceLevelAssessment = QJpaServiceLevelAssessment.jpaServiceLevelAssessment;
pageable = CommonFilterTranslations.resolveSortFilters(serviceLevelAssessment, pageable);
QJpaObligationAssessment obligationAssessment = new QJpaObligationAssessment("obligationAssessment");
QJpaMetricAssessment metricAssessment = new QJpaMetricAssessment("metricAssessment");
QJpaServiceLevelAgreementDescription serviceLevelAgreementDescription = new QJpaServiceLevelAgreementDescription("slaDescription");
QJpaOpsManagerFeed feed = new QJpaOpsManagerFeed("feed");
BooleanBuilder assessmentPredicate = GenericQueryDslFilter.buildFilter(serviceLevelAssessment, filter);
BooleanBuilder feedPredicate = GenericQueryDslFilter.buildFilter(feed, filter);
boolean invalidQuery = false;
// if there is not predicate found for the supplied 'filter' then fail the query
if (StringUtils.isNotBlank(filter) && (!assessmentPredicate.hasValue() && !feedPredicate.hasValue())) {
invalidQuery = true;
}
BooleanBuilder predicate = assessmentPredicate.and(feedPredicate);
if (invalidQuery) {
predicate.and(ExpressionUtils.eq(ConstantImpl.create("1"), ConstantImpl.create("2")));
}
predicate.and(feed.isNull().or(feed.isNotNull().and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, accessController.isEntityAccessControlled()))));
return findAllWithFetch(serviceLevelAssessment, predicate, true, pageable, QueryDslFetchJoin.innerJoin(serviceLevelAssessment.serviceLevelAgreementDescription, serviceLevelAgreementDescription), QueryDslFetchJoin.leftJoin(serviceLevelAgreementDescription.feeds, feed), QueryDslFetchJoin.leftJoin(serviceLevelAssessment.obligationAssessments, obligationAssessment), QueryDslFetchJoin.leftJoin(obligationAssessment.metricAssessments, metricAssessment));
}
use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class JpaBatchJobExecutionProvider method getJobStatusCountByDateFromNow.
/**
* gets job executions grouped by status and Day looking back from Now - the supplied {@code period}
*
* @param period period to look back from the current time to get job execution status
*/
@Override
public List<JobStatusCount> getJobStatusCountByDateFromNow(ReadablePeriod period, String filter) {
QJpaBatchJobExecution jobExecution = QJpaBatchJobExecution.jpaBatchJobExecution;
QJpaBatchJobInstance jobInstance = QJpaBatchJobInstance.jpaBatchJobInstance;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
BooleanBuilder whereBuilder = new BooleanBuilder();
whereBuilder.and(jobExecution.startTime.goe(DateTimeUtil.getNowUTCTime().minus(period)));
if (StringUtils.isNotBlank(filter)) {
whereBuilder.and(GenericQueryDslFilter.buildFilter(jobExecution, filter));
}
JPAQuery query = factory.select(Projections.constructor(JpaBatchJobExecutionStatusCounts.class, JobStatusDslQueryExpressionBuilder.jobState().as("status"), jobExecution.startYear, jobExecution.startMonth, jobExecution.startDay, jobExecution.count().as("count"))).from(jobExecution).innerJoin(jobInstance).on(jobExecution.jobInstance.jobInstanceId.eq(jobInstance.jobInstanceId)).innerJoin(feed).on(jobInstance.feed.id.eq(feed.id)).where(whereBuilder.and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, controller.isEntityAccessControlled()))).groupBy(jobExecution.status, jobExecution.startYear, jobExecution.startMonth, jobExecution.startDay);
return (List<JobStatusCount>) query.fetch();
}
use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class KyloEntityAwareAlertCriteria method createQuery.
public JPAQuery<JpaAlert> createQuery() {
QJpaAlert alert = QJpaAlert.jpaAlert;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
QJpaOpsManagerFeed slaFeed = new QJpaOpsManagerFeed("slaFeed");
QJpaServiceLevelAgreementDescription sla = QJpaServiceLevelAgreementDescription.jpaServiceLevelAgreementDescription;
JPAQuery<JpaAlert> query = queryFactory.select(alert).distinct().from(alert).leftJoin(feed).on(feed.id.uuid.eq(alert.entityId.value).and(alert.entityType.eq(Expressions.stringPath("'FEED'")))).leftJoin(sla).on(sla.slaId.uuid.eq(alert.entityId.value).and(alert.entityType.eq(Expressions.stringPath("'SLA'")))).leftJoin(sla.feeds, slaFeed).limit(getLimit());
List<Predicate> preds = filter(alert);
boolean entityAccessControlled = !isAsServiceAccount() && controller.isEntityAccessControlled();
preds.add(feed.isNull().or(feed.isNotNull().and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, entityAccessControlled))));
preds.add(slaFeed.isNull().or(slaFeed.isNotNull().and(FeedAclIndexQueryAugmentor.generateExistsExpression(slaFeed.id, entityAccessControlled))));
BooleanBuilder orFilter = orFilter(alert, feed, sla);
addEntityFilter(alert, preds);
// In all other cases sort descending. The results will be ordered correctly when aggregated by the provider.
if (getLimit() != Integer.MAX_VALUE && getAfterTime() != null && getBeforeTime() == null) {
query.orderBy(alert.createdTime.asc());
} else {
query.orderBy(alert.createdTime.desc());
}
return super.addWhere(query, preds, orFilter);
}
Aggregations