Search in sources :

Example 1 with AgentStat

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

the class LegacyAgentStatMapper method readAgentStatThriftDto.

// FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
@Deprecated
private List<AgentStat> readAgentStatThriftDto(String agentId, long timestamp, byte[] tAgentStatByteArray) throws TException {
    // CompactProtocol used
    TDeserializer deserializer = new TDeserializer(factory);
    TAgentStat tAgentStat = new TAgentStat();
    deserializer.deserialize(tAgentStat, tAgentStatByteArray);
    TJvmGc gc = tAgentStat.getGc();
    if (gc == null) {
        return Collections.emptyList();
    }
    AgentStatMemoryGcBo.Builder memoryGcBoBuilder = new AgentStatMemoryGcBo.Builder(tAgentStat.getAgentId(), tAgentStat.getStartTimestamp(), tAgentStat.getTimestamp());
    memoryGcBoBuilder.gcType(gc.getType().name());
    memoryGcBoBuilder.jvmMemoryHeapUsed(gc.getJvmMemoryHeapUsed());
    memoryGcBoBuilder.jvmMemoryHeapMax(gc.getJvmMemoryHeapMax());
    memoryGcBoBuilder.jvmMemoryNonHeapUsed(gc.getJvmMemoryNonHeapUsed());
    memoryGcBoBuilder.jvmMemoryNonHeapMax(gc.getJvmMemoryNonHeapMax());
    memoryGcBoBuilder.jvmGcOldCount(gc.getJvmGcOldCount());
    memoryGcBoBuilder.jvmGcOldTime(gc.getJvmGcOldTime());
    AgentStat agentStat = new AgentStat(agentId, timestamp);
    AgentStatMemoryGcBo agentStatMemoryGcBo = memoryGcBoBuilder.build();
    agentStat.setGcType(agentStatMemoryGcBo.getGcType());
    agentStat.setGcOldCount(agentStatMemoryGcBo.getJvmGcOldCount());
    agentStat.setGcOldTime(agentStatMemoryGcBo.getJvmGcOldTime());
    agentStat.setHeapUsed(agentStatMemoryGcBo.getJvmMemoryHeapUsed());
    agentStat.setHeapMax(agentStatMemoryGcBo.getJvmMemoryHeapMax());
    agentStat.setNonHeapUsed(agentStatMemoryGcBo.getJvmMemoryNonHeapUsed());
    agentStat.setNonHeapMax(agentStatMemoryGcBo.getJvmMemoryNonHeapMax());
    List<AgentStat> result = new ArrayList<>(1);
    result.add(agentStat);
    return result;
}
Also used : TDeserializer(org.apache.thrift.TDeserializer) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TJvmGc(com.navercorp.pinpoint.thrift.dto.TJvmGc) ArrayList(java.util.ArrayList) AgentStatMemoryGcBo(com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo)

Example 2 with AgentStat

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

the class LegacyAgentStatMapperTest method test_legacy_column_storage.

