Search in sources :

Example 11 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class AgentStatHandler method handle.

@Override
public void handle(TBase<?, ?> tbase) {
    // FIXME (2014.08) Legacy - TAgentStats should not be sent over the wire.
    if (tbase instanceof TAgentStat) {
        final TAgentStat agentStat = (TAgentStat) tbase;
        String agentId = agentStat.getAgentId();
        long startTimestamp = agentStat.getStartTimestamp();
        handleAgentStat(agentId, startTimestamp, agentStat);
    } else if (tbase instanceof TAgentStatBatch) {
        handleAgentStatBatch((TAgentStatBatch) tbase);
    } else {
        throw new IllegalArgumentException("unexpected tbase:" + tbase + " expected:" + TAgentStat.class.getName() + " or " + TAgentStatBatch.class.getName());
    }
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)

Example 12 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class AgentStatHandlerV2 method handle.

@Override
public void handle(TBase<?, ?> tbase) {
    // FIXME (2014.08) Legacy - TAgentStat should not be sent over the wire.
    if (tbase instanceof TAgentStat) {
        TAgentStat tAgentStat = (TAgentStat) tbase;
        this.handleAgentStat(tAgentStat);
    } else if (tbase instanceof TAgentStatBatch) {
        TAgentStatBatch tAgentStatBatch = (TAgentStatBatch) tbase;
        this.handleAgentStatBatch(tAgentStatBatch);
    } else {
        throw new IllegalArgumentException("unexpected tbase:" + tbase + " expected:" + TAgentStat.class.getName() + " or " + TAgentStatBatch.class.getName());
    }
    if (agentStatService != null) {
        agentStatService.save(tbase);
    }
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)

Example 13 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class AgentStatHandlerV2Test method createAgentStatBatch.

private TAgentStatBatch createAgentStatBatch(String agentId, long startTimestamp, int numBatches) {
    final TAgentStatBatch agentStatBatch = new TAgentStatBatch();
    agentStatBatch.setAgentId(agentId);
    agentStatBatch.setStartTimestamp(startTimestamp);
    final List<TAgentStat> agentStats = new ArrayList<>(numBatches);
    for (int i = 0; i < numBatches; ++i) {
        agentStats.add(createAgentStat(agentId, startTimestamp));
    }
    agentStatBatch.setAgentStats(agentStats);
    return agentStatBatch;
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) ArrayList(java.util.ArrayList) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)

Example 14 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class AgentStatHandlerV2Test method createAgentStat.

private TAgentStat createAgentStat(String agentId, long startTimestamp) {
    final TAgentStat agentStat = new TAgentStat();
    agentStat.setAgentId(agentId);
    agentStat.setStartTimestamp(startTimestamp);
    agentStat.setGc(new TJvmGc());
    agentStat.setCpuLoad(new TCpuLoad());
    agentStat.setDataSourceList(new TDataSourceList());
    return agentStat;
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TDataSourceList(com.navercorp.pinpoint.thrift.dto.TDataSourceList) TJvmGc(com.navercorp.pinpoint.thrift.dto.TJvmGc) TCpuLoad(com.navercorp.pinpoint.thrift.dto.TCpuLoad)

Example 15 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat 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

TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)20 TAgentStatBatch (com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)6 ArrayList (java.util.ArrayList)5 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)4 TDeadlock (com.navercorp.pinpoint.thrift.dto.TDeadlock)4 TJvmGc (com.navercorp.pinpoint.thrift.dto.TJvmGc)4 Test (org.junit.Test)4 AgentEventBo (com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)3 TDataSourceList (com.navercorp.pinpoint.thrift.dto.TDataSourceList)3 DeadlockBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockBo)2 DeadlockEventBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockEventBo)2 TCpuLoad (com.navercorp.pinpoint.thrift.dto.TCpuLoad)2 AgentStat (com.navercorp.pinpoint.web.vo.AgentStat)2 ActiveTraceHistogramBo (com.navercorp.pinpoint.common.server.bo.ActiveTraceHistogramBo)1 AgentStatMemoryGcBo (com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo)1 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)1 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)1 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)1 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)1 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)1