Search in sources :

Example 1 with DelayCount

use of com.alibaba.otter.shared.common.model.statistics.delay.DelayCount in project otter by alibaba.

the class SelectTask method sendDelayStat.

private void sendDelayStat(long pipelineId, Long endTime, Long startTime) {
    DelayCount delayCount = new DelayCount();
    delayCount.setPipelineId(pipelineId);
    // 不再统计delayNumber
    delayCount.setNumber(0L);
    if (startTime != null && endTime != null) {
        // 以后改造成获取数据库的sysdate/now()
        delayCount.setTime(endTime - startTime);
    }
    statisticsClientService.sendResetDelayCount(delayCount);
}
Also used : DelayCount(com.alibaba.otter.shared.common.model.statistics.delay.DelayCount)

Example 2 with DelayCount

use of com.alibaba.otter.shared.common.model.statistics.delay.DelayCount in project otter by alibaba.

the class StatisticsClientServiceIntegration method sendDelayStat.

private void sendDelayStat() {
    DelayCount count = new DelayCount();
    count.setPipelineId(1L);
    count.setNumber(100L);
    count.setTime(5L);
    statisticsClientService.sendIncDelayCount(count);
    statisticsClientService.sendDecDelayCount(count);
}
Also used : DelayCount(com.alibaba.otter.shared.common.model.statistics.delay.DelayCount)

Example 3 with DelayCount

use of com.alibaba.otter.shared.common.model.statistics.delay.DelayCount in project otter by alibaba.

the class StatsRemoteServiceImpl method onDelayCount.

public void onDelayCount(DelayCountEvent event) {
    Assert.notNull(event);
    Assert.notNull(event.getCount());
    // 更新delay queue的计数器
    DelayCount count = event.getCount();
    // 构造一次delay stat快照
    DelayStat stat = new DelayStat();
    stat.setPipelineId(count.getPipelineId());
    // 不再记录堆积量
    stat.setDelayNumber(0L);
    // 只记录延迟时间,负数直接归为0
    stat.setDelayTime(count.getTime() >= 0 ? count.getTime() : 0);
    if (statUnit <= 0) {
        delayStatService.createDelayStat(stat);
    } else {
        synchronized (delayStats) {
            delayStats.get(count.getPipelineId()).merge(stat);
        }
    }
}
Also used : DelayCount(com.alibaba.otter.shared.common.model.statistics.delay.DelayCount) DelayStat(com.alibaba.otter.shared.common.model.statistics.delay.DelayStat)

Example 4 with DelayCount

use of com.alibaba.otter.shared.common.model.statistics.delay.DelayCount in project otter by alibaba.

the class SelectTask method sendDelayReset.

private void sendDelayReset(long pipelineId) {
    long currentTime = System.currentTimeMillis();
    if (currentTime - lastResetTime > 60 * 1000) {
        // 60秒向manager推送一次配置
        lastResetTime = currentTime;
        DelayCount delayCount = new DelayCount();
        delayCount.setPipelineId(pipelineId);
        delayCount.setNumber(0L);
        long delayTime = currentTime - otterSelector.lastEntryTime();
        delayCount.setTime(delayTime);
        statisticsClientService.sendResetDelayCount(delayCount);
    }
}
Also used : DelayCount(com.alibaba.otter.shared.common.model.statistics.delay.DelayCount)

Aggregations

DelayCount (com.alibaba.otter.shared.common.model.statistics.delay.DelayCount)4 DelayStat (com.alibaba.otter.shared.common.model.statistics.delay.DelayStat)1