Search in sources :

Example 11 with ThroughputStat

use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat in project otter by alibaba.

the class ThroughputStatServiceImpl method listRealtimeThroughputByPipelineIds.

public List<ThroughputStat> listRealtimeThroughputByPipelineIds(List<Long> pipelineIds, int minute) {
    Assert.assertNotNull(pipelineIds);
    List<ThroughputStatDO> throughputStatDOs = throughputDao.listRealTimeThroughputStatByPipelineIds(pipelineIds, minute);
    List<ThroughputStat> infos = new ArrayList<ThroughputStat>();
    for (ThroughputStatDO throughputStatDO : throughputStatDOs) {
        infos.add(throughputStatDOToModel(throughputStatDO));
    }
    return infos;
}
Also used : ThroughputStatDO(com.alibaba.otter.manager.biz.statistics.throughput.dal.dataobject.ThroughputStatDO) ArrayList(java.util.ArrayList) ThroughputStat(com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat)

Example 12 with ThroughputStat

use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat in project otter by alibaba.

the class PipelineList method execute.

public void execute(@Param("channelId") Long channelId, @Param("pipelineId") Long pipelineId, HttpSession session, Context context) throws Exception {
    Channel channel = channelService.findByIdWithoutColumn(channelId);
    List<Pipeline> pipelines = channel.getPipelines();
    List<Pipeline> tempPipe = new ArrayList<Pipeline>();
    if ((pipelineId != null) && (pipelineId != 0l)) {
        for (Pipeline pipeline : pipelines) {
            if (!pipeline.getId().equals(pipelineId)) {
                tempPipe.add(pipeline);
            }
        }
        pipelines.removeAll(tempPipe);
    }
    Map<Long, DelayStat> delayStats = new HashMap<Long, DelayStat>(pipelines.size(), 1f);
    Map<Long, MainStemEventData> mainstemDatas = new HashMap<Long, MainStemEventData>(pipelines.size(), 1f);
    Map<Long, ThroughputStat> throughputStats = new HashMap<Long, ThroughputStat>(pipelines.size(), 1f);
    Map<Long, List<AlarmRule>> alarmRuleStats = new HashMap<Long, List<AlarmRule>>(pipelines.size(), 1f);
    Map<Long, PositionEventData> positionDatas = new HashMap<Long, PositionEventData>(pipelines.size(), 1f);
    for (Pipeline pipeline : pipelines) {
        DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipeline.getId());
        if (delayStat.getDelayNumber() == null) {
            delayStat.setDelayNumber(0L);
            delayStat.setDelayTime(0L);
            delayStat.setGmtModified(pipeline.getGmtModified());
        }
        delayStats.put(pipeline.getId(), delayStat);
        mainstemDatas.put(pipeline.getId(), arbitrateViewService.mainstemData(channel.getId(), pipeline.getId()));
        ThroughputCondition condition = new ThroughputCondition();
        condition.setPipelineId(pipeline.getId());
        condition.setType(ThroughputType.ROW);
        ThroughputStat throughputStat = throughputStatService.findThroughputStatByPipelineId(condition);
        throughputStats.put(pipeline.getId(), throughputStat);
        List<AlarmRule> alarmRules = alarmRuleService.getAlarmRules(pipeline.getId());
        alarmRuleStats.put(pipeline.getId(), alarmRules);
        PositionEventData positionData = arbitrateViewService.getCanalCursor(pipeline.getParameters().getDestinationName(), pipeline.getParameters().getMainstemClientId());
        positionDatas.put(pipeline.getId(), positionData);
    }
    context.put("channel", channel);
    context.put("pipelines", pipelines);
    context.put("delayStats", delayStats);
    context.put("throughputStats", throughputStats);
    context.put("alarmRuleStats", alarmRuleStats);
    context.put("mainstemDatas", mainstemDatas);
    context.put("positionDatas", positionDatas);
}
Also used : PositionEventData(com.alibaba.otter.shared.arbitrate.model.PositionEventData) HashMap(java.util.HashMap) AlarmRule(com.alibaba.otter.shared.common.model.config.alarm.AlarmRule) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ArrayList(java.util.ArrayList) MainStemEventData(com.alibaba.otter.shared.arbitrate.model.MainStemEventData) DelayStat(com.alibaba.otter.shared.common.model.statistics.delay.DelayStat) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) ThroughputStat(com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat) ArrayList(java.util.ArrayList) List(java.util.List) ThroughputCondition(com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputCondition)

Example 13 with ThroughputStat

