Search in sources :

Example 61 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class AddDataMediaPair method execute.

public void execute(@Param("pipelineId") Long pipelineId, Context context, Navigator nav) throws Exception {
    Channel channel = channelService.findByPipelineId(pipelineId);
    if (channel.getStatus().isStart()) {
        nav.redirectTo(WebConstant.ERROR_FORBIDDEN_Link);
        return;
    }
    context.put("pipelineId", pipelineId);
    context.put("channelId", channel.getId());
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Example 62 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class AlarmRuleList method execute.

public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception {
    List<AlarmRule> alarmRules = alarmRuleService.getAlarmRules(pipelineId);
    Channel channel = channelService.findByPipelineId(pipelineId);
    context.put("alarmRules", alarmRules);
    context.put("pipelineId", pipelineId);
    context.put("channelId", channel.getId());
}
Also used : AlarmRule(com.alibaba.otter.shared.common.model.config.alarm.AlarmRule) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Example 63 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class AnalysisThroughputHistory 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, ThroughputInfo> throughputInfos1 = new LinkedHashMap<Long, ThroughputInfo>();
    Map<Long, ThroughputInfo> throughputInfos2 = new LinkedHashMap<Long, ThroughputInfo>();
    TimelineThroughputCondition condition1 = new TimelineThroughputCondition();
    TimelineThroughputCondition condition2 = new TimelineThroughputCondition();
    if (null != start && null != end) {
        condition1.setStart(start);
        condition1.setEnd(end);
        condition1.setType(ThroughputType.ROW);
        condition1.setPipelineId(pipelineId);
        condition2.setStart(start);
        condition2.setEnd(end);
        condition2.setType(ThroughputType.FILE);
        condition2.setPipelineId(pipelineId);
        throughputInfos1 = throughputStatService.listTimelineThroughput(condition1);
        throughputInfos2 = throughputStatService.listTimelineThroughput(condition2);
    }
    Long totalRecord1 = 0L;
    Long totalRecord2 = 0L;
    Long totalSize1 = 0L;
    Long totalSize2 = 0L;
    for (ThroughputInfo info : throughputInfos1.values()) {
        totalRecord1 += info.getNumber();
        totalSize1 += info.getSize();
    }
    for (ThroughputInfo info : throughputInfos2.values()) {
        totalRecord2 += info.getNumber();
        totalSize2 += info.getSize();
    }
    context.put("throughputInfos1", throughputInfos1);
    context.put("throughputInfos2", throughputInfos2);
    context.put("totalRecord1", totalRecord1);
    context.put("totalRecord2", totalRecord2);
    context.put("totalSize1", totalSize1);
    context.put("totalSize2", totalSize2);
    context.put("channel", channel);
    context.put("pipelineId", pipelineId);
    context.put("start", sdf.format(start));
    context.put("end", sdf.format(end));
}
Also used : TimelineThroughputCondition(com.alibaba.otter.manager.biz.statistics.throughput.param.TimelineThroughputCondition) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ThroughputInfo(com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) LinkedHashMap(java.util.LinkedHashMap)

Example 64 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class AnalysisThroughputStat method execute.

public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception {
    Channel channel = channelService.findByPipelineId(pipelineId);
    RealtimeThroughputCondition condition1 = new RealtimeThroughputCondition();
    RealtimeThroughputCondition condition2 = new RealtimeThroughputCondition();
    ThroughputCondition condition11 = new ThroughputCondition();
    ThroughputCondition condition22 = new ThroughputCondition();
    List<AnalysisType> analysisType = new ArrayList<AnalysisType>();
    analysisType.add(AnalysisType.ONE_MINUTE);
    analysisType.add(AnalysisType.FIVE_MINUTE);
    analysisType.add(AnalysisType.FIFTEEN_MINUTE);
    condition1.setPipelineId(pipelineId);
    condition1.setAnalysisType(analysisType);
    condition1.setType(ThroughputType.FILE);
    condition2.setPipelineId(pipelineId);
    condition2.setAnalysisType(analysisType);
    condition2.setType(ThroughputType.ROW);
    condition11.setPipelineId(pipelineId);
    condition11.setType(ThroughputType.FILE);
    condition22.setPipelineId(pipelineId);
    condition22.setType(ThroughputType.ROW);
    Map<AnalysisType, ThroughputInfo> throughputInfos1 = throughputStatService.listRealtimeThroughput(condition1);
    Map<AnalysisType, ThroughputInfo> throughputInfos2 = throughputStatService.listRealtimeThroughput(condition2);
    ThroughputStat throughputStat1 = throughputStatService.findThroughputStatByPipelineId(condition11);
    ThroughputStat throughputStat2 = throughputStatService.findThroughputStatByPipelineId(condition22);
    context.put("throughputInfos1", throughputInfos1);
    context.put("throughputInfos2", throughputInfos2);
    context.put("channel", channel);
    context.put("pipelineId", pipelineId);
    context.put("throughputStat1", throughputStat1);
    context.put("throughputStat2", throughputStat2);
    context.put("one", AnalysisType.ONE_MINUTE);
    context.put("five", AnalysisType.FIVE_MINUTE);
    context.put("fifteen", AnalysisType.FIFTEEN_MINUTE);
}
Also used : RealtimeThroughputCondition(com.alibaba.otter.manager.biz.statistics.throughput.param.RealtimeThroughputCondition) AnalysisType(com.alibaba.otter.manager.biz.statistics.throughput.param.AnalysisType) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ThroughputInfo(com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo) ArrayList(java.util.ArrayList) ThroughputStat(com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat) ThroughputCondition(com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputCondition) RealtimeThroughputCondition(com.alibaba.otter.manager.biz.statistics.throughput.param.RealtimeThroughputCondition)

Example 65 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class ConfigClientServiceIntegration method test_pipeline.

@Test
public void test_pipeline() {
    Long channelId = 11L;
    Channel channel = configClientService.findChannel(channelId);
    System.out.println(channel);
    want.number(channel.getId()).isEqualTo(channelId);
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) Test(org.testng.annotations.Test) BaseOtterTest(com.alibaba.otter.node.common.BaseOtterTest)

Aggregations

Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)77 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)38 Mock (mockit.Mock)16 ArrayList (java.util.ArrayList)13 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)10 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)10 ChannelArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent)10 BeforeClass (org.testng.annotations.BeforeClass)10 PipelineArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent)9 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)8 NodeArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent)8 Node (com.alibaba.otter.shared.common.model.config.node.Node)7 Event (com.alibaba.otter.shared.communication.core.model.Event)7 Test (org.testng.annotations.Test)7 ChannelStatus (com.alibaba.otter.shared.common.model.config.channel.ChannelStatus)6 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)6 HashMap (java.util.HashMap)6 ChannelDO (com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO)5 SystemParameter (com.alibaba.otter.shared.common.model.config.parameter.SystemParameter)5 Identity (com.alibaba.otter.shared.etl.model.Identity)5