Search in sources :

Example 1 with JvmInfoBo

use of com.navercorp.pinpoint.common.server.bo.JvmInfoBo in project pinpoint by naver.

the class HbaseAgentInfoDao method insert.

@Override
public void insert(TAgentInfo agentInfo) {
    if (agentInfo == null) {
        throw new NullPointerException("agentInfo must not be null");
    }
    if (logger.isDebugEnabled()) {
        logger.debug("insert agent info. {}", agentInfo);
    }
    byte[] agentId = Bytes.toBytes(agentInfo.getAgentId());
    long reverseKey = TimeUtils.reverseTimeMillis(agentInfo.getStartTimestamp());
    byte[] rowKey = RowKeyUtils.concatFixedByteAndLong(agentId, HBaseTables.AGENT_NAME_MAX_LEN, reverseKey);
    Put put = new Put(rowKey);
    // should add additional agent informations. for now added only starttime for sqlMetaData
    AgentInfoBo agentInfoBo = this.agentInfoBoMapper.map(agentInfo);
    byte[] agentInfoBoValue = agentInfoBo.writeValue();
    put.addColumn(HBaseTables.AGENTINFO_CF_INFO, HBaseTables.AGENTINFO_CF_INFO_IDENTIFIER, agentInfoBoValue);
    if (agentInfo.isSetServerMetaData()) {
        ServerMetaDataBo serverMetaDataBo = this.serverMetaDataBoMapper.map(agentInfo.getServerMetaData());
        byte[] serverMetaDataBoValue = serverMetaDataBo.writeValue();
        put.addColumn(HBaseTables.AGENTINFO_CF_INFO, HBaseTables.AGENTINFO_CF_INFO_SERVER_META_DATA, serverMetaDataBoValue);
    }
    if (agentInfo.isSetJvmInfo()) {
        JvmInfoBo jvmInfoBo = this.jvmInfoBoMapper.map(agentInfo.getJvmInfo());
        byte[] jvmInfoBoValue = jvmInfoBo.writeValue();
        put.addColumn(HBaseTables.AGENTINFO_CF_INFO, HBaseTables.AGENTINFO_CF_INFO_JVM, jvmInfoBoValue);
    }
    hbaseTemplate.put(HBaseTables.AGENTINFO, put);
}
Also used : AgentInfoBo(com.navercorp.pinpoint.common.server.bo.AgentInfoBo) JvmInfoBo(com.navercorp.pinpoint.common.server.bo.JvmInfoBo) ServerMetaDataBo(com.navercorp.pinpoint.common.server.bo.ServerMetaDataBo) Put(org.apache.hadoop.hbase.client.Put)

Example 2 with JvmInfoBo

use of com.navercorp.pinpoint.common.server.bo.JvmInfoBo in project pinpoint by naver.

the class JvmInfoBoMapper method map.

@Override
public JvmInfoBo map(TJvmInfo thriftObject) {
    short version = thriftObject.getVersion();
    String jvmVersion = thriftObject.getVmVersion();
    String gcTypeName = thriftObject.getGcType().name();
    JvmInfoBo jvmInfoBo = new JvmInfoBo(version);
    jvmInfoBo.setJvmVersion(jvmVersion);
    jvmInfoBo.setGcTypeName(gcTypeName);
    return jvmInfoBo;
}
Also used : JvmInfoBo(com.navercorp.pinpoint.common.server.bo.JvmInfoBo)

Example 3 with JvmInfoBo

use of com.navercorp.pinpoint.common.server.bo.JvmInfoBo in project pinpoint by naver.

the class AgentInfoMapper method mapRow.

@Override
public AgentInfo mapRow(Result result, int rowNum) throws Exception {
    byte[] rowKey = result.getRow();
    String agentId = BytesUtils.safeTrim(BytesUtils.toString(rowKey, 0, PinpointConstants.AGENT_NAME_MAX_LEN));
    long reverseStartTime = BytesUtils.bytesToLong(rowKey, HBaseTables.AGENT_NAME_MAX_LEN);
    long startTime = TimeUtils.recoveryTimeMillis(reverseStartTime);
    byte[] serializedAgentInfo = result.getValue(HBaseTables.AGENTINFO_CF_INFO, HBaseTables.AGENTINFO_CF_INFO_IDENTIFIER);
    byte[] serializedServerMetaData = result.getValue(HBaseTables.AGENTINFO_CF_INFO, HBaseTables.AGENTINFO_CF_INFO_SERVER_META_DATA);
    byte[] serializedJvmInfo = result.getValue(HBaseTables.AGENTINFO_CF_INFO, HBaseTables.AGENTINFO_CF_INFO_JVM);
    final AgentInfoBo.Builder agentInfoBoBuilder = createBuilderFromValue(serializedAgentInfo);
    agentInfoBoBuilder.setAgentId(agentId);
    agentInfoBoBuilder.setStartTime(startTime);
    if (serializedServerMetaData != null) {
        agentInfoBoBuilder.setServerMetaData(new ServerMetaDataBo.Builder(serializedServerMetaData).build());
    }
    if (serializedJvmInfo != null) {
        agentInfoBoBuilder.setJvmInfo(new JvmInfoBo(serializedJvmInfo));
    }
    return new AgentInfo(agentInfoBoBuilder.build());
}
Also used : AgentInfoBo(com.navercorp.pinpoint.common.server.bo.AgentInfoBo) JvmInfoBo(com.navercorp.pinpoint.common.server.bo.JvmInfoBo) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Aggregations

JvmInfoBo (com.navercorp.pinpoint.common.server.bo.JvmInfoBo)3 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)2 ServerMetaDataBo (com.navercorp.pinpoint.common.server.bo.ServerMetaDataBo)1 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)1 Put (org.apache.hadoop.hbase.client.Put)1