.from(table) .where(ZIPKIN_ANNOTATIONS.ENDPOINT_SERVICE_NAME.eq(request.serviceName)) .and(ZIPKIN_SPANS.START_TS.between(endTs - request.lookback * 1000, endTs)); dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null) { dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));
.from(table) .where(ZIPKIN_ANNOTATIONS.ENDPOINT_SERVICE_NAME.eq(request.serviceName)) .and(ZIPKIN_SPANS.START_TS.between(endTs - request.lookback * 1000, endTs)); dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null){ dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));
@Override public int getNumViews(LocalId pageId, DateTime startDate, DateTime endDate) throws DaoException { DSLContext context = getJooq(); Timestamp startTime = new Timestamp(startDate.getMillis()); Timestamp endTime = new Timestamp(endDate.getMillis()); try { Cursor<Record> result = context.select(). from(Tables.PAGEVIEW). where(Tables.PAGEVIEW.LANG_ID.eq(pageId.getLanguage().getId())). and(Tables.PAGEVIEW.TSTAMP.between(startTime, endTime)). and(Tables.PAGEVIEW.PAGE_ID.eq(pageId.getId())). fetchLazy(getFetchSize()); int numViews = 0; for (Record record : result){ numViews += record.getValue(Tables.PAGEVIEW.NUM_VIEWS); } return numViews; } finally { freeJooq(context); } }
@Override public int getNumViews(LocalId pageId, DateTime startDate, DateTime endDate) throws DaoException { DSLContext context = getJooq(); Timestamp startTime = new Timestamp(startDate.getMillis()); Timestamp endTime = new Timestamp(endDate.getMillis()); try { Cursor<Record> result = context.select(). from(Tables.PAGEVIEW). where(Tables.PAGEVIEW.LANG_ID.eq(pageId.getLanguage().getId())). and(Tables.PAGEVIEW.TSTAMP.between(startTime, endTime)). and(Tables.PAGEVIEW.PAGE_ID.eq(pageId.getId())). fetchLazy(getFetchSize()); int numViews = 0; for (Record record : result){ numViews += record.getValue(Tables.PAGEVIEW.NUM_VIEWS); } return numViews; } finally { freeJooq(context); } }
.where(lookback == null ? ZIPKIN_SPANS.START_TS.lessOrEqual(endTs) : ZIPKIN_SPANS.START_TS.between(endTs - lookback * 1000, endTs))
.where(lookback == null ? ZIPKIN_SPANS.START_TS.lessOrEqual(endTs) : ZIPKIN_SPANS.START_TS.between(endTs - lookback * 1000, endTs))
.where(lookback == null ? ZIPKIN_SPANS.START_TS.lessOrEqual(endTs) : ZIPKIN_SPANS.START_TS.between(endTs - lookback * 1000, endTs))
@Override public TIntIntMap getAllViews(Language language, DateTime startDate, DateTime endDate) throws DaoException { DSLContext context = getJooq(); Timestamp startTime = new Timestamp(startDate.getMillis()); Timestamp endTime = new Timestamp(endDate.getMillis()); try { Cursor<Record> result = context.select(). from(Tables.PAGEVIEW). where(Tables.PAGEVIEW.LANG_ID.eq(language.getId())). and(Tables.PAGEVIEW.TSTAMP.between(startTime, endTime)). fetchLazy(getFetchSize()); TIntIntMap views = new TIntIntHashMap( gnu.trove.impl.Constants.DEFAULT_CAPACITY, gnu.trove.impl.Constants.DEFAULT_LOAD_FACTOR, -1, -1); for (Record record : result){ views.adjustOrPutValue( record.getValue(Tables.PAGEVIEW.PAGE_ID), record.getValue(Tables.PAGEVIEW.NUM_VIEWS), record.getValue(Tables.PAGEVIEW.NUM_VIEWS)); } return views; } finally { freeJooq(context); } }
@Override public TIntIntMap getAllViews(Language language, DateTime startDate, DateTime endDate) throws DaoException { DSLContext context = getJooq(); Timestamp startTime = new Timestamp(startDate.getMillis()); Timestamp endTime = new Timestamp(endDate.getMillis()); try { Cursor<Record> result = context.select(). from(Tables.PAGEVIEW). where(Tables.PAGEVIEW.LANG_ID.eq(language.getId())). and(Tables.PAGEVIEW.TSTAMP.between(startTime, endTime)). fetchLazy(getFetchSize()); TIntIntMap views = new TIntIntHashMap( gnu.trove.impl.Constants.DEFAULT_CAPACITY, gnu.trove.impl.Constants.DEFAULT_LOAD_FACTOR, -1, -1); for (Record record : result){ views.adjustOrPutValue( record.getValue(Tables.PAGEVIEW.PAGE_ID), record.getValue(Tables.PAGEVIEW.NUM_VIEWS), record.getValue(Tables.PAGEVIEW.NUM_VIEWS)); } return views; } finally { freeJooq(context); } }
public boolean hasActiveProcess(DSLContext tx, Timestamp fromTime, Timestamp toTime) { int count = tx.selectCount() .from(PROCESS_QUEUE) .where(PROCESS_QUEUE.CREATED_AT.between(fromTime, toTime) .and(PROCESS_QUEUE.CURRENT_STATUS.notIn(ProcessStatus.FINISHED.name(), ProcessStatus.FAILED.name(), ProcessStatus.CANCELLED.name(), ProcessStatus.TIMED_OUT.name()))) .fetchOne(Record1::value1); return count > 0; }
.where(lookback == null ? ZIPKIN_SPANS.START_TS.lessOrEqual(endTs) : ZIPKIN_SPANS.START_TS.between(endTs - lookback * 1000, endTs))
SelectConditionStep<Record> dsl = context.selectDistinct(distinctFields) .from(table) .where(ZIPKIN_SPANS.START_TS.between(endTs - request.lookback * 1000, endTs)); dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null) { dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));