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);
}
Aggregations