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);
}
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);
}
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);
}
}
}
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);
}
}
Aggregations