use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.
the class ConfigClientServiceImpl method findPipeline.
public Pipeline findPipeline(Long pipelineId) {
Long channelId = channelMapping.get(pipelineId);
Channel channel = channelCache.get(channelId);
List<Pipeline> pipelines = channel.getPipelines();
for (Pipeline pipeline : pipelines) {
if (pipeline.getId().equals(pipelineId)) {
return pipeline;
}
}
throw new ConfigException("no pipeline for pipelineId[" + pipelineId + "]");
}
use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.
the class AddPipeline method execute.
public void execute(@Param("channelId") Long channelId, Context context, Navigator nav) throws Exception {
Channel channel = channelService.findById(channelId);
if (channel.getStatus().isStart()) {
nav.redirectTo(WebConstant.ERROR_FORBIDDEN_Link);
return;
}
context.put("channelId", channelId);
context.put("nodes", nodeService.listAll());
}
use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.
the class AnalysisDelayStat method execute.
public void execute(@Param("d5221") String startTime, @Param("d5222") String endTime, @Param("pipelineId") Long pipelineId, HttpSession session, Context context) throws Exception {
Date end = null;
Date start = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) {
start = new Date(System.currentTimeMillis() / 60000 * 60000 - 24 * 60 * 60 * 1000);
end = new Date(System.currentTimeMillis() / 60000 * 60000);
} else {
// 当前24小时,时间取整分钟
sdf.setLenient(false);
if (null != startTime && null != endTime) {
start = sdf.parse(startTime);
end = sdf.parse(endTime);
}
}
Channel channel = channelService.findByPipelineId(pipelineId);
Map<Long, DelayStatInfo> delayStatInfos = new HashMap<Long, DelayStatInfo>();
if (null != start && null != end) {
delayStatInfos = delayStatService.listTimelineDelayStat(pipelineId, start, end);
}
Double delayAvg = 0.0;
for (DelayStatInfo info : delayStatInfos.values()) {
delayAvg += info.getAvgDelayTime();
}
if (delayStatInfos.size() != 0) {
delayAvg = delayAvg / (1.0 * delayStatInfos.size());
}
context.put("delayStatInfos", delayStatInfos);
context.put("delayAvg", delayAvg);
context.put("channel", channel);
context.put("pipelineId", pipelineId);
context.put("start", sdf.format(start));
context.put("end", sdf.format(end));
}
use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.
the class BehaviorHistoryCurve method execute.
public void execute(@Param("d5221") String startTime, @Param("d5222") String endTime, @Param("dataMediaPairId") Long dataMediaPairId, HttpSession session, Context context) throws Exception {
Date end = null;
Date start = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) {
start = new Date(System.currentTimeMillis() / 60000 * 60000 - 24 * 60 * 60 * 1000);
end = new Date(System.currentTimeMillis() / 60000 * 60000);
} else {
// 当前24小时,时间取整分钟
sdf.setLenient(false);
if (null != startTime && null != endTime) {
start = sdf.parse(startTime);
end = sdf.parse(endTime);
}
}
DataMediaPair dataMediaPair = dataMediaPairService.findById(dataMediaPairId);
Channel channel = channelService.findByPipelineId(dataMediaPair.getPipelineId());
Map<Long, BehaviorHistoryInfo> behaviourHistoryInfos = new LinkedHashMap<Long, BehaviorHistoryInfo>();
TimelineBehaviorHistoryCondition condition = new TimelineBehaviorHistoryCondition();
if (null != start && null != end) {
condition.setStart(start);
condition.setEnd(end);
condition.setPairId(dataMediaPairId);
behaviourHistoryInfos = tableStatService.listTimelineBehaviorHistory(condition);
}
Long totalInsert = 0L;
Long totalUpdate = 0L;
Long totalDelete = 0L;
Long totalFileCount = 0L;
Long totalFileSize = 0L;
for (BehaviorHistoryInfo info : behaviourHistoryInfos.values()) {
totalInsert += info.getInsertNumber();
totalUpdate += info.getUpdateNumber();
totalDelete += info.getDeleteNumber();
totalFileCount += info.getFileNumber();
totalFileSize += info.getFileSize();
}
context.put("totalInsert", totalInsert);
context.put("totalUpdate", totalUpdate);
context.put("totalDelete", totalDelete);
context.put("totalFileCount", totalFileCount);
context.put("totalFileSize", totalFileSize);
context.put("behaviourHistoryInfos", behaviourHistoryInfos);
context.put("start", sdf.format(start));
context.put("end", sdf.format(end));
context.put("dataMediaPair", dataMediaPair);
context.put("channel", channel);
}
use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.
the class CanalInfo method execute.
public void execute(@Param("canalId") Long canalId, Context context) throws Exception {
Canal canal = canalService.findById(canalId);
AutoKeeperCluster zkCluster = autoKeeperClusterService.findAutoKeeperClusterById(canal.getCanalParameter().getZkClusterId());
List<Pipeline> pipelines = pipelineService.listByDestinationWithoutOther(canal.getName());
List<Long> channelIds = new ArrayList<Long>();
for (Pipeline pipeline : pipelines) {
channelIds.add(pipeline.getChannelId());
}
List<Channel> channels = channelService.listOnlyChannels(channelIds.toArray(new Long[channelIds.size()]));
Map<Long, Channel> channelMap = new HashMap<Long, Channel>();
for (Channel channel : channels) {
channelMap.put(channel.getId(), channel);
}
context.put("canal", canal);
context.put("pipelines", pipelines);
context.put("channelMap", channelMap);
context.put("zkCluster", zkCluster);
}
Aggregations