Search in sources :

Example 11 with QJpaOpsManagerFeed

use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.

the class NifiFeedProcessorStatisticsProvider method findFeedProcessorStatisticsByProcessorId.

@Override
public List<? extends JpaNifiFeedProcessorStats> findFeedProcessorStatisticsByProcessorId(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.processorId, 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.processorId, stats.processorName).orderBy(stats.processorName.asc());
    return (List<JpaNifiFeedProcessorStats>) query.fetch();
}
Also used : QJpaOpsManagerFeed(com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed) List(java.util.List) JPAQuery(com.querydsl.jpa.impl.JPAQuery)

Example 12 with QJpaOpsManagerFeed

use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.

the class KyloEntityAwareAlertCriteria method createSummaryQuery.

public JPAQuery<AlertSummary> createSummaryQuery() {
    QJpaAlert alert = QJpaAlert.jpaAlert;
    QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
    QJpaOpsManagerFeed slaFeed = new QJpaOpsManagerFeed("slaFeed");
    QJpaServiceLevelAgreementDescription sla = QJpaServiceLevelAgreementDescription.jpaServiceLevelAgreementDescription;
    JPAQuery query = queryFactory.select(Projections.bean(KyloEntityAwareAlertSummary.class, alert.typeString.as("type"), alert.subtype.as("subtype"), alert.level.as("level"), feed.id.as("feedId"), feed.name.as("feedName"), sla.slaId.as("slaId"), sla.name.as("slaName"), alert.count().as("count"), alert.createdTimeMillis.max().as("lastAlertTimestamp"))).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).groupBy(alert.typeString, alert.subtype, feed.id, feed.name, sla.slaId, sla.name, alert.level);
    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);
    return (JPAQuery<AlertSummary>) super.addWhere(query, preds, orFilter);
}
Also used : QJpaOpsManagerFeed(com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed) QJpaAlert(com.thinkbiganalytics.metadata.jpa.alerts.QJpaAlert) BooleanBuilder(com.querydsl.core.BooleanBuilder) QJpaServiceLevelAgreementDescription(com.thinkbiganalytics.metadata.jpa.sla.QJpaServiceLevelAgreementDescription) JPAQuery(com.querydsl.jpa.impl.JPAQuery) Predicate(com.querydsl.core.types.Predicate)

Aggregations

QJpaOpsManagerFeed (com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed)12 JPAQuery (com.querydsl.jpa.impl.JPAQuery)10 List (java.util.List)8 BooleanBuilder (com.querydsl.core.BooleanBuilder)7 Predicate (com.querydsl.core.types.Predicate)5 ArrayList (java.util.ArrayList)5 JPQLQuery (com.querydsl.jpa.JPQLQuery)4 Stopwatch (com.google.common.base.Stopwatch)3 ConstructorExpression (com.querydsl.core.types.ConstructorExpression)3 Expression (com.querydsl.core.types.Expression)3 Projections (com.querydsl.core.types.Projections)3 JPAExpressions (com.querydsl.jpa.JPAExpressions)3 JPAQueryFactory (com.querydsl.jpa.impl.JPAQueryFactory)3 DateTimeUtil (com.thinkbiganalytics.DateTimeUtil)3 Alert (com.thinkbiganalytics.alerts.api.Alert)3 AlertProvider (com.thinkbiganalytics.alerts.api.AlertProvider)3 AlertManager (com.thinkbiganalytics.alerts.spi.AlertManager)3 DefaultAlertChangeEventContent (com.thinkbiganalytics.alerts.spi.DefaultAlertChangeEventContent)3 ClusterMessage (com.thinkbiganalytics.cluster.ClusterMessage)3 ClusterService (com.thinkbiganalytics.cluster.ClusterService)3