Search in sources :

Example 1 with TAgentStat

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

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

the class LegacyAgentStatMapperTest method createResultForLegacyWith_AGENT_STAT_CF_STATISTICS_V1.

private Result createResultForLegacyWith_AGENT_STAT_CF_STATISTICS_V1() throws TException {
    final TAgentStat agentStat = new TAgentStat();
    final TJvmGc gc = new TJvmGc();
    gc.setType(GC_TYPE);
    gc.setJvmGcOldCount(GC_OLD_COUNT);
    gc.setJvmGcOldTime(GC_OLD_TIME);
    gc.setJvmMemoryHeapUsed(HEAP_USED);
    gc.setJvmMemoryHeapMax(HEAP_MAX);
    gc.setJvmMemoryNonHeapUsed(NON_HEAP_USED);
    gc.setJvmMemoryNonHeapMax(NON_HEAP_MAX);
    agentStat.setGc(gc);
    final TProtocolFactory factory = new TCompactProtocol.Factory();
    final TSerializer serializer = new TSerializer(factory);
    final byte[] qualifier = AGENT_STAT_CF_STATISTICS_V1;
    final byte[] value = serializer.serialize(agentStat);
    return Result.create(Arrays.asList(createCell(qualifier, value)));
}
Also used : TProtocolFactory(org.apache.thrift.protocol.TProtocolFactory) TSerializer(org.apache.thrift.TSerializer) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TJvmGc(com.navercorp.pinpoint.thrift.dto.TJvmGc) TProtocolFactory(org.apache.thrift.protocol.TProtocolFactory)

Example 3 with TAgentStat

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

the class AgentStatHandler method handleAgentStatBatch.

private <T extends TAgentStatBatch> void handleAgentStatBatch(T agentStatBatch) {
    if (logger.isDebugEnabled()) {
        logger.debug("Received AgentStats={}", agentStatBatch);
    }
    String agentId = agentStatBatch.getAgentId();
    long startTimestamp = agentStatBatch.getStartTimestamp();
    for (TAgentStat agentStat : agentStatBatch.getAgentStats()) {
        handleAgentStat(agentId, startTimestamp, agentStat);
    }
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat)

Example 4 with TAgentStat

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

the class AgentStatBatchMapper method map.

