Package com.alibaba.otter.shared.common.model.statistics.delay

Examples of com.alibaba.otter.shared.common.model.statistics.delay.DelayStat


     * 通过pipeLineId得到一个以gmtCreate倒排序的第一条记录
     */
    public DelayStat findRealtimeDelayStat(Long pipelineId) {
        Assert.assertNotNull(pipelineId);
        DelayStatDO delayStatDO = delayStatDao.findRealtimeDelayStat(pipelineId);
        DelayStat delayStat = new DelayStat();
        if (delayStatDO != null) {
            delayStat = delayStatDOToModel(delayStatDO);
        }
        return delayStat;
    }
View Full Code Here


     *
     * @param delayStatDO
     * @return DelayStat
     */
    private DelayStat delayStatDOToModel(DelayStatDO delayStatDO) {
        DelayStat delayStat = new DelayStat();
        delayStat.setId(delayStatDO.getId());
        delayStat.setDelayTime(delayStatDO.getDelayTime());
        delayStat.setDelayNumber(delayStatDO.getDelayNumber());
        delayStat.setPipelineId(delayStatDO.getPipelineId());
        delayStat.setGmtCreate(delayStatDO.getGmtCreate());
        delayStat.setGmtModified(delayStatDO.getGmtModified());
        return delayStat;

    }
View Full Code Here

        Assert.notNull(event.getCount());

        // 更新delay queue的计数器
        DelayCount count = event.getCount();
        // 构造一次delay stat快照
        DelayStat stat = new DelayStat();
        stat.setPipelineId(count.getPipelineId());
        stat.setDelayNumber(0L); // 不再记录堆积量
        stat.setDelayTime(count.getTime() >= 0 ? count.getTime() : 0); // 只记录延迟时间,负数直接归为0

        if (statUnit <= 0) {
            delayStatService.createDelayStat(stat);
        } else {
            synchronized (delayStats) {
View Full Code Here

    private void flushDelayStat() {
        synchronized (delayStats) {
            // 需要做同步,避免delay数据丢失
            for (Map.Entry<Long, AvgStat> stat : delayStats.entrySet()) {
                if (stat.getValue().count.get() > 0) {
                    DelayStat delay = new DelayStat();
                    delay.setPipelineId(stat.getKey());
                    delay.setDelayTime(stat.getValue().getAvg());
                    delay.setDelayNumber(0L);
                    delayStatService.createDelayStat(delay);
                }
            }
            delayStats.clear();
        }
View Full Code Here

        Assert.notNull(event.getCount());

        // 更新delay queue的计数器
        DelayCount count = event.getCount();
        // 构造一次delay stat快照
        DelayStat stat = new DelayStat();
        stat.setPipelineId(count.getPipelineId());
        stat.setDelayNumber(0L); // 不再记录堆积量
        stat.setDelayTime(count.getTime()); // 只记录延迟时间

        if (statUnit <= 0) {
            delayStatService.createDelayStat(stat);
        } else {
            synchronized (delayStats) {
View Full Code Here

    private void flushDelayStat() {
        synchronized (delayStats) {
            // 需要做同步,避免delay数据丢失
            for (Map.Entry<Long, AvgStat> stat : delayStats.entrySet()) {
                if (stat.getValue().count.get() > 0) {
                    DelayStat delay = new DelayStat();
                    delay.setPipelineId(stat.getKey());
                    delay.setDelayTime(stat.getValue().getAvg());
                    delay.setDelayNumber(0L);
                    delayStatService.createDelayStat(delay);
                }
            }
            delayStats.clear();
        }
View Full Code Here

        Map<Long, MainStemEventData> mainstemDatas = new HashMap<Long, MainStemEventData>(pipelines.size(), 1f);
        Map<Long, ThroughputStat> throughputStats = new HashMap<Long, ThroughputStat>(pipelines.size(), 1f);
        Map<Long, List<AlarmRule>> alarmRuleStats = new HashMap<Long, List<AlarmRule>>(pipelines.size(), 1f);
        Map<Long, PositionEventData> positionDatas = new HashMap<Long, PositionEventData>(pipelines.size(), 1f);
        for (Pipeline pipeline : pipelines) {
            DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipeline.getId());
            if (delayStat.getDelayNumber() == null) {
                delayStat.setDelayNumber(0L);
                delayStat.setDelayTime(0L);
                delayStat.setGmtModified(pipeline.getGmtModified());
            }
            delayStats.put(pipeline.getId(), delayStat);
            mainstemDatas.put(pipeline.getId(), arbitrateViewService.mainstemData(channel.getId(), pipeline.getId()));
            ThroughputCondition condition = new ThroughputCondition();
            condition.setPipelineId(pipeline.getId());
View Full Code Here

                Channel channel = channelService.findByPipelineId(pipelineId);
                // 判断channel状态,只有启动状态才进行判断超时时间
                if (!channel.getStatus().isStop()) {

                    DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipelineId);
                    logger.info("delayStat.getDelayNumber() == " + delayStat.getDelayNumber());

                    if (null != delayStat.getDelayNumber()
                        && delayStat.getDelayNumber() >= queueSizeMap.get(pipelineId)) {
                        result = false;
                    }
                }
            }
        }
        if ((delayTimeMap != null) && (false == delayTimeMap.isEmpty())) {
            Set<Long> key = delayTimeMap.keySet();
            for (Iterator it = key.iterator(); it.hasNext();) {
                Long pipelineId = (Long) it.next();
                Channel channel = channelService.findByPipelineId(pipelineId);
                // 判断channel状态,只有启动状态才进行判断超时时间
                if (!channel.getStatus().isStop()) {
                    DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipelineId);
                    logger.info("delayStat.getDelayTime() == " + delayStat.getDelayTime());

                    if (null != delayStat.getDelayTime() && delayStat.getDelayTime() >= delayTimeMap.get(pipelineId)) {
                        result = false;
                    }
                }
            }
        }
View Full Code Here

            return;
        }

        // 进入到监控项级别的rule,pipelineId一定是相同的
        Long pipelineId = rules.get(0).getPipelineId();
        DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipelineId);
        Long delayNumber = 0L;
        Long delayTime = 0L; // seconds
        if (delayStat.getDelayNumber() != null) {
            delayNumber = delayStat.getDelayNumber();

        }
        if (delayStat.getDelayTime() != null) {
            delayTime = delayStat.getDelayTime();
        }

        boolean delayNumberFlag = false;
        boolean delayTimeFlag = false;
        for (AlarmRule rule : rules) {
View Full Code Here

            return;
        }

        // 进入到监控项级别的rule,pipelineId一定是相同的
        Long pipelineId = rules.get(0).getPipelineId();
        DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipelineId);
        Long delayTime = 0L; // seconds
        Long delayUpdate = 0L;
        if (delayStat.getDelayTime() != null) {
            delayTime = delayStat.getDelayTime() / 1000;
        }
        if (delayStat.getGmtCreate() != null) {
            delayUpdate = (new Date().getTime() - delayStat.getGmtCreate().getTime()) / 1000;
        }

        boolean delayTimeFlag = false;
        boolean delayUpdateFlag = false;
        for (AlarmRule rule : rules) {
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.common.model.statistics.delay.DelayStat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.