Search in sources :

Example 1 with AgentInfoBo

use of com.navercorp.pinpoint.common.server.bo.AgentInfoBo 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)

Aggregations

AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)1 JvmInfoBo (com.navercorp.pinpoint.common.server.bo.JvmInfoBo)1 ServerMetaDataBo (com.navercorp.pinpoint.common.server.bo.ServerMetaDataBo)1 Put (org.apache.hadoop.hbase.client.Put)1