@Override
public AgentStatBo map(TAgentStatBatch tAgentStatBatch) {
    if (!tAgentStatBatch.isSetAgentStats()) {
        return null;
    }
    AgentStatBo agentStatBo = new AgentStatBo();
    final String agentId = tAgentStatBatch.getAgentId();
    final long startTimestamp = tAgentStatBatch.getStartTimestamp();
    agentStatBo.setAgentId(agentId);
    List<JvmGcBo> jvmGcBos = new ArrayList<>(tAgentStatBatch.getAgentStatsSize());
    List<JvmGcDetailedBo> jvmGcDetailedBos = new ArrayList<>(tAgentStatBatch.getAgentStatsSize());
    List<CpuLoadBo> cpuLoadBos = new ArrayList<>(tAgentStatBatch.getAgentStatsSize());
    List<TransactionBo> transactionBos = new ArrayList<>(tAgentStatBatch.getAgentStatsSize());
    List<ActiveTraceBo> activeTraceBos = new ArrayList<>(tAgentStatBatch.getAgentStatsSize());
    List<DataSourceListBo> dataSourceListBos = new ArrayList<DataSourceListBo>(tAgentStatBatch.getAgentStatsSize());
    for (TAgentStat tAgentStat : tAgentStatBatch.getAgentStats()) {
        final long timestamp = tAgentStat.getTimestamp();
        // jvmGc
        if (tAgentStat.isSetGc()) {
            JvmGcBo jvmGcBo = this.jvmGcBoMapper.map(tAgentStat.getGc());
            setBaseData(jvmGcBo, agentId, startTimestamp, timestamp);
            jvmGcBos.add(jvmGcBo);
        }
        // jvmGcDetailed
        if (tAgentStat.isSetGc()) {
            if (tAgentStat.getGc().isSetJvmGcDetailed()) {
                JvmGcDetailedBo jvmGcDetailedBo = this.jvmGcDetailedBoMapper.map(tAgentStat.getGc().getJvmGcDetailed());
                setBaseData(jvmGcDetailedBo, agentId, startTimestamp, timestamp);
                jvmGcDetailedBos.add(jvmGcDetailedBo);
            }
        }
        // cpuLoad
        if (tAgentStat.isSetCpuLoad()) {
            CpuLoadBo cpuLoadBo = this.cpuLoadBoMapper.map(tAgentStat.getCpuLoad());
            setBaseData(cpuLoadBo, agentId, startTimestamp, timestamp);
            cpuLoadBos.add(cpuLoadBo);
        }
        // transaction
        if (tAgentStat.isSetTransaction()) {
            TransactionBo transactionBo = this.transactionBoMapper.map(tAgentStat.getTransaction());
            setBaseData(transactionBo, agentId, startTimestamp, timestamp);
            transactionBo.setCollectInterval(tAgentStat.getCollectInterval());
            transactionBos.add(transactionBo);
        }
        // activeTrace
        if (tAgentStat.isSetActiveTrace() && tAgentStat.getActiveTrace().isSetHistogram()) {
            ActiveTraceBo activeTraceBo = this.activeTraceBoMapper.map(tAgentStat.getActiveTrace());
            setBaseData(activeTraceBo, agentId, startTimestamp, timestamp);
            activeTraceBos.add(activeTraceBo);
        }
        // datasource
        if (tAgentStat.isSetDataSourceList()) {
            DataSourceListBo dataSourceListBo = new DataSourceListBo();
            setBaseData(dataSourceListBo, agentId, startTimestamp, timestamp);
            TDataSourceList dataSourceList = tAgentStat.getDataSourceList();
            if (dataSourceList.getDataSourceListSize() > 0) {
                for (TDataSource dataSource : dataSourceList.getDataSourceList()) {
                    DataSourceBo dataSourceBo = dataSourceBoMapper.map(dataSource);
                    setBaseData(dataSourceBo, agentId, startTimestamp, timestamp);
                    dataSourceListBo.add(dataSourceBo);
                }
            }
            dataSourceListBos.add(dataSourceListBo);
        }
    }
    agentStatBo.setJvmGcBos(jvmGcBos);
    agentStatBo.setJvmGcDetailedBos(jvmGcDetailedBos);
    agentStatBo.setCpuLoadBos(cpuLoadBos);
    agentStatBo.setTransactionBos(transactionBos);
    agentStatBo.setActiveTraceBos(activeTraceBos);
    agentStatBo.setDataSourceListBos(dataSourceListBos);
    return agentStatBo;
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) JvmGcDetailedBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo) ArrayList(java.util.ArrayList) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) TDataSource(com.navercorp.pinpoint.thrift.dto.TDataSource) TDataSourceList(com.navercorp.pinpoint.thrift.dto.TDataSourceList) DataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)

Example 5 with TAgentStat

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

the class AgentStatHandlerV2Test method insertShouldNotBeCalledIfTAgentStatIsMappedToNull.

@Test
public void insertShouldNotBeCalledIfTAgentStatIsMappedToNull() {
    // Given
    final String agentId = "agentId";
    final long startTimestamp = Long.MAX_VALUE;
    final TAgentStat agentStat = createAgentStat(agentId, startTimestamp);
    final AgentStatBo mappedAgentStat = null;
    when(this.agentStatMapper.map(agentStat)).thenReturn(mappedAgentStat);
    // When
    agentStatHandler.handle(agentStat);
    // Then
    verifyZeroInteractions(jvmGcDao);
    verifyZeroInteractions(jvmGcDetailedDao);
    verifyZeroInteractions(cpuLoadDao);
    verifyZeroInteractions(transactionDao);
    verifyZeroInteractions(activeTraceDao);
    verifyZeroInteractions(dataSourceDao);
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) Test(org.junit.Test)

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