Search in sources :

Example 6 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class LegacyAgentStatChartCompatibilityService method selectAgentStatList.

@Override
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
    if (agentId == null) {
        throw new NullPointerException("agentId must not be null");
    }
    if (timeWindow == null) {
        throw new NullPointerException("timeWindow must not be null");
    }
    List<SampledJvmGc> jvmGcs = sampledJvmGcDao.getSampledAgentStatList(agentId, timeWindow);
    if (CollectionUtils.isNotEmpty(jvmGcs)) {
        List<SampledCpuLoad> cpuLoads = sampledCpuLoadDao.getSampledAgentStatList(agentId, timeWindow);
        List<SampledTransaction> transactions = sampledTransactionDao.getSampledAgentStatList(agentId, timeWindow);
        List<SampledActiveTrace> activeTraces = sampledActiveTraceDao.getSampledAgentStatList(agentId, timeWindow);
        LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder builder = new LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder(timeWindow);
        builder.jvmGcs(jvmGcs);
        builder.cpuLoads(cpuLoads);
        builder.transactions(transactions);
        builder.activeTraces(activeTraces);
        return builder.build();
    } else {
        long scanFrom = timeWindow.getWindowRange().getFrom();
        long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
        Range rangeToScan = new Range(scanFrom, scanTo);
        List<AgentStat> agentStats = legacyAgentStatDao.getAgentStatList(agentId, rangeToScan);
        LegacyAgentStatChartGroup chartGroup = new LegacyAgentStatChartGroup(timeWindow);
        chartGroup.addAgentStats(agentStats);
        chartGroup.buildCharts();
        return chartGroup;
    }
}
Also used : LegacyAgentStatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup) SampledActiveTrace(com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace) Range(com.navercorp.pinpoint.web.vo.Range) SampledCpuLoad(com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad) SampledTransaction(com.navercorp.pinpoint.web.vo.stat.SampledTransaction) AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc)

Example 7 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class HbaseSampledActiveTraceDao method getSampledAgentStatList.

@Override
public List<SampledActiveTrace> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = new Range(scanFrom, scanTo);
    SampledAgentStatResultExtractor<ActiveTraceBo, SampledActiveTrace> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, activeTraceSampler);
    return operations.getSampledAgentStatList(resultExtractor, agentId, range);
}
Also used : SampledAgentStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor) SampledActiveTrace(com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace) Range(com.navercorp.pinpoint.web.vo.Range) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)

Example 8 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class HbaseSampledJvmGcDao method getSampledAgentStatList.

@Override
public List<SampledJvmGc> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = new Range(scanFrom, scanTo);
    SampledAgentStatResultExtractor<JvmGcBo, SampledJvmGc> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, sampler);
    return operations.getSampledAgentStatList(resultExtractor, agentId, range);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledAgentStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Range(com.navercorp.pinpoint.web.vo.Range)

Example 9 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class HbaseSampledTransactionDao method getSampledAgentStatList.

@Override
public List<SampledTransaction> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = new Range(scanFrom, scanTo);
    SampledAgentStatResultExtractor<TransactionBo, SampledTransaction> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, transactionSampler);
    return operations.getSampledAgentStatList(resultExtractor, agentId, range);
}
Also used : SampledTransaction(com.navercorp.pinpoint.web.vo.stat.SampledTransaction) SampledAgentStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor) Range(com.navercorp.pinpoint.web.vo.Range) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)

Example 10 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class AdminServiceImpl method filterInactiveAgents.

private List<String> filterInactiveAgents(List<String> agentIds, int durationDays) {
    if (CollectionUtils.isEmpty(agentIds)) {
        return Collections.emptyList();
    }
    List<String> inactiveAgentIds = new ArrayList<>();
    final long toTimestamp = System.currentTimeMillis();
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, durationDays * -1);
    final long fromTimestamp = cal.getTimeInMillis();
    Range queryRange = new Range(fromTimestamp, toTimestamp);
    for (String agentId : agentIds) {
        // FIXME This needs to be done with a more accurate information.
        // If at any time a non-java agent is introduced, or an agent that does not collect jvm data,
        // this will fail
        boolean dataExists = this.jvmGcDao.agentStatExists(agentId, queryRange);
        if (!dataExists) {
            inactiveAgentIds.add(agentId);
        }
    }
    return inactiveAgentIds;
}
Also used : Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Range(com.navercorp.pinpoint.web.vo.Range)

Aggregations

Range (com.navercorp.pinpoint.web.vo.Range)101 Test (org.junit.Test)62 TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)23 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)16 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)16 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)15 Application (com.navercorp.pinpoint.web.vo.Application)12 SampledAgentStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor)9 List (java.util.List)8 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)6 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)6 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)5 TimeWindowSlotCentricSampler (com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler)5 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)5 ArrayList (java.util.ArrayList)5 TimeWindowSampler (com.navercorp.pinpoint.web.util.TimeWindowSampler)4 StopWatch (org.springframework.util.StopWatch)4 ApplicationIndexDao (com.navercorp.pinpoint.web.dao.ApplicationIndexDao)3