use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType in project otter by alibaba.
the class StatsRemoteServiceImpl method flushThroughputStat.
private void flushThroughputStat() {
synchronized (throughputStats) {
Collection<Map<ThroughputType, ThroughputStat>> stats = throughputStats.values();
for (Map<ThroughputType, ThroughputStat> stat : stats) {
for (ThroughputStat data : stat.values()) {
throughputStatService.createOrUpdateThroughput(data);
}
}
throughputStats.clear();
}
}
use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType in project otter by alibaba.
the class StatsRemoteServiceImpl method onThroughputStat.
public void onThroughputStat(ThroughputStatEvent event) {
Assert.notNull(event);
Assert.notNull(event.getStats());
if (statUnit <= 0) {
for (ThroughputStat stat : event.getStats()) {
throughputStatService.createOrUpdateThroughput(stat);
}
} else {
synchronized (throughputStats) {
for (ThroughputStat stat : event.getStats()) {
Map<ThroughputType, ThroughputStat> data = throughputStats.get(stat.getPipelineId());
ThroughputStat old = data.get(stat.getType());
if (old != null) {
//执行合并
old.setNumber(stat.getNumber() + old.getNumber());
old.setSize(stat.getSize() + old.getSize());
if (stat.getEndTime().after(old.getEndTime())) {
old.setEndTime(stat.getEndTime());
}
if (stat.getStartTime().before(old.getStartTime())) {
old.setStartTime(stat.getStartTime());
}
} else {
data.put(stat.getType(), stat);
}
}
}
}
}
Aggregations