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