use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo in project pinpoint by naver.
the class FileDescriptorCodec method decodeValues.
@Override
public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {
final String id = decodingContext.getApplicationId();
final long baseTimestamp = decodingContext.getBaseTimestamp();
final long timestampDelta = decodingContext.getTimestampDelta();
final long initialTimestamp = baseTimestamp + timestampDelta;
int numValues = valueBuffer.readVInt();
List<Long> timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
// decode headers
final byte[] header = valueBuffer.readPrefixedBytes();
AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
JoinLongFieldEncodingStrategy openFileDescriptorCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
// decode values
final List<JoinLongFieldBo> openFileDescriptorCounts = this.codec.decodeValues(valueBuffer, openFileDescriptorCountEncodingStrategy, numValues);
List<JoinStatBo> joinFileDescriptorBoList = new ArrayList<>(numValues);
for (int i = 0; i < numValues; i++) {
JoinFileDescriptorBo joinFileDescriptorBo = new JoinFileDescriptorBo();
joinFileDescriptorBo.setId(id);
joinFileDescriptorBo.setTimestamp(timestamps.get(i));
joinFileDescriptorBo.setOpenFdCountJoinValue(openFileDescriptorCounts.get(i));
joinFileDescriptorBoList.add(joinFileDescriptorBo);
}
return joinFileDescriptorBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo in project pinpoint by naver.
the class JoinFileDescriptorBoMapperTest method map2Test.
@Test
public void map2Test() {
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId("testAgent");
tFAgentStat.setTimestamp(1491274138454L);
final JoinFileDescriptorBoMapper mapper = new JoinFileDescriptorBoMapper();
final JoinFileDescriptorBo joinFileDescriptorBo = mapper.map(tFAgentStat);
assertEquals(joinFileDescriptorBo, joinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo in project pinpoint by naver.
the class JoinFileDescriptorBoMapper method map.
@Override
public JoinFileDescriptorBo map(TFAgentStat tFAgentStat) {
if (!tFAgentStat.isSetFileDescriptor()) {
return JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO;
}
JoinFileDescriptorBo joinFileDescriptorBo = new JoinFileDescriptorBo();
final String agentId = tFAgentStat.getAgentId();
joinFileDescriptorBo.setId(agentId);
joinFileDescriptorBo.setTimestamp(tFAgentStat.getTimestamp());
TFFileDescriptor tFFileDescriptor = tFAgentStat.getFileDescriptor();
final long openFileDescriptorCount = tFFileDescriptor.getOpenFileDescriptorCount();
joinFileDescriptorBo.setOpenFdCountJoinValue(new JoinLongFieldBo(openFileDescriptorCount, openFileDescriptorCount, agentId, openFileDescriptorCount, agentId));
return joinFileDescriptorBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo in project pinpoint by naver.
the class JoinFileDescriptorBoMapper method build.
@Override
public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) {
JoinFileDescriptorBo joinFileDescriptorBo = this.map(tFAgentStat);
if (joinFileDescriptorBo == JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO) {
return;
}
builder.addFileDescriptor(joinFileDescriptorBo);
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo in project pinpoint by naver.
the class JoinFileDescriptorSamplerTest method sampleDataPoints.
@Test
public void sampleDataPoints() throws Exception {
JoinFileDescriptorSampler joinFileDescriptorSampler = new JoinFileDescriptorSampler();
List<JoinFileDescriptorBo> joinFileDescriptorBoList = new ArrayList<>(5);
long timeStamp = new Date().getTime();
joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", timeStamp + 5000));
joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", timeStamp + 10000));
joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", timeStamp + 15000));
joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", timeStamp + 20000));
joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", timeStamp + 25000));
AggreJoinFileDescriptorBo aggreJoinFileDescriptorBo = joinFileDescriptorSampler.sampleDataPoints(0, new Date().getTime(), joinFileDescriptorBoList, new JoinFileDescriptorBo());
assertEquals(aggreJoinFileDescriptorBo.getId(), "testApp");
assertEquals(aggreJoinFileDescriptorBo.getOpenFdCountJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1"));
}
Aggregations