use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat 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 14 with ThroughputStat

use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat in project otter by alibaba.

the class TopDelay method execute.

public void execute(@Param("searchKey") String searchKey, @Param("topN") int topN, @Param("statTime") int minute) {
    try {
        if (topN <= 0) {
            topN = 10;
        }
        if (minute <= 0) {
            minute = 1;
        }
        List<TopDelayStat> tops = delayStatService.listTopDelayStat(searchKey, topN);
        List<Long> pipelineIds = new ArrayList<Long>();
        for (TopDelayStat top : tops) {
            top.setStatTime(Long.valueOf(minute));
            pipelineIds.add(top.getPipelineId());
        }
        List<ThroughputStat> stats = throughputStatService.listRealtimeThroughputByPipelineIds(pipelineIds, minute);
        for (ThroughputStat stat : stats) {
            for (TopDelayStat top : tops) {
                if (stat.getPipelineId().equals(top.getPipelineId())) {
                    DataStat s = new DataStat(stat.getNumber(), stat.getSize());
                    if (ThroughputType.FILE == stat.getType()) {
                        top.setFileStat(s);
                    } else if (ThroughputType.ROW == stat.getType()) {
                        top.setDbStat(s);
                    }
                    break;
                }
            }
        }
        returnSuccess(JsonUtils.marshalToString(tops));
    } catch (Exception e) {
        String errorMsg = String.format("error happens while searchKey[%s] topN [%d]", searchKey, topN);
        log.error(errorMsg, e);
        returnError(errorMsg);
    }
}
Also used : DataStat(com.alibaba.otter.manager.biz.statistics.delay.param.TopDelayStat.DataStat) TopDelayStat(com.alibaba.otter.manager.biz.statistics.delay.param.TopDelayStat) ArrayList(java.util.ArrayList) ThroughputStat(com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat)

Example 15 with ThroughputStat

use of com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat in project otter by alibaba.

the class StatisticsClientServiceIntegration method sendThroughputs.

private void sendThroughputs() {
    Date now = new Date();
    ThroughputStat rowStat = new ThroughputStat();
    rowStat.setType(ThroughputType.ROW);
    rowStat.setStartTime(new Date(now.getTime() - 600 * 1000L));
    rowStat.setEndTime(now);
    rowStat.setPipelineId(1L);
    rowStat.setNumber(100L);
    rowStat.setSize(100L);
    ThroughputStat fileStat = new ThroughputStat();
    fileStat.setType(ThroughputType.FILE);
    fileStat.setStartTime(new Date(now.getTime() - 800 * 1000L));
    fileStat.setEndTime(now);
    fileStat.setPipelineId(1L);
    fileStat.setNumber(101L);
    fileStat.setSize(101L);
    statisticsClientService.sendThroughputs(Arrays.asList(rowStat, fileStat));
}
Also used : ThroughputStat(com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat) Date(java.util.Date)

Aggregations

ThroughputStat (com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat)15 ArrayList (java.util.ArrayList)8 Date (java.util.Date)5 ThroughputStatDO (com.alibaba.otter.manager.biz.statistics.throughput.dal.dataobject.ThroughputStatDO)4 ThroughputCondition (com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputCondition)4 HashMap (java.util.HashMap)4 ThroughputInfo (com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo)3 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)3 TopDelayStat (com.alibaba.otter.manager.biz.statistics.delay.param.TopDelayStat)2 DataStat (com.alibaba.otter.manager.biz.statistics.delay.param.TopDelayStat.DataStat)2 AnalysisType (com.alibaba.otter.manager.biz.statistics.throughput.param.AnalysisType)2 MainStemEventData (com.alibaba.otter.shared.arbitrate.model.MainStemEventData)2 AlarmRule (com.alibaba.otter.shared.common.model.config.alarm.AlarmRule)2 DelayStat (com.alibaba.otter.shared.common.model.statistics.delay.DelayStat)2 ThroughputType (com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType)2 LinkedHashMap (java.util.LinkedHashMap)2 RealtimeThroughputCondition (com.alibaba.otter.manager.biz.statistics.throughput.param.RealtimeThroughputCondition)1 TimelineThroughputCondition (com.alibaba.otter.manager.biz.statistics.throughput.param.TimelineThroughputCondition)1 LoadCounter (com.alibaba.otter.node.etl.load.loader.LoadStatsTracker.LoadCounter)1 LoadThroughput (com.alibaba.otter.node.etl.load.loader.LoadStatsTracker.LoadThroughput)1