Search in sources :

Example 6 with AgentStat

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

the class LegacyHbaseAgentStatDao method getAgentStatListFromRaw.

private List<AgentStat> getAgentStatListFromRaw(String agentId, Range range) {
    Scan scan = createScan(agentId, range);
    scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
    List<List<AgentStat>> intermediate = hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, agentStatMapper);
    // data for 5 seconds
    int expectedSize = (int) (range.getRange() / 5000);
    List<AgentStat> merged = new ArrayList<>(expectedSize);
    for (List<AgentStat> each : intermediate) {
        merged.addAll(each);
    }
    return merged;
}
Also used : AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) ArrayList(java.util.ArrayList) Scan(org.apache.hadoop.hbase.client.Scan) ArrayList(java.util.ArrayList) List(java.util.List)

Example 7 with AgentStat

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

the class LegacyAgentStatMapperTest method test_legacy_serialized_BOs.

@Test
public void test_legacy_serialized_BOs() throws Exception {
    // Given
    final Result result = createResultForLegacy_serialized_BOs();
    // 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);
    assertCpuUsage(agentStat);
    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 8 with AgentStat

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

the class LegacyAgentStatChartGroup method addAgentStats.

public void addAgentStats(List<AgentStat> agentStats) {
    for (int i = agentStats.size() - 1; i >= 0; --i) {
        AgentStat agentStat = agentStats.get(i);
        if (agentStat != null) {
            AgentStat previous = i == agentStats.size() - 1 ? null : agentStats.get(i + 1);
            addMemoryGcData(agentStat, previous);
            addCpuLoadData(agentStat);
            addTransactionData(agentStat);
            addActiveTraceData(agentStat);
        }
    }
}
Also used : AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) TitledDataPoint(com.navercorp.pinpoint.web.vo.chart.TitledDataPoint) DataPoint(com.navercorp.pinpoint.web.vo.chart.DataPoint)

Example 9 with AgentStat

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

the class LegacyAgentStatMapper method readSerializedBos.

// FIXME (2015.10) Legacy column for storing serialzied Bos separately.
@Deprecated
private List<AgentStat> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
    AgentStat agentStat = new AgentStat(agentId, timestamp);
    if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_MEMORY_GC)) {
        AgentStatMemoryGcBo.Builder builder = new AgentStatMemoryGcBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_MEMORY_GC));
        AgentStatMemoryGcBo agentStatMemoryGcBo = builder.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());
    }
    if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_CPU_LOAD)) {
        AgentStatCpuLoadBo.Builder builder = new AgentStatCpuLoadBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_CPU_LOAD));
        AgentStatCpuLoadBo agentStatCpuLoadBo = builder.build();
        agentStat.setJvmCpuUsage(agentStatCpuLoadBo.getJvmCpuLoad());
        agentStat.setSystemCpuUsage(agentStatCpuLoadBo.getSystemCpuLoad());
    }
    List<AgentStat> result = new ArrayList<>(1);
    result.add(agentStat);
    return result;
}
Also used : AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) ArrayList(java.util.ArrayList) AgentStatMemoryGcBo(com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo) AgentStatCpuLoadBo(com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo)

Example 10 with AgentStat

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

the class LegacyAgentStatMapper method mapRow.

public List<AgentStat> mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return Collections.emptyList();
    }
    final byte[] rowKey = getOriginalKey(result.getRow());
    final String agentId = BytesUtils.toString(rowKey, 0, AGENT_NAME_MAX_LEN).trim();
    final long reverseTimestamp = BytesUtils.bytesToLong(rowKey, AGENT_NAME_MAX_LEN);
    final long timestamp = TimeUtils.recoveryTimeMillis(reverseTimestamp);
    NavigableMap<byte[], byte[]> qualifierMap = result.getFamilyMap(AGENT_STAT_CF_STATISTICS);
    if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_V1)) {
        // FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
        return readAgentStatThriftDto(agentId, timestamp, qualifierMap.get(AGENT_STAT_CF_STATISTICS_V1));
    } else if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_MEMORY_GC) || qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_CPU_LOAD)) {
        // FIXME (2015.10) Legacy column for storing serialzied Bos separately.
        return readSerializedBos(agentId, timestamp, qualifierMap);
    }
    AgentStat agentStat = new AgentStat(agentId, timestamp);
    if (qualifierMap.containsKey(AGENT_STAT_COL_INTERVAL)) {
        agentStat.setCollectInterval(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_INTERVAL)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_GC_TYPE)) {
        agentStat.setGcType(Bytes.toString(qualifierMap.get(AGENT_STAT_COL_GC_TYPE)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_GC_OLD_COUNT)) {
        agentStat.setGcOldCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_GC_OLD_COUNT)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_GC_OLD_TIME)) {
        agentStat.setGcOldTime(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_GC_OLD_TIME)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_HEAP_USED)) {
        agentStat.setHeapUsed(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_HEAP_USED)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_HEAP_MAX)) {
        agentStat.setHeapMax(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_HEAP_MAX)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_NON_HEAP_USED)) {
        agentStat.setNonHeapUsed(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_NON_HEAP_USED)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_NON_HEAP_MAX)) {
        agentStat.setNonHeapMax(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_NON_HEAP_MAX)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_JVM_CPU)) {
        agentStat.setJvmCpuUsage(Bytes.toDouble(qualifierMap.get(AGENT_STAT_COL_JVM_CPU)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_SYS_CPU)) {
        agentStat.setSystemCpuUsage(Bytes.toDouble(qualifierMap.get(AGENT_STAT_COL_SYS_CPU)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW)) {
        agentStat.setSampledNewCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION)) {
        agentStat.setSampledContinuationCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW)) {
        agentStat.setUnsampledNewCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION)) {
        agentStat.setUnsampledContinuationCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION)));
    }
    if (qualifierMap.containsKey(AGENT_STAT_COL_ACTIVE_TRACE_HISTOGRAM)) {
        ActiveTraceHistogramBo activeTraceHistogramBo = new ActiveTraceHistogramBo(qualifierMap.get(AGENT_STAT_COL_ACTIVE_TRACE_HISTOGRAM));
        agentStat.setHistogramSchema(BaseHistogramSchema.getDefaultHistogramSchemaByTypeCode(activeTraceHistogramBo.getHistogramSchemaType()));
        agentStat.setActiveTraceCounts(activeTraceHistogramBo.getActiveTraceCountMap());
    }
    List<AgentStat> agentStats = new ArrayList<>();
    agentStats.add(agentStat);
    return agentStats;
}
Also used : AgentStat(com.navercorp.pinpoint.web.vo.AgentStat) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) ActiveTraceHistogramBo(com.navercorp.pinpoint.common.server.bo.ActiveTraceHistogramBo) ArrayList(java.util.ArrayList)

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