@Test
public void test_legacy_column_storage() throws Exception {
    // Given
    final Result result = Result.create(Arrays.asList(createCell(AGENT_STAT_COL_INTERVAL, Bytes.toBytes(COLLECT_INTERVAL)), createCell(AGENT_STAT_COL_GC_TYPE, Bytes.toBytes(GC_TYPE.name())), createCell(AGENT_STAT_COL_GC_OLD_COUNT, Bytes.toBytes(GC_OLD_COUNT)), createCell(AGENT_STAT_COL_GC_OLD_TIME, Bytes.toBytes(GC_OLD_TIME)), createCell(AGENT_STAT_COL_HEAP_USED, Bytes.toBytes(HEAP_USED)), createCell(AGENT_STAT_COL_HEAP_MAX, Bytes.toBytes(HEAP_MAX)), createCell(AGENT_STAT_COL_NON_HEAP_USED, Bytes.toBytes(NON_HEAP_USED)), createCell(AGENT_STAT_COL_NON_HEAP_MAX, Bytes.toBytes(NON_HEAP_MAX)), createCell(AGENT_STAT_COL_JVM_CPU, Bytes.toBytes(JVM_CPU_USAGE)), createCell(AGENT_STAT_COL_SYS_CPU, Bytes.toBytes(SYS_CPU_USAGE)), createCell(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW, Bytes.toBytes(SAMPLED_NEW_COUNT)), createCell(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION, Bytes.toBytes(SAMPLED_CONTINUATION_COUNT)), createCell(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW, Bytes.toBytes(UNSAMPLED_NEW_COUNT)), createCell(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION, Bytes.toBytes(UNSAMPLED_CONTINUATION_COUNT))));
    // When
    List<AgentStat> agentStats = this.mapper.mapRow(result, 0);
    // Then
    assertNotNull(agentStats);
    assertThat(agentStats.size(), is(1));
    AgentStat agentStat = agentStats.get(0);
    assertEquals(COLLECT_INTERVAL, agentStat.getCollectInterval());
    assertJvmGc(agentStat);
    assertCpuUsage(agentStat);
    assertTransaction(agentStat);
}
Also used : AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) Result(org.apache.hadoop.hbase.client.Result) Test(org.junit.Test)

Example 3 with AgentStat

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

the class LegacyAgentStatMapperTest method test_legacy_with_AGENT_STAT_CF_STATISTICS_V1.

@Test
public void test_legacy_with_AGENT_STAT_CF_STATISTICS_V1() throws Exception {
    // Given
    final Result result = createResultForLegacyWith_AGENT_STAT_CF_STATISTICS_V1();
    // When
    List<AgentStat> agentStats = this.mapper.mapRow(result, 0);
    // Then
    assertNotNull(agentStats);
    assertThat(agentStats.size(), is(1));
    AgentStat agentStat = agentStats.get(0);
    assertEquals(0, agentStat.getCollectInterval());
    assertJvmGc(agentStat);
    assertEquals(AgentStat.NOT_COLLECTED, agentStat.getJvmCpuUsage(), DELTA);
    assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSystemCpuUsage(), DELTA);
    assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledNewCount());
    assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledContinuationCount());
    assertEquals(AgentStat.NOT_COLLECTED, agentStat.getUnsampledNewCount());
    assertEquals(AgentStat.NOT_COLLECTED, agentStat.getUnsampledContinuationCount());
}
Also used : AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) Result(org.apache.hadoop.hbase.client.Result) Test(org.junit.Test)

Example 4 with AgentStat

use of com.navercorp.pinpoint.web.vo.AgentStat 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 5 with AgentStat

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

the class LegacyAgentStatChartV1Service 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");
    }
    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) AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) Range(com.navercorp.pinpoint.web.vo.Range)

Aggregations

AgentStat (com.navercorp.pinpoint.web.vo.AgentStat)10 TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)6 ArrayList (java.util.ArrayList)4 Result (org.apache.hadoop.hbase.client.Result)3 Test (org.junit.Test)3 AgentStatMemoryGcBo (com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo)2 Range (com.navercorp.pinpoint.web.vo.Range)2 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)2 ActiveTraceHistogramBo (com.navercorp.pinpoint.common.server.bo.ActiveTraceHistogramBo)1 AgentStatCpuLoadBo (com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo)1 TJvmGc (com.navercorp.pinpoint.thrift.dto.TJvmGc)1 DataPoint (com.navercorp.pinpoint.web.vo.chart.DataPoint)1 TitledDataPoint (com.navercorp.pinpoint.web.vo.chart.TitledDataPoint)1 SampledActiveTrace (com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace)1 SampledCpuLoad (com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad)1 SampledJvmGc (com.navercorp.pinpoint.web.vo.stat.SampledJvmGc)1 SampledTransaction (com.navercorp.pinpoint.web.vo.stat.SampledTransaction)1 List (java.util.List)1 Scan (org.apache.hadoop.hbase.client.Scan)1 TDeserializer (org.apache.thrift.TDeserializer)1